← index #8721Issue #6232
Related · high · value 0.194
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 · ISSUE

Problem I2C on UART Grove port with Adafruit Feather STM32F405 Express

closedby david-therincourtopened 2020-07-08updated 2020-07-13
port-stm32

Hi,
Is not possible to use the second I2C with a Grove Shield FeatherWing on Feather F405 Express due reverse Grove wire : SCL -> RX and SDA -> TX

Is it possible to invert pin_B10 and pin_B11 in mpconfigboard.h for I2C busses ?

/micropython/ports/stm32/boards/ADAFRUIT_F405_EXPRESS/mpconfigboard.h

// I2C busses
#define MICROPY_HW_I2C1_NAME "I2C1"
#define MICROPY_HW_I2C1_SCL (pin_B6)  // SCL
#define MICROPY_HW_I2C1_SDA (pin_B7)  // SDA
#define MICROPY_HW_I2C2_NAME "I2C2"
#define MICROPY_HW_I2C2_SCL (pin_B10)  // TX
#define MICROPY_HW_I2C2_SDA (pin_B11)  // RX

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