← index #18257Issue #6891
Related · high · value 0.437
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

I2C writes fail sporadically with OS Error 5

closedby romillyopened 2021-02-13updated 2025-03-03
needs-info

Multiple I2C writes to an MCP23008 8-bit I/O expander on the Raspberry Pi Pico fail sporadically with OS Error 5.
Screenshot at 2021-02-13 09-58-06

The problem occurs with multiple versions of micropython on the Pico, including
rp2-pico-20210205-unstable-v1.14-8-g1f800cac3.uf2

Code at https://github.com/romilly/pico-code/blob/master/src/pico_code/pico/mcp23008.py and
https://github.com/romilly/pico-code/blob/master/src/pico_code/pico/mcp3008-demo.py

I know the i2c read code won't work, as it uses repeat=True, but it's never invoked in this test.

I am using the I2C pins supported by the Pimoroni Pico explorer base (20 and 21) with its built-in 10K pull-ups, but the same problem arises using pins 0 and 1 with 6K8 pull-ups.

I've seen this behaviour before on the bbc microbit.

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