
586
SAM G51 [DATASHEET]
11209C–ATARM–20-Dec-13
SVACC remains high until a STOP condition or a repeated START is detected. When such a condition is detected,
EOSACC (End Of Slave ACCess) flag is set.
Read Sequence
In the case of a read sequence (SVREAD is high), the TWI transfers data written in the TWIHS_THR (TWI Transmit
Holding Register) until a STOP condition or a REPEATED_START + an address different from SADR is detected. Note
that at the end of the read sequence TXCOMP (Transmission Complete) flag is set and SVACC reset.
As soon as data is written in the TWIHS_THR, TXRDY (Transmit Holding Register Ready) flag is reset, and it is set when
the internal shifter is empty and the sent data acknowledged or not. If the data is not acknowledged, the NACK flag is set.
Note that a STOP or a repeated START always follows a NACK.
Write Sequence
In the case of a write sequence (SVREAD is low), the RXRDY (Receive Holding Register Ready) flag is set as soon as a
character has been received in the TWIHS_RHR (TWI Receive Holding Register). RXRDY is reset when reading the
TWIHS_RHR.
TWI continues receiving data until a STOP condition or a REPEATED_START + an address different from SADR is
detected. Note that at the end of the write sequence TXCOMP flag is set and SVACC reset.
Clock Stretching Sequence
If TWIHS_THR or TWIHS_RHR is not written/read in time, the TWI performs a clock stretching.
Clock stretching information is given by the SCLWS (Clock Wait state) bit.
Note:
Clock stretching can be disabled by configuring the SCLWSDIS bit in the TWIHS_SMR. In that case, UNRE and
OVRE flags will indicate underrun (when TWIHS_THR is not filled on time) or overrun (when TWIHS_RHR is not
read on time).
General Call
In the case where a GENERAL CALL is performed, GACC (General Call ACCess) flag is set.
After GACC is set, it is up to the user to interpret the meaning of the GENERAL CALL and to decode the new address
programming sequence.
27.7.5.5
Data Transfer
Read Operation
The read mode is defined as a data requirement from the master.
After a START or a REPEATED START condition is detected, the decoding of the address starts. If the slave address
(SADR) is decoded, SVACC is set and SVREAD indicates the direction of the transfer.
Until a STOP or REPEATED START condition is detected, TWI continues sending data loaded in the TWIHS_THR.
If a STOP condition or a REPEATED START + an address different from SADR is detected, SVACC is reset.