electronicayciencia / wpi_soft_i2c Goto Github PK
View Code? Open in Web Editor NEWSoftware emulated I2C for Raspberry Pi
Home Page: http://electronicayciencia.com/2017/02/el-bus-i2c-bajo-nivel.html
License: The Unlicense
Software emulated I2C for Raspberry Pi
Home Page: http://electronicayciencia.com/2017/02/el-bus-i2c-bajo-nivel.html
License: The Unlicense
Hi,
I am sorry if it's not the right way to bring up this issue. But I found no other option. I wanted to use multiple pins of RPi as SLC and SDA for many PCF8591 and I came across this code. I followed the instructions mentioned in the Readme. But still, it's not working properly. The problem I face is that the code goes into an infinite loop in the function 'i2c_reset(i2c_t port)' when it's calling the function 'digitalRead(port.sda)' which is always returning the value zero [line 88 in the file 'soft_i2c.c'].
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.