Open ind03 opened 1 year ago
Can you be more specific ? What is your device and what are the conditions when it does not work ?
I2C specs does not specify any delay between sda change following scl low: << The SDA signal can only change when the SCL signal is low – when the clock is high the data should be stable. >>
edit and capacitance <= 400pF
I think ind03 is talking about tLOW (LOW period of the SCL), minimum 4.7usec. See UM10204 Table.10 for datails. After if-else should be SU;DAT (data set-up time), minimun 250nsec.
figure38 does not show minimum timing requirement between scl-low and sda. I understand that higher capacitance makes scl going low slower. I am not against trying to do something to make every setup working, but changes in this driver can break its stability very easily.
We could make Twi
a template class, allowing another instantiation with different values.
Or we could add more options to the arduino IDE menu / global defines to change defaults (easier / faster to do).
Basic Infos
Platform
Settings in IDE
Problem Description
There is no delay between SCL going Low and SDA change in core_esp8266_si2c.cpp line 311. The result is a transition in only 125ns which may result in wrong data read or START/STOP conditions. It happens often with slow devices and long lines with high capacitance. To fix it, we only need an additional busywait (twi_dcount); after setting SCL low.
but should be