
M0A21/M0A23 Series
May 06, 2022
Page
585
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
STORIF, STARIF). User may write 1 to clear TOIF(UI2C_PROTSTS[5]) to 0. When time-out counter is
enabled, writing 1 to the TOIF will reset counter and re-start up counting after TOIF is cleared. Refer to
Figure 6.15-22 for the time-out counter TOCNT (UI2C_PROTCTL [25:16]). T
TOCNT
= (TOCNT
(UI2C_PROTCTL [25:16]) +1) x32 (5-bit) x T
PCLK
. Note that the time counter clock source TMCNTSRC
(UI2C_ BRGEN [5]) must be set as 0.
Internal counter
TOIF
Clear Counter
TOIEN
Interrupt
signal
Enable
f
SAMP_CLK
Writing TOIF 1
TOCNT
I
2
C interrupt signal
(ACKIF, NACKIF, ...)
Figure 6.15-22 I
2
C Time-out Count Block Diagram
Wake-up Function
When chip enters Power-down mode and set WKEN (UI2C_WKCTL[0]) to 1, other I
2
C master can wake
up the chip by addressing the I
2
C device, user must configure the related setting before entering sleep
mode. The ACK bit cycle of address match frame is done in power-down. The controller will stretch the
SCL to low when the address is matched the device’s address and the ACK cycle done. The SCL is
stretched until WKAKDONE bit is clear by user. If the frequency of SCL is low speed and the system
has wakeup from address match frame, the user shall check this bit to confirm this frame has transaction
done and then to do the wake-up procedure. Therefore, when the chip is woken up by address match
with one of the device address register (UI2C_DEVADDRn), the user shall check the WKAKDONE
(UI2C_PROTSTS [16]) bit is set to 1 to confirm the address wakeup frame has done. The WKAKDONE
bit indicates that the ACK bit cycle of address match frame is done in power-down. Remind user must
clear WKF after clearing the WKAKDONE bit to 0.
The WRSTSWK (UI2C_PROTSTS [17]) bit records the Read/Write command on the address match
wake-
up frame. The user can use read this bit’s status to prepare the next transmitted data (WRSTSWK
= 1) or to wait the incoming data (WRSTSWK = 0) can be stored in time after the system is wake-up by
the address match frame.
When system is woken up by other I
2
C master device, WKF (UI2C_WKSTS [0]) is set to indicate this
event. User needs write “1” to clear this bit.
Example for Random Read on EEPROM
The following steps are used to configure the USCI0_I2C related registers when using I
2
C protocol to
read data from EEPROM.
1. Set USCI0_I2C the multi-function pin as SCL and SDA pins. The multi-function configuration
reference Basic Configuration.
2. Enable USCI0 APB clock. Enable clock configuration reference Basic Configuration.
3. Set USCI0RST=1 to reset USCI controller then set USCI0RST=0 let USCI controller to normal
operation. The reset controller configuration reference Basic Configuration.
4. Set FUNMODE =100 to enable USCI0_I2
C controller in the “UI2C_CTL” register.
5. Give USCI0_I2C clock a divided register value for USCI0_I2C clock rate in the
“UI2C_BRGEN”.
6. Enable system USCI0 IRQ in system
“NVIC” control register.
7. Set ACKIEN, ERRIEN, ARBLOIEN, NACKIEN, STORIEN, STARIEN, and TOIEN to enable