← index #18257Issue #13536
Related · high · value 1.000
QUERY · ISSUE

[RP2040] I2C read/write operations fail with EIO in v1.26.1 - works in v1.23.0

openby JuanCarlosLOETopened 2025-10-12updated 2025-10-13
bugport-rp2

Port, board and/or hardware

Port: rp2 Board: Raspberry Pi Pico (RP2040) Hardware: VL53L1X Time-of-Flight sensor connected via I2C1 (SCL=GP15, SDA=GP14)

MicroPython version

MicroPython v1.26.1 on 2025-09-11; Raspberry Pi Pico with RP2040
Type "help()" for more information.

Firmware file: RPI_PICO-20250911-v1.26.1.uf2

Issue: I2C operations fail with OSError: [Errno 5] EIO

Tested also with v1.23.0 (working version):
MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico with RP2040
Firmware file: rp2-pico-20240602-v1.23.0.uf2
Result: All I2C operations work correctly

Reproduction

Hardware setup:

VL53L1X sensor connected to Raspberry Pi Pico

- SDA to GP14 (I2C1)

- SCL to GP15 (I2C1)

- VIN to 3.3V

- GND to GND

from machine import Pin, I2C
import time

Initialize I2C

i2c = I2C(1, scl=Pin(15), sda=Pin(14), freq=100000)

print("=== Test Results ===")

Test 1: Scan (works in both versions)

devices = i2c.scan()
print(f"1. Scan: {[hex(d) for d in devices]}")

Test 2: ACK test with empty write (works in both versions)

try:
i2c.writeto(0x29, b'')
print("2. ACK test: OK")
except Exception as e:
print(f"2. ACK test: FAILED - {e}")

Test 3: Write 1 byte (FAILS in v1.26.1, works in v1.23.0)

try:
i2c.writeto(0x29, bytes([0x00]))
print("3. Write 1 byte: OK")
except Exception as e:
print(f"3. Write 1 byte: FAILED - {e}")

Test 4: Read data (FAILS in v1.26.1, works in v1.23.0)

try:
data = i2c.readfrom(0x29, 1)
print(f"4. Read 1 byte: OK - {hex(data[0])}")
except Exception as e:
print(f"4. Read 1 byte: FAILED - {e}")

Test 5: Read from memory (FAILS in v1.26.1, works in v1.23.0)

try:
data = i2c.readfrom_mem(0x29, 0xC0, 1)
print(f"5. Read from register: OK - {hex(data[0])}")
except Exception as e:
print(f"5. Read from register: FAILED - {e}")

Expected behaviour

All I2C operations should succeed as they do in v1.23.0:

=== Expected Output (v1.23.0) ===

  1. Scan: ['0x29']
  2. ACK test: OK
  3. Write 1 byte: OK
  4. Read 1 byte: OK - 0x1
  5. Read from register: OK - 0xdf

The sensor should respond to all read and write operations after being detected during scan.

Observed behaviour

With v1.26.1, any I2C operation that transfers data fails with EIO error:

=== Actual Output (v1.26.1) ===

  1. Scan: ['0x29']
  2. ACK test: OK
  3. Write 1 byte: FAILED - [Errno 5] EIO
  4. Read 1 byte: FAILED - [Errno 5] EIO
  5. Read from register: FAILED - [Errno 5] EIO

The sensor is detected during scan and responds to ACK (empty write), but any attempt to read or write actual data fails with OSError: [Errno 5] EIO.

This is a regression from v1.23.0 where all operations work correctly.

Additional Information

Testing details:

  • Issue is 100% reproducible across multiple power cycles
  • Clean firmware installation (BOOTSEL mode flash)
  • Hardware connections verified with multimeter
  • Same hardware setup works perfectly with v1.23.0
  • Sensor confirmed working: VL53L1X with Model ID 0xEA (verified in v1.23.0)

Impact:
This regression breaks I2C communication with devices requiring register read/write operations, including:

  • VL53L0X/VL53L1X Time-of-Flight sensors
  • Potentially other I2C peripherals

Workaround:
Downgrade to MicroPython v1.23.0 until the issue is fixed.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

RP2040 I2C bus breaks if pins are changed at runtime

openby desultoryopened 2024-01-27updated 2024-02-12

MicroPython v1.22.1 on 2024-01-05; Raspberry Pi Pico with RP2040

If I attempt to re-init the bus on another set of pins, things break and cannot recover until I do a full hardware reset:

>>> from machine import Pin, I2C
>>> a = I2C(1, freq=400000, scl=27, sda=26)
>>> a.readfrom_mem(118, 0xA1, 1)
b'K'
>>> a = I2C(1, freq=400000, scl=3, sda=2)
>>> a.readfrom_mem(118, 0xA1, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 5] EIO
>>> a = I2C(1, freq=400000, scl=27, sda=26)
>>> a.readfrom_mem(118, 0xA1, 1)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OSError: [Errno 5] EIO

I'm not sure how else I can recover from this other than unplugging it and plugging it back in, soft resets do not correct the issue.

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