espressif / esp-adf

Espressif Audio Development Framework
Other
1.53k stars 671 forks source link

How to make playback of mp3 from SD card using esp32-s2? (AUD-2749) #568

Closed sudheeshsmadhav closed 2 years ago

sudheeshsmadhav commented 3 years ago

Hi all, Working on mp3 playback from sd card using esp32-s2. wroom is used. I'm able to create/save a text file and open/edit that file. but stuck at mp3 playback. requesting experienced suggestions and guidance. I will be happy if there is a sample code.

thanks in advance.

HengYongChao commented 3 years ago

Hi, @sudheeshsmadhav

Currently adf support SDIO interface as fatfs dirver, but ESP-S2 has no SDIO interface and has SPI interface.

So you need to choice SPI as fatfs interface, and app code do not need change.

FYI:https://docs.espressif.com/projects/esp-idf/zh_CN/latest/esp32s2/api-reference/peripherals/sdspi_host.html

sudheeshsmadhav commented 3 years ago

@HengYongChao Sir, can you please provide a sample code? I am working with ESP32s2 Saola-1_v1.2 board. a custom esp32s2 wroom board also available. previously I have done all these works successfully with LyraT board. Now the task is to take audio out from DAC lines of esp32s2.

sudheeshsmadhav commented 3 years ago

BY default, the audio hal takes LyraT as board, when I change to Kaluga-1 it shows some errors. Any updates? Highly appreciates your suggestions...

esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj /root/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DADF_VER=\"\" -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -Iconfig -I../main -I/root/esp/esp-idf/components/newlib/platform_include -I/root/esp/esp-idf/components/freertos/include -I/root/esp/esp-idf/components/freertos/xtensa/include -I/root/esp/esp-idf/components/heap/include -I/root/esp/esp-idf/components/log/include -I/root/esp/esp-idf/components/lwip/include/apps -I/root/esp/esp-idf/components/lwip/include/apps/sntp -I/root/esp/esp-idf/components/lwip/lwip/src/include -I/root/esp/esp-idf/components/lwip/port/esp32/include -I/root/esp/esp-idf/components/lwip/port/esp32/include/arch -I/root/esp/esp-idf/components/soc/include -I/root/esp/esp-idf/components/soc/src/esp32s2/. -I/root/esp/esp-idf/components/soc/src/esp32s2/include -I/root/esp/esp-idf/components/hal/esp32s2/include -I/root/esp/esp-idf/components/hal/include -I/root/esp/esp-idf/components/esp_rom/include -I/root/esp/esp-idf/components/esp_common/include -I/root/esp/esp-idf/components/esp_system/include -I/root/esp/esp-idf/components/xtensa/include -I/root/esp/esp-idf/components/xtensa/esp32s2/include -I/root/esp/esp-idf/components/esp32s2/include -I/root/esp/esp-idf/components/driver/include -I/root/esp/esp-idf/components/driver/esp32s2/include -I/root/esp/esp-idf/components/esp_ringbuf/include -I/root/esp/esp-idf/components/efuse/include -I/root/esp/esp-idf/components/efuse/esp32s2/include -I/root/esp/esp-idf/components/espcoredump/include -I/root/esp/esp-idf/components/esp_timer/include -I/root/esp/esp-idf/components/esp_ipc/include -I/root/esp/esp-idf/components/esp_pm/include -I/root/esp/esp-idf/components/soc/soc/esp32s2/include -I/root/esp/esp-idf/components/soc/soc/esp32s2/../include -I/root/esp/esp-idf/components/soc/soc/esp32s2/private_include -I/root/esp/esp-idf/components/vfs/include -I/root/esp/esp-idf/components/esp_wifi/include -I/root/esp/esp-idf/components/esp_wifi/esp32s2/include -I/root/esp/esp-idf/components/esp_event/include -I/root/esp/esp-idf/components/esp_netif/include -I/root/esp/esp-idf/components/esp_eth/include -I/root/esp/esp-idf/components/tcpip_adapter/include -I/root/esp/esp-idf/components/app_trace/include -I/root/esp/esp-idf/components/mbedtls/port/include -I/root/esp/esp-idf/components/mbedtls/mbedtls/include -I/root/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/root/esp/esp-idf/components/bootloader_support/include -I/root/esp/esp-idf/components/app_update/include -I/root/esp/esp-idf/components/spi_flash/include -I/root/esp/esp-idf/components/nvs_flash/include -I/root/esp/esp-idf/components/pthread/include -I/root/esp/esp-idf/components/wpa_supplicant/include -I/root/esp/esp-idf/components/wpa_supplicant/port/include -I/root/esp/esp-idf/components/wpa_supplicant/include/esp_supplicant -I/root/esp/esp-idf/components/asio/asio/asio/include -I/root/esp/esp-idf/components/asio/port/include -I/root/esp/esp-idf/components/cbor/port/include -I/root/esp/esp-idf/components/unity/include -I/root/esp/esp-idf/components/unity/unity/src -I/root/esp/esp-idf/components/unity/unity/extras/fixture/src -I/root/esp/esp-idf/components/cmock/CMock/src -I/root/esp/esp-idf/components/coap/port/include -I/root/esp/esp-idf/components/coap/port/include/coap -I/root/esp/esp-idf/components/coap/libcoap/include -I/root/esp/esp-idf/components/coap/libcoap/include/coap2 -I/root/esp/esp-idf/components/console -I/root/esp/esp-idf/components/nghttp/port/include -I/root/esp/esp-idf/components/nghttp/nghttp2/lib/includes -I/root/esp/esp-idf/components/esp-tls -I/root/esp/esp-idf/components/esp_adc_cal/include -I/root/esp/esp-idf/components/esp_gdbstub/include -I/root/esp/esp-idf/components/esp_hid/include -I/root/esp/esp-idf/components/tcp_transport/include -I/root/esp/esp-idf/components/esp_http_client/include -I/root/esp/esp-idf/components/esp_http_server/include -I/root/esp/esp-idf/components/esp_https_ota/include -I/root/esp/esp-idf/components/protobuf-c/protobuf-c -I/root/esp/esp-idf/components/protocomm/include/common -I/root/esp/esp-idf/components/protocomm/include/security -I/root/esp/esp-idf/components/protocomm/include/transports -I/root/esp/esp-idf/components/mdns/include -I/root/esp/esp-idf/components/esp_local_ctrl/include -I/root/esp/esp-idf/components/sdmmc/include -I/root/esp/esp-idf/components/esp_serial_slave_link/include -I/root/esp/esp-idf/components/esp_websocket_client/include -I/root/esp/esp-idf/components/expat/expat/expat/lib -I/root/esp/esp-idf/components/expat/port/include -I/root/esp/esp-idf/components/wear_levelling/include -I/root/esp/esp-idf/components/fatfs/diskio -I/root/esp/esp-idf/components/fatfs/vfs -I/root/esp/esp-idf/components/fatfs/src -I/root/esp/esp-idf/components/freemodbus/common/include -I/root/esp/esp-idf/components/idf_test/include -I/root/esp/esp-idf/components/idf_test/include/esp32s2 -I/root/esp/esp-idf/components/jsmn/include -I/root/esp/esp-idf/components/json/cJSON -I/root/esp/esp-idf/components/libsodium/libsodium/src/libsodium/include -I/root/esp/esp-idf/components/libsodium/port_include -I/root/esp/esp-idf/components/mqtt/esp-mqtt/include -I/root/esp/esp-idf/components/openssl/include -I/root/esp/esp-idf/components/perfmon/include -I/root/esp/esp-idf/components/spiffs/include -I/root/esp/esp-idf/components/ulp/include -I/root/esp/esp-idf/components/wifi_provisioning/include -I/root/esp/esp-adf/components/audio_sal/include -I/root/esp/esp-adf/components/adf_utils/cloud_services/include -I/root/esp/esp-adf/components/adf_utils/include -I/root/esp/esp-adf/components/display_service/include -I/root/esp/esp-adf/components/display_service/led_indicator/include -I/root/esp/esp-adf/components/display_service/led_bar/include -I/root/esp/esp-adf/components/esp_dispatcher/include -I/root/esp/esp-adf/components/audio_hal/include -I/root/esp/esp-adf/components/audio_hal/driver/es8388 -I/root/esp/esp-adf/components/audio_hal/driver/es8374 -I/root/esp/esp-adf/components/audio_hal/driver/es8311 -I/root/esp/esp-adf/components/audio_hal/driver/es7243 -I/root/esp/esp-adf/components/audio_hal/driver/es7148 -I/root/esp/esp-adf/components/audio_hal/driver/tas5805m -I/root/esp/esp-adf/components/audio_hal/driver/zl38063 -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/api_lib -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/example_apps -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/firmware -I/root/esp/esp-adf/components/audio_hal/driver/include -I/root/esp/esp-adf/components/esp-sr/lib/include -I/root/esp/esp-adf/components/esp-sr/wake_word_engine/include -I/root/esp/esp-adf/components/esp-sr/speech_command_recognition/include -I/root/esp/esp-adf/components/esp-sr/acoustic_algorithm/include -I/root/esp/esp-adf/components/esp-sr/esp-tts/esp_tts_chinese/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_audio/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_codec/include/codec -I/root/esp/esp-adf/components/esp-adf-libs/esp_codec/include/processing -I/root/esp/esp-adf/components/esp-adf-libs/esp_upnp/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_ssdp/include -I/root/esp/esp-adf/components/esp-adf-libs/recorder_engine/include -I/root/esp/esp-adf/components/esp-adf-libs/audio_misc/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_sip/include -I/root/esp/esp-adf/components/audio_pipeline/include -I/root/esp/esp-adf/components/esp_peripherals/include -I/root/esp/esp-adf/components/esp_peripherals/lib/adc_button -I/root/esp/esp-adf/components/esp_peripherals/lib/gpio_isr -I/root/esp/esp-adf/components/esp_peripherals/lib/touch -I/root/esp/esp-adf/components/esp_peripherals/lib/button -I/root/esp/esp-adf/components/esp_peripherals/lib/blufi -I/root/esp/esp-adf/components/esp_peripherals/lib/IS31FL3216 -I/root/esp/esp-adf/components/esp_peripherals/lib/aw2013 -I/root/esp/esp-adf/components/esp_peripherals/driver/i2c_bus -I/root/esp/esp-adf/components/audio_board/include -I/root/esp/esp-adf/components/audio_board/esp32_s2_kaluga_1_v1_2 -I/root/esp/esp-adf/components/wifi_service/include -I/root/esp/esp-adf/components/clouds/dueros/lightduer/include -I/root/esp/esp-adf/components/dueros_service/include -I/root/esp/esp-adf/components/esp_actions/include -I/root/esp/esp-adf/components/tone_partition/include -I/root/esp/esp-adf/components/audio_stream/include -I/root/esp/esp-adf/components/battery_service/include -I/root/esp/esp-adf/components/battery_service/monitors/include -I/root/esp/esp-adf/components/bluetooth_service/include -I/root/esp/esp-adf/components/coredump_upload_service/include -I/root/esp/esp-adf/components/esp_event_cast/include -I/root/esp/esp-adf/components/input_key_service/include -I/root/esp/esp-adf/components/ota_service/include -I/root/esp/esp-adf/components/playlist/include -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Os -freorder-blocks -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.3-dev-1561-g357a27760-dirty\" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj -MF esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj.d -o esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj -c ../main/http_play_and_save_to_file.c ../main/http_play_and_save_to_file.c: In function 'app_main': ../main/http_play_and_save_to_file.c:43:5: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations] tcpip_adapter_init(); ^~~~~~ In file included from /root/esp/esp-idf/components/esp_netif/include/esp_netif.h:35, from /root/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22, from /root/esp/esp-idf/components/esp_event/include/esp_event.h:26, from /root/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64, from ../main/http_play_and_save_to_file.c:15: /root/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here void tcpip_adapter_init(void) attribute__ ((deprecated)); ^~~~~~ In file included from ../main/http_play_and_save_to_file.c:22: /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:91:35: error: 'I2S_MODE_DAC_BUILT_IN' undeclared (first use in this function); did you mean 'I2S_OUT_DATA_BURST_EN'? .mode = I2S_MODE_MASTER | I2S_MODE_DAC_BUILT_IN | I2S_MODE_TX, \ ^~~~~ ../main/http_play_and_save_to_file.c:66:32: note: in expansion of macro 'I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT' i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~~~~~~~~ /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:91:35: note: each undeclared identifier is reported only once for each function it appears in .mode = I2S_MODE_MASTER | I2S_MODE_DAC_BUILT_IN | I2S_MODE_TX, \ ^~~~~ ../main/http_play_and_save_to_file.c:66:32: note: in expansion of macro 'I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT' i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~~~~~~~~ ../main/http_play_and_save_to_file.c:66:5: warning: 'I2S_COMM_FORMAT_I2S_MSB' is deprecated [-Wdeprecated-declarations] i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~ In file included from /root/esp/esp-idf/components/hal/esp32s2/include/hal/i2s_ll.h:27, from /root/esp/esp-idf/components/hal/include/hal/i2s_hal.h:28, from /root/esp/esp-idf/components/driver/include/driver/i2s.h:24, from /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:28, from ../main/http_play_and_save_to_file.c:22: /root/esp/esp-idf/components/hal/include/hal/i2s_types.h:71:5: note: declared here I2S_COMM_FORMAT_I2S_MSB attribute__((deprecated)) = 0x01, /!< I2S format MSB, (I2S_COMM_FORMAT_I2S |I2S_COMM_FORMAT_I2S_MSB) correspond to I2S_COMM_FORMAT_STAND_I2S/ ^~~~~~~ ninja: build stopped: subcommand failed. ninja failed with exit code 1

HengYongChao commented 3 years ago

BY default, the audio hal takes LyraT as board, when I change to Kaluga-1 it shows some errors. Any updates? Highly appreciates your suggestions...

esp-idf/main/CMakeFiles/__idf_main.dir/http_play_and_save_to_file.c.obj /root/.espressif/tools/xtensa-esp32s2-elf/esp-2020r3-8.4.0/xtensa-esp32s2-elf/bin/xtensa-esp32s2-elf-gcc -DADF_VER="" -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE="mbedtls/esp_config.h" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -Iconfig -I../main -I/root/esp/esp-idf/components/newlib/platform_include -I/root/esp/esp-idf/components/freertos/include -I/root/esp/esp-idf/components/freertos/xtensa/include -I/root/esp/esp-idf/components/heap/include -I/root/esp/esp-idf/components/log/include -I/root/esp/esp-idf/components/lwip/include/apps -I/root/esp/esp-idf/components/lwip/include/apps/sntp -I/root/esp/esp-idf/components/lwip/lwip/src/include -I/root/esp/esp-idf/components/lwip/port/esp32/include -I/root/esp/esp-idf/components/lwip/port/esp32/include/arch -I/root/esp/esp-idf/components/soc/include -I/root/esp/esp-idf/components/soc/src/esp32s2/. -I/root/esp/esp-idf/components/soc/src/esp32s2/include -I/root/esp/esp-idf/components/hal/esp32s2/include -I/root/esp/esp-idf/components/hal/include -I/root/esp/esp-idf/components/esp_rom/include -I/root/esp/esp-idf/components/esp_common/include -I/root/esp/esp-idf/components/esp_system/include -I/root/esp/esp-idf/components/xtensa/include -I/root/esp/esp-idf/components/xtensa/esp32s2/include -I/root/esp/esp-idf/components/esp32s2/include -I/root/esp/esp-idf/components/driver/include -I/root/esp/esp-idf/components/driver/esp32s2/include -I/root/esp/esp-idf/components/esp_ringbuf/include -I/root/esp/esp-idf/components/efuse/include -I/root/esp/esp-idf/components/efuse/esp32s2/include -I/root/esp/esp-idf/components/espcoredump/include -I/root/esp/esp-idf/components/esp_timer/include -I/root/esp/esp-idf/components/esp_ipc/include -I/root/esp/esp-idf/components/esp_pm/include -I/root/esp/esp-idf/components/soc/soc/esp32s2/include -I/root/esp/esp-idf/components/soc/soc/esp32s2/../include -I/root/esp/esp-idf/components/soc/soc/esp32s2/private_include -I/root/esp/esp-idf/components/vfs/include -I/root/esp/esp-idf/components/esp_wifi/include -I/root/esp/esp-idf/components/esp_wifi/esp32s2/include -I/root/esp/esp-idf/components/esp_event/include -I/root/esp/esp-idf/components/esp_netif/include -I/root/esp/esp-idf/components/esp_eth/include -I/root/esp/esp-idf/components/tcpip_adapter/include -I/root/esp/esp-idf/components/app_trace/include -I/root/esp/esp-idf/components/mbedtls/port/include -I/root/esp/esp-idf/components/mbedtls/mbedtls/include -I/root/esp/esp-idf/components/mbedtls/esp_crt_bundle/include -I/root/esp/esp-idf/components/bootloader_support/include -I/root/esp/esp-idf/components/app_update/include -I/root/esp/esp-idf/components/spi_flash/include -I/root/esp/esp-idf/components/nvs_flash/include -I/root/esp/esp-idf/components/pthread/include -I/root/esp/esp-idf/components/wpa_supplicant/include -I/root/esp/esp-idf/components/wpa_supplicant/port/include -I/root/esp/esp-idf/components/wpa_supplicant/include/esp_supplicant -I/root/esp/esp-idf/components/asio/asio/asio/include -I/root/esp/esp-idf/components/asio/port/include -I/root/esp/esp-idf/components/cbor/port/include -I/root/esp/esp-idf/components/unity/include -I/root/esp/esp-idf/components/unity/unity/src -I/root/esp/esp-idf/components/unity/unity/extras/fixture/src -I/root/esp/esp-idf/components/cmock/CMock/src -I/root/esp/esp-idf/components/coap/port/include -I/root/esp/esp-idf/components/coap/port/include/coap -I/root/esp/esp-idf/components/coap/libcoap/include -I/root/esp/esp-idf/components/coap/libcoap/include/coap2 -I/root/esp/esp-idf/components/console -I/root/esp/esp-idf/components/nghttp/port/include -I/root/esp/esp-idf/components/nghttp/nghttp2/lib/includes -I/root/esp/esp-idf/components/esp-tls -I/root/esp/esp-idf/components/esp_adc_cal/include -I/root/esp/esp-idf/components/esp_gdbstub/include -I/root/esp/esp-idf/components/esp_hid/include -I/root/esp/esp-idf/components/tcp_transport/include -I/root/esp/esp-idf/components/esp_http_client/include -I/root/esp/esp-idf/components/esp_http_server/include -I/root/esp/esp-idf/components/esp_https_ota/include -I/root/esp/esp-idf/components/protobuf-c/protobuf-c -I/root/esp/esp-idf/components/protocomm/include/common -I/root/esp/esp-idf/components/protocomm/include/security -I/root/esp/esp-idf/components/protocomm/include/transports -I/root/esp/esp-idf/components/mdns/include -I/root/esp/esp-idf/components/esp_local_ctrl/include -I/root/esp/esp-idf/components/sdmmc/include -I/root/esp/esp-idf/components/esp_serial_slave_link/include -I/root/esp/esp-idf/components/esp_websocket_client/include -I/root/esp/esp-idf/components/expat/expat/expat/lib -I/root/esp/esp-idf/components/expat/port/include -I/root/esp/esp-idf/components/wear_levelling/include -I/root/esp/esp-idf/components/fatfs/diskio -I/root/esp/esp-idf/components/fatfs/vfs -I/root/esp/esp-idf/components/fatfs/src -I/root/esp/esp-idf/components/freemodbus/common/include -I/root/esp/esp-idf/components/idf_test/include -I/root/esp/esp-idf/components/idf_test/include/esp32s2 -I/root/esp/esp-idf/components/jsmn/include -I/root/esp/esp-idf/components/json/cJSON -I/root/esp/esp-idf/components/libsodium/libsodium/src/libsodium/include -I/root/esp/esp-idf/components/libsodium/port_include -I/root/esp/esp-idf/components/mqtt/esp-mqtt/include -I/root/esp/esp-idf/components/openssl/include -I/root/esp/esp-idf/components/perfmon/include -I/root/esp/esp-idf/components/spiffs/include -I/root/esp/esp-idf/components/ulp/include -I/root/esp/esp-idf/components/wifi_provisioning/include -I/root/esp/esp-adf/components/audio_sal/include -I/root/esp/esp-adf/components/adf_utils/cloud_services/include -I/root/esp/esp-adf/components/adf_utils/include -I/root/esp/esp-adf/components/display_service/include -I/root/esp/esp-adf/components/display_service/led_indicator/include -I/root/esp/esp-adf/components/display_service/led_bar/include -I/root/esp/esp-adf/components/esp_dispatcher/include -I/root/esp/esp-adf/components/audio_hal/include -I/root/esp/esp-adf/components/audio_hal/driver/es8388 -I/root/esp/esp-adf/components/audio_hal/driver/es8374 -I/root/esp/esp-adf/components/audio_hal/driver/es8311 -I/root/esp/esp-adf/components/audio_hal/driver/es7243 -I/root/esp/esp-adf/components/audio_hal/driver/es7148 -I/root/esp/esp-adf/components/audio_hal/driver/tas5805m -I/root/esp/esp-adf/components/audio_hal/driver/zl38063 -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/api_lib -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/example_apps -I/root/esp/esp-adf/components/audio_hal/driver/zl38063/firmware -I/root/esp/esp-adf/components/audio_hal/driver/include -I/root/esp/esp-adf/components/esp-sr/lib/include -I/root/esp/esp-adf/components/esp-sr/wake_word_engine/include -I/root/esp/esp-adf/components/esp-sr/speech_command_recognition/include -I/root/esp/esp-adf/components/esp-sr/acoustic_algorithm/include -I/root/esp/esp-adf/components/esp-sr/esp-tts/esp_tts_chinese/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_audio/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_codec/include/codec -I/root/esp/esp-adf/components/esp-adf-libs/esp_codec/include/processing -I/root/esp/esp-adf/components/esp-adf-libs/esp_upnp/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_ssdp/include -I/root/esp/esp-adf/components/esp-adf-libs/recorder_engine/include -I/root/esp/esp-adf/components/esp-adf-libs/audio_misc/include -I/root/esp/esp-adf/components/esp-adf-libs/esp_sip/include -I/root/esp/esp-adf/components/audio_pipeline/include -I/root/esp/esp-adf/components/esp_peripherals/include -I/root/esp/esp-adf/components/esp_peripherals/lib/adc_button -I/root/esp/esp-adf/components/esp_peripherals/lib/gpio_isr -I/root/esp/esp-adf/components/esp_peripherals/lib/touch -I/root/esp/esp-adf/components/esp_peripherals/lib/button -I/root/esp/esp-adf/components/esp_peripherals/lib/blufi -I/root/esp/esp-adf/components/esp_peripherals/lib/IS31FL3216 -I/root/esp/esp-adf/components/esp_peripherals/lib/aw2013 -I/root/esp/esp-adf/components/esp_peripherals/driver/i2c_bus -I/root/esp/esp-adf/components/audio_board/include -I/root/esp/esp-adf/components/audio_board/esp32_s2_kaluga_1_v1_2 -I/root/esp/esp-adf/components/wifi_service/include -I/root/esp/esp-adf/components/clouds/dueros/lightduer/include -I/root/esp/esp-adf/components/dueros_service/include -I/root/esp/esp-adf/components/esp_actions/include -I/root/esp/esp-adf/components/tone_partition/include -I/root/esp/esp-adf/components/audio_stream/include -I/root/esp/esp-adf/components/battery_service/include -I/root/esp/esp-adf/components/battery_service/monitors/include -I/root/esp/esp-adf/components/bluetooth_service/include -I/root/esp/esp-adf/components/coredump_upload_service/include -I/root/esp/esp-adf/components/esp_event_cast/include -I/root/esp/esp-adf/components/input_key_service/include -I/root/esp/esp-adf/components/ota_service/include -I/root/esp/esp-adf/components/playlist/include -mlongcalls -ffunction-sections -fdata-sections -fstrict-volatile-bitfields -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-but-set-variable -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Os -freorder-blocks -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER="v4.3-dev-1561-g357a27760-dirty" -DESP_PLATFORM -MD -MT esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj -MF esp-idf/main/CMakeFiles/idf_main.dir/http_play_and_save_to_file.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/http_play_and_save_to_file.c.obj -c ../main/http_play_and_save_to_file.c ../main/http_play_and_save_to_file.c: In function 'app_main': ../main/http_play_and_save_to_file.c:43:5: warning: 'tcpip_adapter_init' is deprecated [-Wdeprecated-declarations] tcpip_adapter_init(); ^~~~~~ In file included from /root/esp/esp-idf/components/esp_netif/include/esp_netif.h:35, from /root/esp/esp-idf/components/esp_event/include/esp_event_legacy.h:22, from /root/esp/esp-idf/components/esp_event/include/esp_event.h:26, from /root/esp/esp-idf/components/esp_wifi/include/esp_wifi.h:64, from ../main/http_play_and_save_to_file.c:15: /root/esp/esp-idf/components/tcpip_adapter/include/tcpip_adapter.h:34:6: note: declared here void tcpip_adapter_init(void) attribute ((deprecated)); ^~~~~~ In file included from ../main/http_play_and_save_to_file.c:22: /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:91:35: error: 'I2S_MODE_DAC_BUILT_IN' undeclared (first use in this function); did you mean 'I2S_OUT_DATA_BURST_EN'? .mode = I2S_MODE_MASTER | I2S_MODE_DAC_BUILT_IN | I2S_MODE_TX, ^~~~~ ../main/http_play_and_save_to_file.c:66:32: note: in expansion of macro 'I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT' i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~~~~~~~~ /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:91:35: note: each undeclared identifier is reported only once for each function it appears in .mode = I2S_MODE_MASTER | I2S_MODE_DAC_BUILT_IN | I2S_MODE_TX, ^~~~~ ../main/http_play_and_save_to_file.c:66:32: note: in expansion of macro 'I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT' i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~~~~~~~~ ../main/http_play_and_save_to_file.c:66:5: warning: 'I2S_COMM_FORMAT_I2S_MSB' is deprecated [-Wdeprecated-declarations] i2s_stream_cfg_t i2s_cfg = I2S_STREAM_INTERNAL_DAC_CFG_DEFAULT(); ^~~~ In file included from /root/esp/esp-idf/components/hal/esp32s2/include/hal/i2s_ll.h:27, from /root/esp/esp-idf/components/hal/include/hal/i2s_hal.h:28, from /root/esp/esp-idf/components/driver/include/driver/i2s.h:24, from /root/esp/esp-adf/components/audio_stream/include/i2s_stream.h:28, from ../main/http_play_and_save_to_file.c:22: /root/esp/esp-idf/components/hal/include/hal/i2s_types.h:71:5: note: declared here I2S_COMM_FORMAT_I2SMSB attribute((deprecated)) = 0x01, /!< I2S format MSB, (I2S_COMM_FORMAT_I2S |I2S_COMM_FORMAT_I2S_MSB) correspond to I2S_COMM_FORMAT_STAND_I2S_/ ^~~~~~~ ninja: build stopped: subcommand failed. ninja failed with exit code 1

HI , @sudheeshsmadhav

The log provided shows some undeclared errors.

It may be an error such as not including a header file. You need to be careful about some dependency issues when porting.

sudheeshsmadhav commented 3 years ago

the i2s header files seems to be OK.

sudheeshsmadhav commented 3 years ago

esp32 works perfectly with internal DAC. While using the same code for Espressif ESP32-S2-Soala-1_V1.2, (MP3 Playback from spiffs) it gives error that the problem with i2s as my previous post. Still the issue not resolved. Any example code released so far? Play back from spiffs or from SD Card? Expecting a solution at the earliest. Thank you.

JVKran commented 3 years ago

Hi there!

I've just encountered this issue as well, allbeit with another example (the "Play MP3 file from SD Card" to be precise). I ended up just using the sdspi host in the audio_board_sdcard_init function of my custom board. It ended up looking (and working) like this. Just like HengYongChao mentioned.

esp_err_t audio_board_sdcard_init(esp_periph_set_handle_t set, periph_sdcard_mode_t mode){
    esp_err_t ret;

    esp_vfs_fat_sdmmc_mount_config_t mount_config = {
        .format_if_mount_failed = SDCARD_FORMAT_ON_MOUNT_FAIL,
        .max_files = SDCARD_OPEN_FILE_NUM_MAX,
        .allocation_unit_size = 16 * 1024
    };
    sdmmc_card_t* card;
    const char mount_point[] = SDCARD_MOUNT_POINT;
    ESP_LOGI(TAG, "Initializing SD card");

    gpio_set_pull_mode(SDCARD_MISO_GPIO, GPIO_PULLUP_ONLY);     // TODO: Replace with seperate pull-ups.
    gpio_set_pull_mode(SDCARD_MOSI_GPIO, GPIO_PULLUP_ONLY);
    gpio_set_pull_mode(SDCARD_SCLK_GPIO, GPIO_PULLUP_ONLY);
    gpio_set_pull_mode(SDCARD_CS_GPIO, GPIO_PULLUP_ONLY);

    ESP_LOGI(TAG, "Using SPI peripheral");

    sdmmc_host_t host = SDSPI_HOST_DEFAULT();
    spi_bus_config_t bus_cfg = {
        .mosi_io_num = SDCARD_MOSI_GPIO,
        .miso_io_num = SDCARD_MISO_GPIO,
        .sclk_io_num = SDCARD_SCLK_GPIO,
        .quadwp_io_num = -1,
        .quadhd_io_num = -1,
        .max_transfer_sz = 4000,
    };
    ret = spi_bus_initialize(host.slot, &bus_cfg, SPI_DMA_CHAN);
    if (ret != ESP_OK) {
        ESP_LOGE(TAG, "Failed to initialize bus.");
        return ret;
    }

    sdspi_device_config_t slot_config = SDSPI_DEVICE_CONFIG_DEFAULT();
    slot_config.gpio_cs = SDCARD_CS_GPIO;
    slot_config.host_id = host.slot;

    ret = esp_vfs_fat_sdspi_mount(mount_point, &host, &slot_config, &mount_config, &card);

    if (ret != ESP_OK) {
        if (ret == ESP_FAIL) {
            ESP_LOGE(TAG, "Failed to mount filesystem. "
                "If you want the card to be formatted, set the EXAMPLE_FORMAT_IF_MOUNT_FAILED menuconfig option.");
        } else {
            ESP_LOGE(TAG, "Failed to initialize the card (%s). "
                "Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
        }
        return ret;
    }
    return ret;
}

I hope this helps you and maybe others in the future as well!

Kind regards,

Jochem

sudheeshsmadhav commented 3 years ago

Thanks @JVKran ,

It helps me. i2s shows some error while using the internal DAC. i think, i2s function is not portable to esp23s2 from esp32.