I2C SDA/SCL race #83
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
The current I2C code switches SDA and SCL almost at the same time, which can create false start/stop conditions.
Quick fix (not well thought through):
The bug was inherited from the main ARTIQ repos and is also present there, but only became symptomatic on Kasli-SoC.
So there is this issue where, after NACK (i.e. SDA does NOT get pulled down by the receiver), SCL might not go low before a transition happens on SDA, meaning a "repeated" START could be triggered, is that correct?
In addition to your suggestion, we can also loop to read from SCL before the transmtter pull down SDA, and that should consume less than half an SCL period.
Yes, I also just noticed that SCL might not be held low long enough before the next bit is shifted in/out on the SDA line. If my understanding is right, the I2C spec requires that no transition shall take place when SCL is not pulled LOW.
See the patch, there are at least 3 potential places where SCL/SDA races could happen.
Correct, unless you are doing START or STOP, you can only toggle SDA while SCL is low (and there should be some time margins).