Replies: 2 comments 1 reply
|
The evidence points the way you suspected, and there is a detail in the port default that makes the case stronger.
#ifndef MICROPY_PY_MACHINE_I2S
#define MICROPY_PY_MACHINE_I2S (SOC_I2S_SUPPORTED)
So the port already asks the chip whether it has I2S, and a board only needs an override to contradict that answer. Since you have I2S working on real C5 hardware with nothing but the flag flipped, The C6 comparison supports it too: Worth adding to your report, since you would otherwise fix half the problem: the C5 override is not only in the generic board. Searching the esp32 boards for a forced zero turns up three files:
The C2 entry is a different case and I would leave it out of the request. If the C2 genuinely lacks I2S then |
|
Thanks - that is a better way to frame it, and it turns up something I had missed. The port default. I had not looked at That does sharpen the argument. The port already derives the setting from the SoC capability macro, so a board file only needs an entry in order to contradict it. Since the C5 runs I2S with nothing changed but that flag, The C6 precedent. Also confirmed: The second C5 board. Good catch, and you are right that I would otherwise have fixed half of it. I do not have XIAO C5 hardware, so I cannot test that board myself. But it is the same silicon, and Amended request. Remove the
Leaving I am happy to open the pull request with that change, and I can retest on ESP32-C5-WROOM-1 hardware against whatever revision the maintainers prefer. |
Uh oh!
There was an error while loading. Please reload this page.
Summary
machine.I2Sis not available in the officialESP32_GENERIC_C5firmware, because it is explicitly disabled in the board configuration. Rebuilding with that single flag enabled produces a working I2S on real hardware, with no other source changes. This looks like the same situation that was reported for the ESP32-C6 in discussion #17151 and later fixed by PR #17644.I would like to ask the maintainers whether the flag was disabled for a known reason, or whether it is simply a conservative default from the initial C5 bring-up that has not been revisited.
Environment
ESP32_GENERIC_C5-20260406-v1.28.0.binfrom micropython.orgThe problem
With the official build:
Importing it fails at module level:
One detail worth recording, because it is misleading: the traceback points at
machine.py, which suggests a stub file shadowing the built-in module. It is not - it is a frozen Python wrapper (sys.pathcontains.frozen, andmachineappears twice inhelp('modules')). Querying the underlying C module directly gives the same answer, so nothing is being hidden:The cause
ports/esp32/boards/ESP32_GENERIC_C5/mpconfigboard.h, line 6:Two observations:
(SOC_I2S_SUPPORTED).For reference,
ports/esp32/machine_i2s.cuses the moderndriver/i2s_std.hAPI (i2s_chan_handle_t,i2s_channel_init_std_mode,i2s_channel_write) and contains no chip-specific conditionals; it relies onSOC_I2S_NUM, which ESP-IDF defines for the C5. The ESP32-C5 does have an I2S controller (datasheet section 5.2.1.4) and ESP-IDF supports it.What I tested
Built MicroPython v1.28.0 with ESP-IDF v5.5.1 for
ESP32_GENERIC_C5, changing exactly one character:No other source modification was needed. Results:
machine_i2s.ccompiles for the C5 without errors or warnings that required attention.hasattr(machine, 'I2S')isTrue.Question
Was
MICROPY_PY_MACHINE_I2S (0)set for a specific known problem on the C5, or is it a leftover from the initial bring-up? If the latter, could it be enabled in the official build, as was done for the ESP32-C6 in #17644?I am happy to run any further tests on real C5 hardware, or to open a pull request if that is preferred.
All reactions