Data Sheet
1030
Atmel | SMART SAM D21 [DATASHEET]
Atmel-42181G–SAM-D21_Datasheet–09/2015
 // If higher priority interrupts exist, then disable so that the 
 // following two writes are atomic.
 SERCOM - STATUS.reg = 0;
 SERCOM - CTRLB.reg = 0;
 // Re-enable interrupts if applicable.
Write CTRLB.ACKACT to 1 using the following sequence:
 // If higher priority interrupts exist, then disable so that the 
 // following two writes are atomic.
 SERCOM - STATUS.reg = 0;
 SERCOM - CTRLB.reg = SERCOM_I2CS_CTRLB_ACKACT;
 // Re-enable interrupts if applicable.
Otherwise, only write to CTRLB in the AMATCH or DRDY interrupts if it is to close 
out a transaction.
When not closing a transaction, clear the AMATCH interrupt by writing a 1 to its bit 
position instead of using CTRLB.CMD. The DRDY interrupt is automatically 
cleared by reading/writing to the DATA register in smart mode. If not in smart 
mode, DRDY should be cleared by writing a 1 to its bit position.
Code replacements examples:
Current:
 SERCOM - CTRLB.reg |= SERCOM_I2CS_CTRLB_ACKACT; 
Change to:
 // If higher priority interrupts exist, then disable so that the 
 // following two writes are atomic.
 SERCOM - STATUS.reg = 0; 
 SERCOM - CTRLB.reg = SERCOM_I2CS_CTRLB_ACKACT; 
 // Re-enable interrupts if applicable.
Current:
 SERCOM - CTRLB.reg &= ~SERCOM_I2CS_CTRLB_ACKACT; 
Change to:
 // If higher priority interrupts exist, then disable so that the 
 // following two writes are atomic.
 SERCOM - STATUS.reg = 0; 
 SERCOM - CTRLB.reg = 0; 
 // Re-enable interrupts if applicable.
Current:










