Code crashes adding WiFi library
Posted: Fri Jun 21, 2024 2:34 pm
Hello,
I use an ESP32 Wroom 32 UE on my custom board. My board has to read an mp3 file on an SD card and play the audio on speaker. I control the board via BLE by sending the name of the file I want to play, stop, volume Up, volume down. This works perfectly. Now I would like to ad OTA to my board. The idea is to send a command via BLE that will turn of BLE and turn on WiFi and allow OTA.
The problem is that just adding the four Wifi libraries I need for this, makes my code crahs when I try to play audio. The only modification I made to the code is to add the libraries.
Libraries on my working code:
#include <ES8388.h>
#include <FS.h>
#include <SD_MMC.h>
#include <AudioGeneratorMP3.h>
#include <AudioFileSourceFS.h>
#include <AudioFileSourceID3.h>
#include <AudioOutputI2S.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
The libraries I add to use OTA:
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
The error message:
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x17 (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:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
E (329) psram: PSRAM ID read error: 0xffffffff
INFO: Speaker is used as an output
SD_MMC Card Type: SDHC
SD_MMC Card Size: 7680MB
Listing directory: /
FILE: /1000.mp3
FILE: /2000.mp3
FILE: /3000.mp3
New value: 1000
BLE_message_received
change_musique to:1000
looking for: /1000.mp3,
Current File: /1000.mp3
Current File: /1000.mp3
found
Playing file: /1000.mp3
E (60486) I2S: i2s_alloc_dma_buffer(741): Error malloc dma buffer
E (60486) I2S: i2s_realloc_dma_buffer(788): Failed to allocate dma buffer
E (60487) I2S: i2s_set_clk(1729): I2S0 tx DMA buffer malloc failed
E (60493) I2S: i2s_driver_install(2027): I2S set clock failed
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400e73bc PS : 0x00060030 A0 : 0x800d604e A1 : 0x3ffcb450
A2 : 0x00000000 A3 : 0x3ffcb48c A4 : 0x00000000 A5 : 0x00000019
A6 : 0x00000000 A7 : 0x3f415867 A8 : 0x800e735c A9 : 0x00000002
A10 : 0x00003fc3 A11 : 0x00000000 A12 : 0xffffffff A13 : 0x3ffc41b8
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000001a EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000003c LBEG : 0x40093ea1 LEND : 0x40093eb1 LCOUNT : 0xffffffff
Backtrace: 0x400e73b9:0x3ffcb450 0x400d604b:0x3ffcb480 0x400d615e:0x3ffcb4c0 0x400d616d:0x3ffcb510 0x400d58c6:0x3ffcb530 0x400d362a:0x3ffcb570 0x400d3749:0x3ffcb590 0x400e47f1:0x3ffcb5d0
ELF file SHA256: a96957f4ba36967f
Rebooting...
Does anyone have an idea why this could happen?
It is the first time I use a forum so I'm sorry if I made something wrong on my post. I know there are rules for posting code...
Thank you in advance for your help.
I use an ESP32 Wroom 32 UE on my custom board. My board has to read an mp3 file on an SD card and play the audio on speaker. I control the board via BLE by sending the name of the file I want to play, stop, volume Up, volume down. This works perfectly. Now I would like to ad OTA to my board. The idea is to send a command via BLE that will turn of BLE and turn on WiFi and allow OTA.
The problem is that just adding the four Wifi libraries I need for this, makes my code crahs when I try to play audio. The only modification I made to the code is to add the libraries.
Libraries on my working code:
#include <ES8388.h>
#include <FS.h>
#include <SD_MMC.h>
#include <AudioGeneratorMP3.h>
#include <AudioFileSourceFS.h>
#include <AudioFileSourceID3.h>
#include <AudioOutputI2S.h>
#include <BLEDevice.h>
#include <BLEUtils.h>
#include <BLEServer.h>
The libraries I add to use OTA:
#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>
The error message:
ets Jul 29 2019 12:21:46
rst:0x1 (POWERON_RESET),boot:0x17 (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:1344
load:0x40078000,len:13964
load:0x40080400,len:3600
entry 0x400805f0
E (329) psram: PSRAM ID read error: 0xffffffff
INFO: Speaker is used as an output
SD_MMC Card Type: SDHC
SD_MMC Card Size: 7680MB
Listing directory: /
FILE: /1000.mp3
FILE: /2000.mp3
FILE: /3000.mp3
New value: 1000
BLE_message_received
change_musique to:1000
looking for: /1000.mp3,
Current File: /1000.mp3
Current File: /1000.mp3
found
Playing file: /1000.mp3
E (60486) I2S: i2s_alloc_dma_buffer(741): Error malloc dma buffer
E (60486) I2S: i2s_realloc_dma_buffer(788): Failed to allocate dma buffer
E (60487) I2S: i2s_set_clk(1729): I2S0 tx DMA buffer malloc failed
E (60493) I2S: i2s_driver_install(2027): I2S set clock failed
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400e73bc PS : 0x00060030 A0 : 0x800d604e A1 : 0x3ffcb450
A2 : 0x00000000 A3 : 0x3ffcb48c A4 : 0x00000000 A5 : 0x00000019
A6 : 0x00000000 A7 : 0x3f415867 A8 : 0x800e735c A9 : 0x00000002
A10 : 0x00003fc3 A11 : 0x00000000 A12 : 0xffffffff A13 : 0x3ffc41b8
A14 : 0x00ff0000 A15 : 0xff000000 SAR : 0x0000001a EXCCAUSE: 0x0000001c
EXCVADDR: 0x0000003c LBEG : 0x40093ea1 LEND : 0x40093eb1 LCOUNT : 0xffffffff
Backtrace: 0x400e73b9:0x3ffcb450 0x400d604b:0x3ffcb480 0x400d615e:0x3ffcb4c0 0x400d616d:0x3ffcb510 0x400d58c6:0x3ffcb530 0x400d362a:0x3ffcb570 0x400d3749:0x3ffcb590 0x400e47f1:0x3ffcb5d0
ELF file SHA256: a96957f4ba36967f
Rebooting...
Does anyone have an idea why this could happen?
It is the first time I use a forum so I'm sorry if I made something wrong on my post. I know there are rules for posting code...
Thank you in advance for your help.