GD32A50x User Manual
530
Bus idle detection
If the master detects that the high level duration of the clock and data signals is greater than
t
HIGH,MAX
, the bus can be considered idle.
This timing parameter includes the case of a master that has been dynamically added to the
bus and may not have detected a state transition on a SMBCLK or SMBDAT lines. In this
case, in order to ensure that there is no ongoing transmission, the master must wait long
enough.
The BUSTOA[11:0] bits must be programmed with the timer reload value to enable the t
IDLE
check in order to obtain the t
IDLE
parameter. To detect SCL and SDA high level timeouts, the
TOIDLE bit must be set. Then setting the TOEN bit in the I2C_TIMEOUT register to enable
the timer, after the TOEN bit is set, the BUSTOA[11:0] bit and the TOIDLE bit cannot be
changed. If the high level time of both SCL and SDA is greater than (1)*4*t
I2CCLK
,
the TIMEOUT flag will be set in the I2C_STAT register.
SMBus slave mode
The SMBus receiver must be able to NACK each command or data it receives. For ACK
control in slave mode, slave byte control mode can be enabled by setting SBCTL bit in
I2C_CTL0 register.
SMBus-specific addresses should be enabled when needed. The SMBus Device Default
address (0b1100 001) is enabled by setting the SMBDAEN bit in the I2C_CTL0 register. The
SMBus Host address (0b0001 000) is enabled by setting the SMBHAEN bit in the I2C_CTL0
register. The Alert Response Address (0b0001 100) is enabled by setting the SMBALTEN bit
in the I2C_CTL0 register.
20.3.10.
SMBus mode
SMBus Master Transmitter and Slave Receiver
The PEC in SMBus master mode can be transmitted by setting the PECTRANS bit before
setting the START bit, and the number of bytes in the BYTENUM[7:0] field must be configured.
In this case, the total number of transmissions when TI interrupt occur is BYTENUM-1. So if
BYTENUM=0x1 and PECTRANS bit is set at the same time, the contents of the I2C_PEC
register are automatically transferred. If the automatic end mode is selected (AUTOEND=1),
the SMBus master automatically sends the STOP signalafter the PEC byte. If the automatic
end mode is not selected (AUTOEND=0), the SMBus master can send a RESTART
signalafter the PEC. The I2C_PEC register content will be sent after BYTENUM-1 bytes, and
the TC flag will be set after PEC is sent, then the SCL line is stretched low. The RESTART
must be set in the TC interrupt routine.
When used as slave receiver, in order to allow PEC checking at the end of the number of
bytes transmitted, SBCTL must be set. To configure ack control for each byte, the RELOAD