
Rev. 1.00
405 of 486
July 31, 2018
32-Bit Arm
®
Cortex
®
-M0+ MCU
HT32F50231/HT32F50241
19 Inter-Integrated Circuit (I2C)
I
2
C Timeout Function
In order to reduce the occurrence of I
2
C lockup problem due to the reception of erroneous clock
source, a timeout function is provided. If the I
2
C bus clock source is not received for a certain
timeout period, then a corresponding I
2
C timeout flag will be asserted. This timeout period is
determined by a 16-bit down-counting counter with a programmable preload value. The timeout
counter is driven by the I
2
C timeout clock, f
I2CTO
, which is specified by the timeout prescaler field
in the I2CTOUT register. The TOUT field in the I2CTOUT register is used to define the timeout
counter preload value. The timeout function is enabled by setting the ENTOUT bit in the I2CCR
register. The timeout counter will start to count down from the preloaded value if the ENTOUT bit
is set to 1 and one of the following conditions occurs:
▄
The I
2
C master module sends a START signal.
▄
The I
2
C slave module detects a START signal.
▄
The RXBF, TXDE, RXDNE, RXNACK, GCS or ADRS flags is asserted.
The timeout counter will stop counting when the ENTOUT bit is cleared. However, the counter
will also stop counting when one of the conditions, listed as follows, occurs:
▄
The I
2
C slave module is not addressed.
▄
The I
2
C slave module detects a STOP signal.
▄
The I
2
C master module sends a STOP signal.
▄
The ARBLOS or BUSERR flag in the I2CSR register are asserted.
If the timeout counter underflows, the corresponding timeout flag, TOUTF, in the I2CSR register
will be set to 1 and a timeout interrupt will be generated if the relevant interrupt is enabled.
Register Map
The following table shows the I
2
C registers and reset values.
Table 44. I
2
C Register Map
Register
Offset
Description
Reset Value
I2CCR
0x000
I
2
C Control Register
0x0000_2000
I2CIER
0x004
I
2
C Interrupt Enable Register
0x0000_0000
I2CADDR
0x008
I
2
C Address Register
0x0000_0000
I2CSR
0x00C
I
2
C Status Register
0x0000_0000
I2CSHPGR
0x010
I
2
C SCL High Period Generation Register
0x0000_0000
I2CSLPGR
0x014
I
2
C SCL Low Period Generation Register
0x0000_0000
I2CDR
0x018
I
2
C Data Register
0x0000_0000
I2CTAR
0x01C
I
2
C Target Register
0x0000_0000
I2CADDMR
0x020
I
2
C Address Mask Register
0x0000_0000
I2CADDSR
0x024
I
2
C Address Snoop Register
0x0000_0000
I2CTOUT
0x028
I
2
C Timeout Register
0x0000_0000