Table 34-2. Module Request for SERCOM I
2
C Master
Condition
Request
DMA
Interrupt
Event
Data needed for transmit
(TX) (Master transmit
mode)
Yes
(request cleared when
data is written)
NA
Data needed for transmit
(RX) (Master transmit
mode)
Yes
(request cleared when
data is read)
Master on Bus (MB)
Yes
Stop received (SB)
Yes
Error (ERROR)
Yes
34.6.4.1. DMA Operation
Smart mode must be enabled for DMA operation in the Control B register by writing CTRLB.SMEN=1.
Slave DMA
When using the I
2
C slave with DMA, an address match will cause the address interrupt flag
(INTFLAG.ADDRMATCH) to be raised. After the interrupt has been serviced, data transfer will be
performed through DMA.
The I
2
C slave generates the following requests:
•
Write data received (RX): The request is set when master write data is received. The request is
cleared when DATA is read.
•
Read data needed for transmit (TX): The request is set when data is needed for a master read
operation. The request is cleared when DATA is written.
Master DMA
When using the I
2
C master with DMA, the ADDR register must be written with the desired address
(ADDR.ADDR), transaction length (ADDR.LEN), and transaction length enable (ADDR.LENEN). When
ADDR.LENEN is written to 1 along with ADDR.ADDR, ADDR.LEN determines the number of data bytes
in the transaction from 0 to 255. DMA is then used to transfer ADDR.LEN bytes followed by an
automatically generated NACK (for master reads) and a STOP.
If a NACK is received by the slave for a master write transaction before ADDR.LEN bytes, a STOP will be
automatically generated and the length error (STATUS.LENERR) will be raised along with the
INTFLAG.ERROR interrupt.
The I
2
C master generates the following requests:
•
Read data received (RX): The request is set when master read data is received. The request is
cleared when DATA is read.
•
Write data needed for transmit (TX): The request is set when data is needed for a master write
operation. The request is cleared when DATA is written.
34.6.4.2. Interrupts
The I
2
C slave has the following interrupt sources. These are asynchronous interrupts. They can wake-up
the device from any sleep mode:
•
Error (ERROR)
Atmel SAM L22G / L22J / L22N [DATASHEET]
Atmel-42402E-SAM L22G / L22J / L22N_Datasheet_Complete-07/2016
697