-
Notifications
You must be signed in to change notification settings - Fork 237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[rtl] use past SDA in twd FSM transition #1165
Conversation
You are right. SDA gets tested here on the falling edge of SCL which is not compliant to the spec (I think)... However, checking |
I've modified your PR so that ACK/NACK gets sampled on the rising edge of SCL, but evaluated at the falling edge of SCL (= the end of the ACK/NACK bit phase). This seems to look good - at least with my very simplem test case. Feel free to revert my changes if this does not work for your test case. Could you then please provide a minimal test case to reproduce this ACK "race condition"? |
Spec wise this would be fine "The data on the SDA line must be stable during the HIGH period of the clock." (3.1.3 UM10204 But it is not so transparent because it depends on the system clock. So your solution is cleaner and only costs one more bit on the ctrl register...
Works just fine, thanks a lot!
Unfortunately I use parts of a library I cannot share, but the tricky part was that the SDA has a transition to '1' at the very same moment the SCL falls. |
Content wise I only read two bytes, so
"I" is the I2C Host which just uses the Testbench TWD ports. |
This should be the case now.
Great to hear! Thank you for testing! |
Since the SDA has to have a valid value only during high SCL, I had the case where with the fall of SCL the SDA also changed and thus a wrong state transition happened. But the protocol should guarantee a valid input during high SCL, so this should be a valid fix?
The image shows such a transition, which would fail with the old implementation.