-
-
Notifications
You must be signed in to change notification settings - Fork 206
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Raspberry Pi Pico (RP2040) - I2C holds SCL low #448
Comments
Hi. I am having the same trouble. My platform is Mr.Earle Philhower version and I am using XIAO PR2040. Both SDA and SCL are pulled up at 4.7K. The moment master send something, SCL is low. And it freezes without giving any information, so there is no clue to the solution. |
In the past, I've use ATmega328p devices and had problems with the I2C bus getting stuck randomly. However, at some point the Wire library added a setWireTimeout() method, where it will not get stuck in an I2C transaction any more. https://www.arduino.cc/reference/en/language/functions/communication/wire/setwiretimeout/ This isn't perfect because if one of the I2C peripherals gets stuck, you need to power cycle those peripherals to do a full bus recovery. But I found the setWireTImeout() method very useful in ensuring the software doesn't get stuck and you can then do something about it. However, the RP2040 mbed implementation does not support setWireTimeout yet, and this would be helpful to have. It is an optional Wire feature (see URL above). I've only just started working with RP2040 and noticed this missing when I tried to port my code from ATmega328p. |
Hello @waynepiekarski - how about your porting setWireTimeout() into RP2040. I'm also very interested in that function - it is very useful for handling problems over I2C communication. |
I didn't do any implementation work for setWireTimeout(). It looks like the underlying mbed library used on the RP2040 doesn't support timeouts either last time I checked. |
Hey, I opened an isssue with arduino-esp32 thinking that it was a problem over there. After some debugging it seems like it is a problem with ArduinoCore-mbed. Any chance this could be looked into? |
Hi everybody,
i am currently trying to implement an I2C connection between an ESP32-WROVER and a Raspberry Pi Pico (RP2040). The ESP is configured as master and shall request data from the Pico which is configured as slave. Besides requesting data the master also sends data to the slave.
After encountering some issues that the I2C communication is not working properly i created a minimal example for master and slave where the problem still occurs. Regularly the I2C times out (diagnosed by ESP via Debug messages and Logic analyzer - see below) and no data can be transmitted anymore. Pullups of SDA/SCL should be fine with 3K3.
First the program-code of the slave, then some measures&measurements i already took/did and in the end the despaired beg for help finding the problem which i assume in the I2C implementation.
Slave (Pico) Code:
What did i try already?
Measurements & Logs
ESP Debug message incl. some serial output i had on master side:
The I2C can only be reset correctly after first restarting the Pico and then the ESP32.
I also checked the bus with a Logic analyzer:
![Annotation 2022-04-07 171810](https://user-images.githubusercontent.com/1504481/162236299-2b4834ca-b2f4-4187-b533-8efcab209ebe.png)
![Annotation 2022-04-07 172026](https://user-images.githubusercontent.com/1504481/162236055-5913446b-bc3d-41a4-996a-fd608c8ec4b8.png)
Blue: SDA / Red: SCL
As promised here: Please help me :) - for me it looks like the I2C implementation has some issue with the I2C drivers of the Pico.
The text was updated successfully, but these errors were encountered: