Datasheet

Enable-protection is denoted by the "Enable-Protection" property in the register description.
Before the I
2
C is enabled it must be configured as outlined by the following steps:
1. Select I
2
C Master or Slave mode by writing 0x4 (Slave mode) or 0x5 (Master mode) to the
Operating Mode bits in the CTRLA register (CTRLA.MODE).
2. If desired, select the SDA Hold Time value in the CTRLA register (CTRLA.SDAHOLD).
3. If desired, enable smart operation by setting the Smart Mode Enable bit in the CTRLB register
(CTRLB.SMEN).
4. If desired, enable SCL low time-out by setting the SCL Low Time-Out bit in the Control A register
(CTRLA.LOWTOUT).
5. In Master mode:
5.1. Select the inactive bus time-out in the Inactive Time-Out bit group in the CTRLA register
(CTRLA.INACTOUT).
5.2. Write the Baud Rate register (BAUD) to generate the desired baud rate.
In Slave mode:
5.1. Configure the address match configuration by writing the Address Mode value in the
CTRLB register (CTRLB.AMODE).
5.2. Set the Address and Address Mask value in the Address register (ADDR.ADDR and
ADDR.ADDRMASK) according to the address configuration.
28.6.2.2 Enabling, Disabling, and Resetting
This peripheral is enabled by writing '1' to the Enable bit in the Control A register (CTRLA.ENABLE), and
disabled by writing '0' to it.
Writing ‘1’ to the Software Reset bit in the Control A register (CTRLA.SWRST) will reset all registers of
this peripheral to their initial states, except the DBGCTRL register, and the peripheral is disabled.
28.6.2.3 I
2
C Bus State Logic
The bus state logic includes several logic blocks that continuously monitor the activity on the I
2
C bus lines
in all sleep modes with running GCLK_SERCOM_x clocks. The start and stop detectors and the bit
counter are all essential in the process of determining the current bus state. The bus state is determined
according to Bus State Diagram. Software can get the current bus state by reading the Master Bus State
bits in the Status register (STATUS.BUSSTATE). The value of STATUS.BUSSTATE in the figure is shown
in binary.
SAM D21 Family
SERCOM I2C – Inter-Integrated Circuit
© 2018 Microchip Technology Inc.
Datasheet Complete
DS40001882D-page 553