
M0A21/M0A23 Series
May 06, 2022
Page
574
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
FUNMODE (UI2C_CTL [2:0]) = 000B. The I
2
C control flow has to be done while FUNMODE (UI2C_CTL
[2:0]) = 000B to avoid unintended edges of the input signals and the I
2
C mode can be enabled by
FUNMODE (UI2C_CTL [2:0]) = 100B afterwards.
Step 1. Set FUNMODE (UI2C_CTL [2:0]) = 000B
Step 2. Set FUNMODE (UI2C_CTL [2:0]) = 100B
Pin Connections
The pins used for SDA and SCL have to be set to open-drain mode by USCI controller to support the
wired-AND structure of the I
2
C bus lines.
Note:
The step to enable the alternate output port functions should only be done after the I
2
C mode is
enabled, to avoided unintended spikes on the output.
Bit Timing Configuration
In standard mode (100 kBit/s) a minimum module frequency of 2 MHz is necessary, whereas in fast
mode (400 kBit/s) a minimum of 10 MHz is required. Additionally, if the digital filter stage should be used
to eliminate spikes up to 50 ns, a filter frequency of 20 MHz is necessary. There could be an uncertainty
in the SCL high phase timing of maximum 1/
f
PROT_CLK
if another I
2
C participant lengthens the SCL low
phase on the bus. Note that the SCL maximum frequency is f
SAMP_CLK
/2 and the SPCLKSEL
(UI2C_BRGEN [3:2]) must be set to 0 for selecting
f
SAMP_CLK
=
f
DIV_CLK
.
Data Format Configuration
The data format has to be configured for 8 data bits (DWIDTH (UI2C_LINECTL [11:8]) = 8), and MSB
shifted first (LSB (UI2C_LINECTL [0]) = 0). As a result, UI2C_LINECTL has to be set to 0x800.
Control Flow
The on-chip I
2
C ports support three operation modes, Master, Slave, and General Call Mode.
In a given application, I
2
C port may operate as a master or as a slave. In Slave mode, the I
2
C port
hardware looks for its own slave address and the general call address. If one of these addresses is
detected, and if the slave is willing to receive or transmit data from/to master(by setting the
AA(UI2C_PROTCTL[1]) bit), acknowledge pulse will be transmitted out on the 9th clock, hence an
interrupt is requested on both master and slave devices if interrupt is enabled. When the microcontroller
wishes to become the bus master, hardware waits until the bus is free before entering Master mode so
that a possible slave action is not be interrupted. If address arbitration is lost in Master mode, I
2
C port
switches to Slave mode immediately and can detect its own slave address in the same serial transfer.
To control the I
2
C bus transfer in each mode, user needs to set UI2C_PROTCTL, UI2C_PROTIEN,
TXDAT registers according to current status of UI2C_PROTSTS register. In other words, for each I
2
C
bus action, user needs to check current status by UI2C_PROTSTS register, and then set
UI2C_PROTCTL, UI2C_PROTIEN, TXDAT registers to take bus action. Finally, check the response
status by UI2C_PROTSTS.
The bits, STA, STO and AA in UI2C_PROTCTL register are used to control the next state of the I
2
C
hardware after interrupt signal is cleared. Upon completion of the new action, a new status will be
updated in UI2C_PROTSTS register will be set. If the I
2
C interrupt control bit of UI2C_PROTIEN is set,
appropriate action or software branch of the new status can be performed in the Interrupt service routine.
Figure 6.15-8 shows the current I
2
C STARIF (UI2C_PROTSTS [8]) is set to 1 by hardware, and then set
TXDAT = SLA+W (Slave a Write bit), (PTRG, STA, STO, AA) = (1, 0, 0, x) to send the address
to I
2
C bus, and write 1 to STARIF (UI2C_PROTSTS [8]) to clear flag. If a slave on the bus matches the
address and response ACK, the UI2C_PROTSTS will be updated by ACKIF (UI2C_PROTSTS [13])
setting.