
NUC126
Aug. 08, 2018
Page
833
of 943
Rev 1.03
NUC12
6 S
E
RI
E
S
T
E
CH
NI
CA
L R
E
F
E
RE
NCE
MA
NUA
L
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.22-19 I
2
C Time-out Count Block Diagram
Wake-up Function
When chip enters Power-down mode and set WKEN (WKCTL[0]) to 1, other I
2
C master can wake-up
our chip by addressing our 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 the 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 wakeup 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. The
controller will stretch the SCL to low when the address is matched the device’s slave address and the
ACK cycle done. The SCL is stretched until the 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 wakeup procedure. Note that user must
clear WKIF 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 = 0) or to wait the incoming data (WRSTSWK = 1) 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, WKIF is set to indicate this event. User needs
write “1” to clear this bit.
I
2
C also support data toggle mode. When system is in power-down and the WKEN (UI2C_WKCTL [0])
set to 1 and WKADDREN (UI2C_WKCTL[1]) set to 0, the toggle of incoming data pin can wake-up the
system.
Example for Random Read on EEPROM
The following steps are used to configure the USCI0_I
2
C related registers when using I
2
C protocol to
read data from EEPROM.
1. Set USCI0_I
2
C the multi-function pin in the SYS_GPB_MFPL or SYS_GPBMFPH or
SYS_GPC_MFPL or SYS_GPE_MFPL registers as SCL and SDA pins.
2. Enable USCI0 APB clock, USCI0CKEN
=1 in the “CLK_APBCLK[8]” register.
3. Set USCI0RST=1 to reset USCI controller then set USCI0RST=0 let USCI controller to normal
operation, in the “SYS_IPRST2[8]” register.
4. Set FUNMODE =100b to enable USCI0_I
2
C controller in the “UI2C_CTL” register.
5. Give USCI0_I
2
C clock a divided register value for USCI0_I
2
C clock rate in the “UI2C_BRGEN”.
6. Set SETENA =0x00400000
in the “NVIC_ISR” register to set USCI_IRQ.