GD32VF103 User Manual
370
used by slaves to tell the host to ask its slaves about events of interest. SMBus also defines
a less common "Host Notify Protocol", providing similar notifications but passing more data
and building on the I2C multi-master mode.
SMBus programming flow
The programming flow for SMBus is similar to normal I2C. In order to use SMBus mode, the
application should configure several SMBus specific registers, response to some SMBus
specific flags and implement the upper protocols described in SMBus specification.
1.
Before communication, SMBEN bit in I2C_CTL0 should be set and SMBSEL and ARPEN
bits should be configured to desired value.
2.
In order to support address resolution protocol (ARP) (ARPEN=1), the software should
response to HSTSMB flag in SMBus Host Mode (SMBSEL =1) or DEFSMB flag in
SMBus Device Mode, and implement the function of ARP protocol.
3.
In order to support SMBus Alert Mode, the software should response to SMBALT flag
and implement the related function.
17.3.12.
Status, errors and interrupts
There are several status and error flags in I2C, and interrupt may be asserted from these
flags by setting some register bits (refer to I2C register for detail).
Table17-2. Event status flags
Event Flag Name
Description
SBSEND
START condition sent (master)
ADDSEND
Address sent or received
ADD10SEND
Header of 10-bit address sent
STPDET
STOP condition detected
BTC
Byte transmission completed
TBE
I2C_DATA is empty when transmitting
RBNE
I2C_DATA is not empty when receiving
Table17-3. I2C error flags
I2C Error Name
Description
BERR
Bus error
LOSTARB
Arbitration lost
OUERR
Over-run or under-run when SCL stretch is disabled.
AERR
No acknowledge received
PECERR
CRC value doesn’t match
SMBTO
Bus timeout in SMBus mode
SMBALT
SMBus Alert