English
Language : 

RM0365 Datasheet, PDF (782/1076 Pages) STMicroelectronics – This reference manual targets application developers
Inter-integrated circuit (I2C) interface
RM0365
Caution:
When a STOP is received and the STOPIE bit is set in the I2C_CR1 register, the STOPF
flag is set in the I2C_ISR register and an interrupt is generated. In most applications, the
SBC bit is usually programmed to ‘0’. In this case, If TXE = 0 when the slave address is
received (ADDR=1), you can choose either to send the content of the I2C_TXDR register as
the first data byte, or to flush the I2C_TXDR register by setting the TXE bit in order to
program a new data byte.
In Slave Byte Control mode (SBC=1), the number of bytes to be transmitted must be
programmed in NBYTES in the address match interrupt subroutine (ADDR=1). In this case,
the number of TXIS events during the transfer corresponds to the value programmed in
NBYTES.
When NOSTRETCH=1, the SCL clock is not stretched while the ADDR flag is set, so you
cannot flush the I2C_TXDR register content in the ADDR subroutine, in order to program
the first data byte. The first data byte to be sent must be previously programmed in the
I2C_TXDR register:
• This data can be the data written in the last TXIS event of the previous transmission
message.
• If this data byte is not the one to be sent, the I2C_TXDR register can be flushed by
setting the TXE bit in order to program a new data byte. The STOPF bit must be
cleared only after these actions, in order to guarantee that they are executed before the
first data transmission starts, following the address acknowledge.
If STOPF is still set when the first data transmission starts, an underrun error will be
generated (the OVR flag is set).
If you need a TXIS event, (Transmit Interrupt or Transmit DMA request), you must set
the TXIS bit in addition to the TXE bit, in order to generate a TXIS event.
782/1077
DocID025202 Rev 4