EIO error on i2c.writeto_mem with current uPy versions on Pico #13417
Replies: 5 comments 6 replies
-
Have you added pull-up resistors on the SCL and SDA lines? If not, give this a try (with resistors somewhere between 2K and 8K ohms), as the internal pull-ups aren't very strong. |
Beta Was this translation helpful? Give feedback.
-
It happens with internal pull ups, or external 4.7K or 10K ohm pull ups (with the latter being fine for ESP32s). It consistently seems to be in lines with i2c.writeto_mem() or i2c.readfrom_mem(). I believe that in the workaround in an hmc6532 driver I used separate writes with a short delay in between which seemed to solve the problem there: |
Beta Was this translation helpful? Give feedback.
-
If you need a logic analyzer which is hosted on the same Pico as the code you are testing, I am attaching one I wrote. It uses the PIO and DMA capabilities, so it doesn't interfere with other stuff. It compresses the returned data, so all you see are transitions, and not steady state information, so it tends to return fairly small amounts of data. On a 120 MHz Pico, it can get just better than 100 ns resolution; it takes 11 cycles to detect and process a transition. Note that this is un-released code so far. I haven't edited in any license info, or anything. I will clean it up and put it on github at some point in the near future with an open-source license, so for now, use it with respect, please. It has an example of how to use it at the bottom. I will be glad to answer any questions, of course. |
Beta Was this translation helpful? Give feedback.
-
I cannot replicate your problems here with similar sensors. Hard I2C at RP2040 runs reliable.
Most probably you have checked that all before, but a re-check cannot hurt. |
Beta Was this translation helpful? Give feedback.
-
I had checked it all and the same setups have worked without issues with the same drivers on ESP32 previously. Also if it was wiring, wouldn't SoftI2C not also be impacted in most if not all cases. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Even with drivers written by several of the pro-s in this forum for e.g. BME280 or MAX44009 and various other sensors I-m having issues with EIO errors in drivers which use i2c.writeto_mem(). It seems to the more or less the same issue as was discussed in the old forum here: [RP2: Hard I2C is intolerant of clock stretching] (#8167 (comment)) already in early 2022. SoftI2C with the same drives does seem to work and on one occasion I did seem to be able to work around it by a sequence of i2c.writeto()'s. Is this a known issue and is there any solution for it, other than to fall back on SoftI2C?
Beta Was this translation helpful? Give feedback.
All reactions