docs: I2C default pins 4,5 not 8,9 for the RP2 port
Documentation URL
https://github.com/micropython/micropython/blob/6fee099cae58644ea49ca0f470e9cb00a7da8f29/docs/rp2/quickref.rst?plain=1#L339
Description
In the quickref for RP2 (Raspberry Pi Pico family) it has a line of code under Hardware I2C bus:
i2c = I2C(0) # default assignment: scl=Pin(9), sda=Pin(8)
Unless I'm missing something I'm pretty sure this should be:
i2c = I2C(0) # default assignment: scl=Pin(5), sda=Pin(4)
That would agree with the board pinout diagram -- see the dark blue areas. It also agrees with an actual device that I just wired up. I haven't found this association anywhere else yet. It might be in the RP2350 datasheet but I got lost in there.
Caution about pin number confusion. The id numbers passed to the machine.Pin constructor are NOT chip pin numbers or board pin numbers. They refer to GPIOnn aka GPnn signal names. So Pin(5),Pin(4) refer to GPIO5,GPIO4 aka GP5,GP4.
Code of Conduct
Yes, I agree
RP2: Hard I2C not working
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues matching this bug, and didn't find any.
Port, board and/or hardware
rp2
MicroPython version
MicroPython v1.22.2
Reproduction
from machine import Pin, I2C
from ssd1306 import SSD1306_I2C
bus = I2C(id = 0, scl = Pin(9), sda = Pin(8), freq = 100_000)
display = SSD1306_I2C(128, 64, bus)
Expected behaviour
ssd1306 working
Observed behaviour
Failure with errors EIO / ETIMEDOUT.
Tested with id 0 and 1, on different pins.
Works like a charm using SoftI2C.
Additional Information
Could be related to this ticket ?
RP2: Hard I2C is intolerant of clock stretching
https://github.com/micropython/micropython/issues/8167