Success building ESP-ADF with Audio command into Micropython?

bschuhma
Posts: 1
Joined: Tue Aug 01, 2023 12:16 pm

Success building ESP-ADF with Audio command into Micropython?

Postby bschuhma » Tue Aug 01, 2023 12:44 pm

Hi all, new here...

I have a project where I need a relatively low cost Bluetooth BLE board with audio processing... I'd prefer not to use I2S, and the ESP32-A1S looked like a sure fit. I have micropython compiled onto it, but nowhere in the menuconfig did I get to choose which audio board I have. The build instructions at https://github.com/espressif/esp-adf/tr ... python_adf look to be about 3 years old and they mention a board selection file that doesn't exist anymore: ${ADF_PATH}/micropyton_adf/sdkconfig.adf

Has anyone had success building ESP-ADF with the 'audio' command into an ESP32-A1S and gotten audio out of the headphones? Is there a Howto on this somewhere? I've searched everywhere and pretty much keep coming back to the old instructions (above) on Github. In my searching I have seen some screenshots of running "idf.py menuconfig" that shows a HAL entry where you can pick which board you have, but I don't see that when I run menuconfig in my /Users/bret/personal/esp/esp-adf/micropython_adf/ports/esp32 directory.

FWIW, I've got esp-idf v5.1, esp-adf master branch. My ESP32-A1S seems to be the newer one with the ES8388 chip. The board has "ESP32 Audio Kit v2.2 A247" printed on it.

I'd be very grateful for someone to give me a shove in the right direction and/or correct any misconceptions I might have on this! :-) Would I have better luck/support with another chip - the ESP-WROOM-32 - perhaps? It doesn't have a headphone jack, but I might be able to add one.

Thanks,

Bret

jaxonplaxon
Posts: 1
Joined: Fri Dec 13, 2024 1:10 pm

Re: Success building ESP-ADF with Audio command into Micropython?

Postby jaxonplaxon » Fri Dec 13, 2024 3:40 pm

I'm revining this thread because I've finally found solution for the problem after many hours.

TL;DR: official instructions to install IDF+ADF+Micropython are bad. I'm sharing my steps that let me successfully build micropython ADF for esp32-lyraT-mini v1.2. The menuconfig now works fine, and board is able to play audio:

Follow the official instructions at: https://github.com/espressif/esp-adf/tr ... python_adf, but:
0. Do not remove fatfs file as instruction says (important)

1. Include ESP-ADF in the Cmakelists list in micropython/ports/esp32:
Put this somewhere at top:

cmake_minimum_required(VERSION 3.12)
include($ENV{ADF_PATH}/CMakeLists.txt)

2. Modify sdkconfig in \micropython\ports\esp32\build to enable cert bundle:

CONFIG_MBEDTLS_CERTIFICATE_BUNDLE=y

3. Modify file: \esp-adf\components\esp_peripherals\CMakeLists.txt:

Modify the part with "esp32" to remove sdcard.c sources like that:

IF (CONFIG_IDF_TARGET STREQUAL "esp32")
list(APPEND COMPONENT_ADD_INCLUDEDIRS ./lib/sdcard ./lib/touch)
list(APPEND COMPONENT_SRCS ./periph_sdcard.c ./periph_touch.c ./lib/touch/touch.c)

4. Select your board using this command:
idf.py menuconfig -D MICROPY_BOARD_DIR=${ADF_PATH}/micropython_adf/boards/lyratmini -D USER_C_MODULES=${ADF_PATH}/micropython_adf/mod/micropython.cmake

5. Build from \micropython\ports\esp32\ using command with your board, example:
idf.py build -D MICROPY_BOARD_DIR=${ADF_PATH}/micropython_adf/boards/lyratmini -D USER_C_MODULES=${ADF_PATH}/micropython_adf/mod/micropython.cmake


At this point you should be able to load the official audio example from:
https://github.com/espressif/esp-adf/tr ... f/examples

They also need a little bit of tweaking - skip step 'import install_libs' and use this:

import mip

def install():
mip.install('urequests', target='/sdcard/lib')
mip.install('hmac', target='/sdcard/lib')

Then you can:
import audio_test
audio_test.run()

and it will work with single warning:
E (130300) AUDIO_HAL: audio_hal handle is null

telegreen
Posts: 1
Joined: Tue Dec 31, 2024 7:04 am

Re: Success building ESP-ADF with Audio command into Micropython?

Postby telegreen » Fri Jan 03, 2025 6:25 pm

Hi! I'm glad I found this thread on the forum!
I used some of your instructions and my experience and
I managed to bulld MicroPython for ESP32-A1S AI-Thinker Audio kit v2.2 with ES8388 DAC

https://github.com/telegreen/ESP32-A1S- ... icropython


please ask questions if anyone is interested!

Who is online

Users browsing this forum: No registered users and 15 guests