Replies: 3 comments 3 replies
-
It certainly looks like a bug, perhaps in the ESP-IDF? It might be instructive to repeat the failing test but with a SoftI2C. |
Beta Was this translation helpful? Give feedback.
-
If you create an UART like that:
it will first be set up using the default pins, and then the pins are re-configured with ser.init(). To avoid that, just use
|
Beta Was this translation helpful? Give feedback.
-
Yes, that did work. Thank you. It would be nice if the UART documentation could have a caveat added about using <init()> separately. IIRC, that always seemed to work ok with the pyboard. It took me many frustrating hours to track down that the I2C bus was smashed by something totally unrelated to I2C. |
Beta Was this translation helpful? Give feedback.
-
It took me days to track down (and find a workaround) for what looks like a bug, but maybe it's a known issue or something to do with the underlying Espressif framework. The workaround is that I have to create an I2C (hardware bus) AFTER creating TWO serial (UART) objects. If I do the reverse, the I2C object is apparently smashed if and when a second serial object is created. Here is a sample REPL session (done with rshell), with comments inserted:
'''py
MicroPython v1.22.2 on 2024-02-22; Generic ESP32S3 module with ESP32S3
Type "help()" for more information.
create serial object 1:
create I2C object:
scan for devices, looks good:
the device at address 81 is an external RTC (a PCF2127). Read the RTC value:
write it to the first serial bus:
create a second serial object:
write to it:
Now try reading the RTC again:
Did not work, presumably the I2C object was smashed.
Create a new I2C object and read the RTC again:
Looks good. The result can be written to both serial buses:
This can now be repeated forever. Apparently everything is now ok, now that the (new) I2C object was created after the serial ones.
Here are the serial object parameters:
'''
Creating only the first serial bus was ok, but creating the second one smashed the I2C bus.
I then reversed the order of the object creation. Both serial objects first, then the I2C one. That worked fine from the get go. I have not shown that (successful) REPL session here.
The target is an Espressif ESP32-S3-DevKitC-01. The firmware is the latest, upgraded today.
Is this a bug? Or is there something about creating these objects that I don't know?
Beta Was this translation helpful? Give feedback.
All reactions