I2C doesn't work #10661
Unanswered
MariaA2005
asked this question in
RP2040 / Pico
I2C doesn't work
#10661
Replies: 1 comment 1 reply
-
I assume you're aware that the numbers on the Pico PCB don't correspond to GPIO numbers. Evidently the device isn't being detected. It's hard to be sure what's going on - one option might be to try SoftI2C. Another thing to try is supplementing the internal pullups with external resistors connected to 3.3V as the internal pullups are rather weak. Anything in the range 2.2KΩ to 10KΩ would be fine. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have a MPU9265 connected to the pico on the pins GPIO 8 (sda) and 9 (scl). The original code for the MPU returned Err5, so I tried to scan the devices. It returns an empty array (code follows):
`from machine import I2C, Pin
#i2c = I2C(0)
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=40000)
devices = i2c.scan()
print(devices)`
I have tried with other pins (0,1/16,17), different versions of micropython (v.14, v.19, and v1.19.1 on 2022-08-31, which is the one I am using right now), to put
time.sleep(1)
between the declaration of i2c and the next line and to declare sda and scl as `sda = Pin(16, Pin.PULL_UP)scl = Pin(17, Pin.PULL_UP)`. I have checked the connections, tried it on two different picos. The wires and breadboard work perfectly fine for another device with UART connections; however, I have tried a BMP 180, which also uses i2c, and the issue is the same.
Beta Was this translation helpful? Give feedback.
All reactions