完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
我们参考 IDF/ADF/MicroPython_ADF 的说明将它们进行了整合,Python 的 REPL 工作基本正常,ADF下的play_mp3_control 在脱离MicroPython的环境下单独编译、运行也正常。
但在MicroPython中,通过MicroPython_ADF下的 audio_player 模块播放mp3失败。 IDF/ADF/MicroPython均为主线最新代码。 测试的命令为: #sdcard import machine, os sd = machine.SDCard(slot=1) os.mount(sd, "/sdcard") # Add libs in sdcard to sys.path import sys sys.path.append('/sdcard') #Audio from audio import player, recorder def cb(state): print(state) p = player(cb) p.get_state() p.play("file://sdcard/music-16b-2c-8000hz.mp3") 在执行到最后一步的时候出错,Log为: I (29784) gpio: GPIO[19]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:3 E (29784) gpio: gpio_install_isr_service(460): GPIO isr service already installed I (29804) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (29804) ES8388_DRIVER: init,out:02, in:00 I (29814) AUDIO_HAL: Codec mode is 3, Ctrl:1 I (29814) ESP_AUDIO_TASK: media_ctrl_task running...,0x3fb03548 ----------------------------- ESP Audio Platform ----------------------------- | | | ESP_AUDIO-v1.7.0-9-g84df87e-037bef3-09be8fe | | Compile date: Jul 20 2021-13:51:36 | ------------------------------------------------------------------------------ I (29854) ESP_AUDIO_CTRL: Func:media_ctrl_create, Line:350, MEM Total:1235103 Bytes, Inter:270899 Bytes, Dram:231251 Bytes I (29864) MP3_DECODER: MP3 init I (29874) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3 I (29874) I2S: DMA Malloc info, datalen=blocksize=1200, dma_buf_count=3 I (29924) I2S: APLL: Req RATE: 48000, real rate: 47999.961, BITS: 16, CLKM: 1, BCK_M: 8, MCLK: 12287990.000, SCLK: 1535998.750000, diva: 1, divb: 0 I (29924) LYRAT_V4_3: I2S0, MCLK output by GPIO0 >>> p.get_state() {'media_src': 0, 'err_msg': 0, 'status': 0} I (31104) ESP_AUDIO_CTRL: Enter play procedure, src:0 I (31104) ESP_AUDIO_CTRL: Play procedure, URL is ok, src:0 I (31104) ESP_AUDIO_CTRL: Request_CMD_Queue CMD:0, Available:5, que:0x3ffbd824 I (31114) ESP_AUDIO_TASK: It's a decoder I (31114) ESP_AUDIO_TASK: 1.CUR IN:[IN_file],CODEC:[DEC_mp3],RESAMPLE:[48000],OUT:[OUT_iis],rate:0,ch:0,pos:0 I (31124) ESP_AUDIO_TASK: 2.Handles,IN:0x3fb03768,CODEC:0x3fb03eb8,FILTER:0x3fb044b0,OUT:0x3fb04324 I (31134) ESP_AUDIO_TASK: 2.2 Update all pipeline I (31144) ESP_AUDIO_TASK: 2.3 Linked new pipeline I (31144) AUDIO_PIPELINE: link el->rb, el:0x3fb03768, tag:IN_file, rb:0x3fb04828 I (31154) AUDIO_PIPELINE: link el->rb, el:0x3fb03eb8, tag:DEC_mp3, rb:0x3fb07068 I (31164) AUDIO_PIPELINE: link el->rb, el:0x3fb044b0, tag:Audio_forge, rb:0x3fb090a8 I (31174) ESP_AUDIO_TASK: 3. Previous starting... I (31174) AUDIO_ELEMENT: [IN_file-0x3fb03768] Element task created I (31184) AUDIO_ELEMENT: [IN_file] AEL_MSG_CMD_RESUME,state:1 Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled. Core 0 register dump: PC : 0x400dfaf0 PS : 0x00060230 A0 : 0x800e00e4 A1 : 0x3ffcf810 0x400dfaf0: gc_alloc at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/gc.c:460 A2 : 0x0000001f A3 : 0x00000000 A4 : 0x00000001 A5 : 0x00000001 A6 : 0x000000fe A7 : 0x00000001 A8 : 0x800dfaf0 A9 : 0x3ffcf7f0 A10 : 0x00000000 A11 : 0x00060c23 A12 : 0x00060c20 A13 : 0x00060c23 A14 : 0x000000fe A15 : 0x00000001 SAR : 0x00000004 EXCCAUSE: 0x0000001c EXCVADDR: 0x00000008 LBEG : 0x4008cea5 LEND : 0x4008ceb5 LCOUNT : 0xfffffff8 0x4008cea5: strlen at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/strlen.S:84 0x4008ceb5: strlen at /builds/idf/crosstool-NG/.build/HOST-x86_64-apple-darwin12/xtensa-esp32-elf/src/newlib/newlib/libc/machine/xtensa/strlen.S:96 Backtrace:0x400dfaed:0x3ffcf810 0x400e00e1:0x3ffcf830 0x400e545d:0x3ffcf850 0x400e58cf:0x3ffcf870 0x4012fa8e:0x3ffcf890 0x40171146:0x3ffcf950 0x40171693:0x3ffcf980 0x401717a6:0x3ffcf9a0 0x4017265d:0x3ffcf9d0 0x401718ac:0x3ffcfa10 0x400dfaed: gc_alloc at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/gc.c:460 0x400e00e1: m_malloc at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/malloc.c:86 0x400e545d: mp_obj_new_str_copy at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/objstr.c:2029 0x400e58cf: mp_obj_new_str at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/objstr.c:2095 (inlined by) mp_obj_new_str at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/lv_micropython/py/objstr.c:2088 0x4012fa8e: _vfs_open at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/micropython_adf/mod/vfs_stream.c:120 0x40171146: audio_element_process_init at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/components/audio_pipeline/audio_element.c:175 0x40171693: audio_element_on_cmd_resume at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/components/audio_pipeline/audio_element.c:279 0x401717a6: audio_element_on_cmd at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/components/audio_pipeline/audio_element.c:320 (discriminator 13) 0x4017265d: audio_event_iface_waiting_cmd_msg at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/components/audio_pipeline/audio_event_iface.c:247 0x401718ac: audio_element_task at /Volumes/Linux/Projects/Esp32Proj/adf_integration/yangtze/components/esp-adf/components/audio_pipeline/audio_element.c:473 根据Log查看 gc.c:460 行为: 459 // check if GC is locked 460 if (MP_STATE_THREAD(gc_lock_depth) > 0) { 461 return NULL; 462 } 因为中间的 esp-adf-libs 部分贵司只提供了库文件,并未公开源码,因此不是很明确此处为什么会出错及该如何解决,还望给出建议 |
|
相关推荐
1个回答
|
|
根据您提供的信息,您在MicroPython环境下使用audio_player模块播放MP3文件时遇到了问题。以下是一些建议来解决这个问题:
1. 确保您的MicroPython固件和ESP-ADF库是最新版本。这可以通过检查官方GitHub仓库来完成。 2. 检查您的MP3文件是否正确存储在SD卡上,并且文件路径正确。您可以使用以下代码列出SD卡上的文件: ```python import os def list_files(path): files = os.listdir(path) for file in files: print(file) list_files("/sdcard") ``` 3. 确保您的audio_player模块已经正确导入。您可以尝试重新导入模块,如下所示: ```python from audio import player, recorder ``` 4. 检查您的回调函数(cb)是否正确定义。确保它接受一个参数,如下所示: ```python def cb(event): if event == player.EVENT_PLAYBACK_FINISHED: print("Playback finished") ``` 5. 确保您已经正确初始化了音频播放器,并设置了回调函数。例如: ```python player = player.Player() player.set_callback(cb) ``` 6. 确保您已经正确挂载了SD卡,并设置了正确的路径。例如: ```python import machine import os sd = machine.SDCard(slot=1) os.mount(sd, "/sdcard") ``` 7. 最后,尝试使用player模块播放MP3文件。例如: ```python player.play("/sdcard/your_audio_file.mp3") ``` 如果问题仍然存在,请提供更多详细信息,例如错误消息或日志,以便我们能够更好地帮助您解决问题。 |
|
|
|
只有小组成员才能发言,加入小组>>
313 浏览 0 评论
1170 浏览 1 评论
585浏览 6评论
483浏览 5评论
有没有办法在不使用混杂模式的情况下实现Wifi驱动程序接收缓冲区访问中断呢?
468浏览 5评论
467浏览 4评论
442浏览 4评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-26 13:43 , Processed in 0.881704 second(s), Total 81, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号