# I2C issues on Pico W

**URL:** <https://forum.core-electronics.com.au/t/i2c-issues-on-pico-w/17570>\
**Category:** Raspberry Pi\
**Created:** [13 July 2023 11:47 UTC](https://forum.core-electronics.com.au/t/i2c-issues-on-pico-w/17570 "2023-07-13T11:47:02Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![Peter266808](https://avatars.discourse-cdn.com/v4/letter/p/a88e57/32.png) [@Peter266808](https://forum.core-electronics.com.au/u/Peter266808)\
**Post date:** [11 August 2024 09:08 UTC](https://forum.core-electronics.com.au/t/i2c-issues-on-pico-w/17570/21 "2024-08-11T09:08:48Z")

</div>

I got the same **OSError: [Errno 5] EIO** error on a Raspberry Pi Pico W with I2C code that worked without error on a Raspberry Pi Pico. I didn’t see the fix that worked for me mentioned in this thread so I’ll add it here as an appendix to this old thread.

I found the cause was that some versions of MicroPython (machine.I2C) use different default pin allocation for SCL and SDA between the Pico and the Pico W. From [I2C broken on RPi Pico-w v1.20.0-50-g786013d46 (and previous 1.20.0) · micropython · Discussion #11429 · GitHub](https://github.com/orgs/micropython/discussions/11429:)  
_…For the RPi Pico (not W) running MicroPython v1.20.0 on 2023-04-26, the default pins seem to be_

 

_```auto
I2C Configuration: I2C(0, freq=399361, scl=5, sda=4, timeout=50000)
I2C Configuration: I2C(1, freq=399361, scl=7, sda=6, timeout=50000)_

_```_

 

_…  
For the RPi Pico-W running MicroPython v1.20.0-50-g786013d46 on 2023-05-04, the default pins are the same as the non-W Pico…_

The fix for me was to define the pins explicitly:  
`i2c = I2C(freq=400000, id=0, sda=Pin(8), scl=Pin(9))`  
With this change the same code worked on the Pico W and the Pico. I haven’t yet seen this issue affecting PiicoDev device libraries.

Peter

[Previous page](https://forum.core-electronics.com.au/t/i2c-issues-on-pico-w/17570.md?page=1)
