Skip to content
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

i2c scan immediately after an i2c scan causes Warning: I2C Bus busy or defective. Pin 9 is LOW for 5s." #2

Open
mahaju opened this issue Nov 18, 2021 · 0 comments

Comments

@mahaju
Copy link

mahaju commented Nov 18, 2021

I am using a raspberry pi pico as slave, which is running this program: https://forums.raspberrypi.com/viewtopic.php?p=1823137&sid=43326da88e7966baebc321d17160f848#p1823137

It emulates a 256 byte RAM in raspberry pi pico, each byte can be read and written. I have connected the SCL0 and SDA0 pins of raspberry pi pico to SDA/SCL (GPIO2/3, pin numbers 3 and 5 respectively) of the raspberry pi zero board. If I use the linux functions read() and write(), my setup behaves as expected (I can read and write single/multiple bytes of data in the pi pico)

I am trying out your library because I want to manipulate I2C communication bit by bit. I am using the same program in raspberry pi pico. If I call the scan.c program the first time, I get this output

I2C scan for soft_i2c project
 * Device found at 22h

which is correct. However, if I call the scan program again immediately, I get this


I2C scan for soft_i2c project
 * Device found at 22h
Warning: I2C Bus busy or defective. Pin 9 is LOW for 5s.
Warning: I2C Bus busy or defective. Pin 9 is LOW for 5s.
Warning: I2C Bus busy or defective. Pin 9 is LOW for 5s.
Warning: I2C Bus busy or defective. Pin 9 is LOW for 5s.

This warning then keeps on coming. If I force close the scan program (Ctrl+c) and then run
i2cdetect -y 1
then i2c probing is slower than usual and it does not detect the i2c device at 0x22 again. I have to reset both the pi pico board and the raspberry pi zero board to make things go back to normal.

Is there any way to deinitialize or reset the i2c bus once the scan program finishes, so that the i2c lines go back to their initial settings? My hardware setup works fine if I use linux read and write functions for i2c.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant