乐鑫技术交流
直播中

刘埃生

8年用户 1794经验值
私信 关注
[问答]

ESP32-C3-Lyra v2.0运行pipeline_spiffs_mp3无法播放音乐怎么处理?

按照官方编译运行pipeline_spiffs_mp3无法正常运行。无法播放出声音
IDF使用 5.1.1版本
使用的是windows installer安装5.1.1版本 https://dl.espressif.com/dl/esp-idf/?idf=4.4
同时也按照
https://github.com/espressif/esp-adf/tr ... e/examples 要求将进行打补丁
Note 3: If you use the ESP32-C3-Lyra development board to run these routines, you need to apply $ADF_PATH/idf_patches/idf_v4.4_i2s_c3_pdm_tx.patch in the $IDF_PATH directory to obtain PDM support.
ADF使用最新master分支。
运行串口的日志:
ESP-ROM:esp32c3-api1-20210207
Build:Feb  7 2021
rst:0x1 (POWERON),boot:0xd (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd5820,len:0x187c
load:0x403cc710,len:0xb34
load:0x403ce710,len:0x305c
entry 0x403cc710
I (30) boot: ESP-IDF v5.1.1-dirty 2nd stage bootloader
I (30) boot: compile time Sep  9 2023 21:32:07
I (30) boot: chip revision: v0.3
I (34) qio_mode: Enabling default flash chip QIO
I (39) boot.esp32c3: SPI Speed      : 80MHz
I (44) boot.esp32c3: SPI Mode       : QIO
I (48) boot.esp32c3: SPI Flash Size : 4MB
I (53) boot: Enabling RNG early entropy source...
I (59) boot: Partition Table:
I (62) boot: ## Label            Usage          Type ST Offset   Length
I (70) boot:  0 nvs              WiFi data        01 02 00009000 00006000
I (77) boot:  1 phy_init         RF data          01 01 0000f000 00001000
I (84) boot:  2 factory          factory app      00 00 00010000 00100000
I (92) boot:  3 storage          Unknown data     01 82 00110000 00100000
I (99) boot: End of partition table
I (104) esp_image: segment 0: paddr=00010020 vaddr=3c040020 size=10c20h ( 68640) map
I (122) esp_image: segment 1: paddr=00020c48 vaddr=3fc8c000 size=01190h (  4496) load
I (123) esp_image: segment 2: paddr=00021de0 vaddr=40380000 size=0be24h ( 48676) load
I (137) esp_image: segment 3: paddr=0002dc0c vaddr=00000000 size=0240ch (  9228)
I (139) esp_image: segment 4: paddr=00030020 vaddr=42000020 size=33098h (209048) map
I (178) boot: Loaded app from partition at offset 0x10000
I (178) boot: Disabling RNG early entropy source...
I (190) cpu_start: Unicore app
I (190) cpu_start: Pro cpu up.
I (198) cpu_start: Pro cpu start user code
I (198) cpu_start: cpu freq: 160000000 Hz
I (198) cpu_start: Application information:
I (201) cpu_start: Project name:     play_spiffs_mp3
I (207) cpu_start: App version:      1
I (211) cpu_start: Compile time:     Sep  9 2023 21:17:49
I (217) cpu_start: ELF file SHA256:  fa89c9b36a829078...
I (223) cpu_start: ESP-IDF:          v5.1.1-dirty
I (229) cpu_start: Min chip rev:     v0.3
I (234) cpu_start: Max chip rev:     v0.99
I (238) cpu_start: Chip rev:         v0.3
I (243) heap_init: Initializing. RAM available for dynamic allocation:
I (250) heap_init: At 3FC8E120 len 0004E5F0 (313 KiB): DRAM
I (257) heap_init: At 3FCDC710 len 00002950 (10 KiB): STACK/DRAM
I (263) heap_init: At 50000010 len 00001FD8 (7 KiB): RTCRAM
I (270) spi_flash: detected chip: gd
I (274) spi_flash: flash io: qio
W (278) spi_flash: Detected size(8192k) larger than the size in the binary image header(4096k). Using the size in the binary image header.
W (291) i2s(legacy): legacy i2s driver is deprecated, please migrate to use driver/i2s_std.h, driver/i2s_pdm.h or driver/i2s_tdm.h
I (303) sleep: Configure to isolate all GPIO pins in sleep state
I (310) sleep: Enable automatic switching of GPIO sleep configuration
I (317) app_start: Starting scheduler on CPU0
I (322) main_task: Started on CPU0
I (322) main_task: Calling app_main()
I (322) SPIFFS_MP3_EXAMPLE: [ 1 ] Mount spiffs
I (352) SPIFFS_MP3_EXAMPLE: [ 2 ] Start codec chip
I (352) SPIFFS_MP3_EXAMPLE: [3.0] Create audio pipeline for playback
I (352) SPIFFS_MP3_EXAMPLE: [3.1] Create spiffs stream to read data from sdcard
I (362) SPIFFS_MP3_EXAMPLE: [3.2] Create i2s stream to write data to codec chip
I (372) SPIFFS_MP3_EXAMPLE: [3.2] esp32c3 lyra board v2
I (382) SPIFFS_MP3_EXAMPLE: [3.3] Create mp3 decoder to decode mp3 file
I (382) SPIFFS_MP3_EXAMPLE: [3.4] Register all elements to audio pipeline
I (392) SPIFFS_MP3_EXAMPLE: [3.5] Link it together [flash-->spiffs-->mp3_decoder-->i2s_stream-->[codec_chip
I (402) SPIFFS_MP3_EXAMPLE: [3.6] Set up  uri (file as spiffs, mp3 as mp3 decoder, and default output is i2s)
I (412) SPIFFS_MP3_EXAMPLE: [ 4 ] Set up  event listener
I (422) SPIFFS_MP3_EXAMPLE: [4.1] Listening event from all elements of pipeline
I (432) SPIFFS_MP3_EXAMPLE: [4.2] Listening event from peripherals
I (432) SPIFFS_MP3_EXAMPLE: [ 5 ] Start audio_pipeline
W (442) AUDIO_THREAD: Make sure selecte

回帖(2)

周雯葭

2024-6-28 10:50:43
可在 i2s_stream.h 中 #define I2S_STREAM_TX_PDM_CFG_DEFAULT() 的最后一行添加 .buffer_len = I2S_STREAM_BUF_SIZE 试试
举报

刘涛

2024-6-28 16:45:58
根据您提供的信息,您正在尝试在ESP32-C3-Lyra v2.0开发板上运行pipeline_spiffs_mp3示例,但无法正常播放音乐。以下是一些建议和解决方案,帮助您解决问题:

1. 确保您的硬件连接正确:
   - 检查ESP32-C3-Lyra开发板是否正确连接到计算机。
   - 确保音频输出设备(例如扬声器或耳机)已正确连接到开发板的音频输出端口。

2. 检查示例代码中的配置:
   - 确保您已正确设置示例代码中的音频输出配置。例如,检查`audio_pipeline`中的`i2s_stream_cfg`结构体是否正确配置了I2S端口和采样率。

3. 应用补丁:
   - 根据您提供的链接,您需要在ESP-IDF目录下应用补丁`$ADF_PATH/idf_patches/idf_v4.4_i2s_c3_pdm_tx.patch`。请确保您已正确应用了此补丁。

4. 检查串口日志:
   - 您提供的串口日志信息不完整。请提供更详细的日志信息,以便我们更好地了解问题所在。特别是关注是否有任何错误或警告信息。

5. 检查音频文件格式和路径:
   - 确保您的音频文件格式(例如MP3)与示例代码中的解码器兼容。
   - 检查音频文件是否放置在正确的路径下,例如SPIFFS文件系统。

6. 更新ESP-IDF和ESP-ADF:
   - 您提到使用的是ESP-IDF 5.1.1版本。尝试更新到最新版本的ESP-IDF(例如v4.4),以确保与ESP-ADF的兼容性。
   - 同时,确保您使用的是最新版本的ESP-ADF。

7. 重新编译和烧录:
   - 在进行上述更改后,重新编译并烧录示例代码到ESP32-C3-Lyra开发板。

8. 检查电源:
   - 确保开发板的电源供应稳定,因为不稳定的电源可能会影响音频播放。

如果以上建议都无法解决问题,请提供更详细的串口日志信息,以便我们进一步分析问题。
举报

更多回帖

发帖
×
20
完善资料,
赚取积分