
RM0008
Inter-integrated circuit (I
2
C) interface
Doc ID 13902 Rev 12
743/1096
Timeout error
There are differences in the timing specifications between I
2
C and SMBus.
SMBus defines a clock low timeout, TIMEOUT of 35 ms. Also SMBus specifies TLOW:
SEXT as the cumulative clock low extend time for a slave device. SMBus specifies TLOW:
MEXT as the cumulative clock low extend time for a master device. For more details on
these timeouts, refer to SMBus specification ver. 2.0 (
http://smbus.org/specs/
).
The status flag Timeout or Tlow Error in I2C_SR1 shows the status of this feature.
How to use the interface in SMBus mode
To switch from I
2
C mode to SMBus mode, the following sequence should be performed.
●
Set the SMBus bit in the I2C_CR1 register
●
Configure the SMBTYPE and ENARP bits in the I2C_CR1 register as required for the
application
If you want to configure the device as a master, follow the Start condition generation
procedure in
Section 26.3.3: I2C master mode
. Otherwise, follow the sequence in
Section 26.3.2: I2C slave mode
The application has to control the various SMBus protocols by software.
●
SMB Device Default Address acknowledged if ENARP=1 and SMBTYPE=0
●
SMB Host Header acknowledged if ENARP=1 and SMBTYPE=1
●
SMB Alert Response Address acknowledged if SMBALERT=1
26.3.7 DMA
requests
DMA requests (when enabled) are generated only for data transfer. DMA requests are
generated by Data Register becoming empty in transmission and Data Register becoming
full in reception. The DMA request must be served before the end of the current byte
transfer. When the number of data transfers which has been programmed for the
corresponding DMA channel is reached, the DMA controller sends an End of Transfer EOT
signal to the I
2
C interface and generates a Transfer Complete interrupt if enabled:
●
Master transmitter: In the interrupt routine after the EOT interrupt, disable DMA
requests then wait for a BTF event before programming the Stop condition.
●
Master receiver: when the number of bytes to be received is equal to or greater than
two, the DMA controller sends a hardware signal, EOT_1, corresponding to the last but
one data byte (number_of_bytes – 1). If, in the I2C_CR2 register, the LAST bit is set,
I
2
C automatically sends a NACK after the next byte following EOT_1. The user can
generate a Stop condition in the DMA Transfer Complete interrupt routine if enabled.
Transmission using DMA
DMA mode can be enabled for transmission by setting the DMAEN bit in the I2C_CR2
register. Data will be loaded from a Memory area configured using the DMA peripheral (refer
to the DMA specification) to the I2C_DR register whenever the TxE bit is set. To map a DMA
channel for I
2
C transmission, perform the following sequence. Here x is the channel number.