Page 1 of 1

I2S missing

Posted: Fri May 06, 2022 1:04 pm
by dave1167
Hi All
Quite new to ESP32 so still on a steep learning curve
I'm having trouble finding the I2S library in Micropython V1.18 on an ESP32-C3 board. This is the start of the code

Code: Select all

import os
import math
import struct
from machine import I2S
and the error I get is
Traceback (most recent call last):
File "<stdin>", line 18, in <module>
ImportError: can't import name I2S


Is I2S a sub module of machine? or has it moved elesewhere?
Can anyone see an obvious reason why it fails?

Thanks in advance

Re: I2S missing

Posted: Fri May 06, 2022 7:54 pm
by Mike Teachman
The I2S class is presently excluded for all C3 boards.

in ports/esp32/boards/GENERIC_C3/mpconfigboard.h:

Code: Select all

#define MICROPY_PY_MACHINE_I2S              (0)
I don't know the background on this exclusion. I suggest to raise an Issue at https://github.com/micropython/micropython/issues

Re: I2S missing

Posted: Fri May 06, 2022 11:22 pm
by dave1167
Thanks Mike, I will do

Re: I2S missing

Posted: Sun May 08, 2022 10:33 pm
by andypiper
Some code archaeology indicates that the initial ESP32-C3 support went into MicroPython on 18th July 2021, but the support for I2S on ESP32-C3 didn't get into ESP-IDF itself until several weeks later, in August. So, at a guess, it was excluded from the original generic config, and has not been added in since then.

I have an array of C3 boards to play with here, but no I2S devices, so I could fairly quickly roll a build from HEAD that included I2S support, but I wouldn't be able to test that it was functional.