2.9.5 Data valid (有效)time (tVD;DAT) violated (破坏)without the OVR flag being set
Description
The data valid time (tVD;DAT, tVD;ACK) described by the I²C standard can be violated (as well
as the maximum data hold time of the current data (tHD;DAT)) under the conditions described
below. This violation cannot be detected because the OVR flag is not set (no transmit buffer
underrun is detected).
This issue can occur only under the following conditions:
● in Slave transmit mode
● with clock stretching disabled (NOSTRETCH=1)
● if the software is late to write the DR data register, but not late enough to set the OVR
flag (the data register is written before)
Workaround
If the master device allows it, use the clock stretching mechanism by programming the bit
NOSTRETCH=0 in the I2C_CR1 register.
If the master device does not allow it, ensure that the software is fast enough when polling
the TXE or ADDR flag to immediately write to the DR data register. For instance, use an
interrupt on the TXE or ADDR flag and boost its priority to the higher level
摘自 STM32F101xC/D/E and STM32F103xC/D/E Errata sheet Doc ID 14732 Rev 7
理解:如果OVR(从机没有足够时间读取主机发来的数据,该位 错误标志发生)没有发生,将破坏数据的有效性,解决办法是 如果工作机允许的话将NOSTRETCH位设置,不然就采用中断等方法加速数据的读取 |