![GigaDevice Semiconductor GD32A50 Series Скачать руководство пользователя страница 529](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32a50-series/gd32a50-series_user-manual_2225782529.webp)
GD32A50x User Manual
529
(1)*2048*t
I2CCLK
, the TIMEOUT flag will be set in I2C_STAT register.
The BUSTOB[11:0] is used to check the t
LOW:SEXT
of the slave and the t
LOW:MEXT
of the
master. The timer can be enabled by setting the EXTOEN bit in the I2C_TIMEOUT register,
after the EXTOEN bit is set, the BUSTOB[11:0] cannot be changed. If the SCL stretching time
of the SMBus peripheral is greater than (1)*2048*t
I2CCLK
and within the timeout
interval described in the bus idle detection section, the TIMEOUT bit in the I2C_STAT register
will be set.
Packet error checking
There is a CRC-8 calculator in I2C block to perform Packet Error Checking for I2C data. A
PEC (packet error code) byte is appended at the end of each transfer. The byte is calculated
as CRC-8 checksum, calculated over the entire message including the address and read/write
bit. The polynomial used is x
8
+x
2
+x+1 (the CRC-8-ATM HEC algorithm, initialized to zero).
When I2C is disabled, the PEC can be enabled by setting the PECEN bit in I2C_CTL0
register.Since the PEC transmission is managed by BYTENUM[7:0] in I2C_CTL1 register,
SBCTL bit must be set when act as a slave. When PECTRANS is set and the RELOAD bit is
cleared, PEC is transmitted after the BYTENUM[7:0]-1 data byte. The PECTRANS has no
effect if RELOAD is set.
Table 20-4. SMBus with PEC configuration
Mode
SBCTL bit
RELOAD
bit
AUTOEND
bit
PECTRANS
bit
Master Tx/Rx B PEC+ STOP
x
0
1
1
Master Tx/Rx B PEC + RESTART
x
0
0
1
Slave Tx/Rx with PEC
1
0
x
1
SMBus alert
The SMBus has an extra optional shared interrupt signal called SMBALERT# which can be
used by slaves to tell the host to ask its slaves about events of interest. The host processes
the interrupt and accesses all SMBALERT# devices through the Alert Response Address at
the same time. If the SMBALERT# is pulled low by the devices, the devices will acknowledge
the Alert Response Address. When SMBHAEN is 0, it is configured as a slave device, the
SMBA pin will be pulled low by setting the SMBALTEN bit in the I2C_CTL0 register. Meanwhile
the Alert Response Address is enabled. When SMBHAEN is 1, it is configured as a host, and
the SMBALTEN is 1, as soon as a falling edge is detected on the SMBA pin, the SMBALT flag
will be set in the I2C_STAT register. If the ERRIE bit is set in the I2C_CTL0 register, an
interrupt will be generated. When SMBALTEN is 0, the level of ALERT line is considered high
even if the SMBA pin is low. The SMBA pin can be used as a standard GPIO if SMBALTEN
is 0.