•
8-bit character size (CTRLB.CHSIZE=0)
•
T=0 (CTRLA.CMODE=1) or T=1 (CTRLA.CMODE=0)
ISO 7816 is a half duplex communication on a single bidirectional line. The USART connects to a smart
card as shown below. The output is only driven when the USART is transmitting. The USART is
considered as the master of the communication as it generates the clock.
Figure 32-15. Connection of a Smart Card to the SERCOM USART
TXD/RXD
SERCOM
USART
SCK
I/O
Smart
Card
CLK
ISO 7816 characters are specified as 8 bits with even parity. The USART must be configured accordingly.
The USART cannot operate concurrently in both receiver and transmitter modes as the communication is
unidirectional. It has to be configured according to the required mode by enabling or disabling either the
receiver or the transmitter as desired. Enabling both the receiver and the transmitter at the same time in
ISO 7816 mode may lead to unpredictable results.
The ISO 7816 specification defines an inverse transmission format. Data bits of the character must be
transmitted on the I/O line at their negative value (CTRLA.RXINV=1 and CTRLA.TXINV=1).
Protocol T=0
In T=0 protocol, a character is made up of:
•
one start bit,
•
eight data bits,
•
one parity bit
•
and one guard time, which lasts two bit times.
The transfer is synchronous (CTRLA.CMODE=1). The transmitter shifts out the bits and does not drive
the I/O line during the guard time. Additional guard time can be added by programming the Guard Time
(CTRLC.GTIME).
If no parity error is detected, the I/O line remains during the guard time and the transmitter can continue
with the transmission of the next character, as shown in the figure below.
Figure 32-16. T=0 Protocol without Parity Error
SCK
I/O
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
P
Guard
Time1
Guard
Time2
Next
Start
Bit
If a parity error is detected by the receiver, it drives the I/O line to 0 during the guard time, as shown in the
next figure. This error bit is also named NACK, for Non Acknowledge. In this case, the character lasts 1
bit time more, as the guard time length is the same and is added to the error bit time, which lasts 1 bit
time.
Figure 32-17. T=0 Protocol with Parity Error
SCK
I/O
Start
Bit
D0
D1
D2
D3
D4
D5
D6
D7
P
Guard
Time1
Guard
Time2
Start
Bit
D0
D1
Repetition
Error
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
613