← index #8721PR #12978
Off-topic · high · value 0.632
QUERY · ISSUE

Wrong SCL / SDA (MICROPY_HW_I2C0_SCL) for PIMORONI_TINY2040

openby charrochopened 2022-06-01updated 2026-03-19
bugport-rp2

I am trying to get I2C working on my Tiny2040 board. Using the board as a responder in a responder/controller manner. I have some minimal code to set up the board using pin four as SDA and pin five as SCL as described in the GPIO diagrams below:

https://shop.pimoroni.com/products/tiny-2040

I am using https://github.com/epmoyer/I2CResponder/blob/main/i2c_responder.py with a minimal setup code that looks like the following on bus 0:

i2c_responder = I2CResponder(0, sda_gpio=0,scl_gpio=1,responder_address=0x41)
while 1:
    if i2c_responder.read_is_pending():
        i2c_responder.put_read_data(0x2)

And for testing, I tried on bus 1 as well against pin 6 and 7:

i2c_responder = I2CResponder(1, sda_gpio=6,scl_gpio=7,responder_address=0x41)
while 1:
    if i2c_responder.read_is_pending():
        i2c_responder.put_read_data(0x2)

I am using an RPI as a controller executing: sudo i2cdetect -y 1

Now the strange thing is:

  1. I get 0 response on bus 0 (i2cdetect detects no device)
  2. I get a signal on bus one and appear on my RPI (i2cdetect detects the device and I can query the value)

I was perusing the code and saw this:
https://github.com/micropython/micropython/blob/master/ports/rp2/boards/PIMORONI_TINY2040/mpconfigboard.h

#define MICROPY_HW_I2C0_SCL  (4)
#define MICROPY_HW_I2C0_SDA  (5)

Should it not be:

#define MICROPY_HW_I2C0_SCL  **(5)**
#define MICROPY_HW_I2C0_SDA  **(4)**

I tried to recompile the above with the mentioned change without much effect. Any thoughts?

CANDIDATE · PULL REQUEST

renesas-ra/boards/ARDUINO_PORTENTA_C33: Fix incorrect I2C pins.

mergedby sebromeroopened 2023-11-15updated 2023-11-17
port-renesas-ra

This PR fixes the incorrect assignment of the SCL and SDA pins on the Arduino Portenta C33.
image

Took the opportunity to also change the number of the interface to 0 as it's connected to IIC0

@iabdalkader helped me to test it. Seems to work:

>>> print(I2C(0))
I2C(0, freq=400000, scl=P408, sda=P407)

Als a bus scan is successful:

from machine import I2C
for addr in I2C(0).scan():
        print("🙌 Found device at address 0x%x" %(addr))

prints 🙌 Found device at address 0x21

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied