You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Phil Schatzmann的ESP32 Audio库触发看门狗重启及其他问题求助

ESP32 搭配 MAX98357a 播放SD卡MP3文件故障排查求助

我用ESP32通过I2S功放MAX98357a播放SD卡中的MP3文件,尝试了arduino-audio-tools库中的player-sdfat-i2s、player-sd-i2s、streams-sd_mp3-i2s三个示例代码,均无音频输出。将AudioToolsLogger切换为Debug模式后,发现ESP32因看门狗触发重启;部分场景下还出现Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.错误。

使用的示例代码

/**
 * @file player-sdfat-i2s.ino
 * @brief see https://github.com/pschatzmann/arduino-audio-tools/blob/main/examples/examples-player/player-sdfat-i2s/README.md
 * 
 * @author Phil Schatzmann
 * @copyright GPLv3
 */


#include "AudioTools.h"
#include "AudioTools/AudioLibs/AudioSourceSDFAT.h"
#include "AudioTools/AudioCodecs/CodecMP3Helix.h"


const char *startFilePath="/";
const char* ext="mp3";
AudioSourceSDFAT source(startFilePath, ext);
I2SStream i2s;
MP3DecoderHelix decoder;
AudioPlayer player(source, i2s, decoder);


void printMetaData(MetaDataType type, const char* str, int len){
  Serial.print("==> ");
  Serial.print(toStr(type));
  Serial.print(": ");
  Serial.println(str);
}

void setup() {
  Serial.begin(115200);
  AudioToolsLogger.begin(Serial, AudioToolsLogLevel::Debug);

  // setup output
  auto cfg = i2s.defaultConfig(TX_MODE);
  /*cfg.pin_bck = 4;
  cfg.pin_ws = 2;
  cfg.pin_data = 15;*/
  i2s.begin(cfg);

  // setup player
  //source.setFileFilter("*Bob Dylan*");
  player.setMetadataCallback(printMetaData);
  player.begin();
}

void loop() {
  player.copy();
}

串口调试信息片段

==> Title: test_track_1
[I] StreamCopy.h : 169 - StreamCopy::copy  1024 -> 1024 -> 1024 bytes - in 1 hops
[D] AudioPlayer.h : 363 - virtual size_t audio_tools::AudioPlayer::copy(size_t)
[D] StreamCopy.h : 106 - copy 1024 bytes 
[D] StreamCopy.h : 249 - available: 1898066
[D] StreamCopy.h : 394 - write: 1024
[D] AudioEncoded.h : 188 - EncodedAudioOutput::write: 1024
[D] CodecMP3Helix.h : 108 - virtual size_t audio_tools::MP3DecoderHelix::write(const uint8_t*, size_t): 1024
etS Jul 29 2019 12:21:46

rst:0x8 (TG1WDT_SYS_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4688

已排查内容

  • SD卡SPI连接正常,可读取歌曲标题
  • 反复检查I2S接线,更换过电源

恳请各位提供解决建议!

内容的提问来源于stack exchange,提问作者Sera

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.14 01:50:53