Skip to content

Add I2S Driver to ESP32 Makefile #4869

@nevercast

Description

@nevercast

Related to #4170 and #4821 regarding I2S support.

I am implementing a CModule as a demonstration on how to write CModules for MicroPython and what useful things can be done with them, CModules:https://docs.micropython.org/en/latest/develop/cmodules.html

I wanted to demonstrate a Python library that would play predefined audio files baked in to the firmware, for this I would use I2S and the internal DAC of the ESP32. Implement it in a CModule and show it off with some Python wrapper code.

While I have had good success running a custom python script from the micropython.mk file to generate the audio content, and have written a module that will play back these files. I've hit a snag with the i2s driver missing from MicroPython.

The errors during compile look like this

audio_ctrl.c:(.text.audioctrl_init_driver+0x33): undefined reference to `i2s_driver_install'
audio_ctrl.c:(.text.audioctrl_init_driver+0x5c): undefined reference to `i2s_set_pin'
audio_ctrl.c:(.text.audioctrl_init_driver+0x64): undefined reference to `i2s_set_dac_mode'
audio_ctrl.c:(.text.audioctrl_init_driver+0x6c): undefined reference to `i2s_zero_dma_buffer'

and they are caused by i2s.o being missing from ESPIDF_DRIVER_O in ports/esp32/Makefile

ESPIDF_DRIVER_O = $(addprefix $(ESPCOMP)/driver/,\
uart.o \
periph_ctrl.o \
ledc.o \
gpio.o \
timer.o \
sdmmc_host.o \
sdmmc_transaction.o \
sdspi_crc.o \
sdspi_host.o \
sdspi_transaction.o \
spi_master.o \
spi_common.o \
rtc_module.o \
)

I would like to petition that this driver is added to Micropython today, preemptive of the other issues currently open regarding I2S support, and to be permissive of mine CModules example.

Perhaps we can also discuss if there is a cleaner way to implement the functionality of including other drivers with the CModules micropython.mk Makefile, instead of editing the port.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions