-
Notifications
You must be signed in to change notification settings - Fork 569
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
Documentation Mismatch in I2CMaster Regarding Output Enable Behavior in bitbang.py #2037
Comments
Yes, looking at the code the documentation doesn't match. Maybe it was this way but the core was changed to fix a specific case? |
Might be, it wouldn't make much sense to me the way it is documented, since being able to use SCL while SDA is High Impedance is a common usecase. Either way it confused me that it didnt match while writing code for it. |
Not that sda is driven open drain, so it's high impedance when sda = 1. Also note that there is now a separate ic2 core that does all this for you and provides a slightly higher level interface. See i2c.py: there is a python demonstration of this in a recent PR for me. |
Are you sure SDA will be Open drain on any FPGA? So far ive only seen Tristate output support. Also thanks for the pointer to the seperate i2c core, ive seen it in cores but i had a few problems with it(only seeing EV registers) ill check out the Demonstration incase i used it wrong. |
It implements open drain-like "emulation" with tristate gpio. The other core is memory mapped: EV registers are just for the interrupt (if used). Usage should be more obvious from that python driver, our nuttx driver isn't upstream (yet). |
Im quite new with Litex so i am a bit confused. How exactly would i integrate the I2C Core you mentioned to use it with my software? |
In the target you need to use add_slave() to connect the i2c memory mapped interface to the soc. I'll aim to post an example tomorrow. |
Something like the below will be close:
|
This is a complete example integration:
Now in csr.csv you wiil see a i2c memory region and an i2c csr for irq.
|
Thanks a lot, ill try it out whenever i find the time for it |
The issue is found in the documentation of the I2CMaster within the litex/soc/cores/bitbang.py file, at
line 44.
description="Output Enable - if 0, both the SCL and SDA output drivers are disconnected.")
,However, when I set OE to 0, it appears that only the SDA line is disconnected, while the SCL line remains connected. This doesn't match with the documentation
Suggestion:
It seems more intuitive that only the SDA line would be disconnected when OE is 0. Whatever the intetion was though the documentation should match the functionality.
If anyone would like to check it themselves id appreciate it, i doubt theres much to do wrong with setting the OE register to 0 and toggling SCL so i hope it isn't a mistake from my side
Further Information/My Code
Pin Functionality Code:
Test Code:
Result:
Only the SCL Line Toggles
The text was updated successfully, but these errors were encountered: