schreibfaul1 / ESP32-MiniWebRadio

Internetradio with ESP32, I2S DAC and SPI TFT Display with Touchpad
https://www.youtube.com/watch?v=6QbPee2583o
330 stars 82 forks source link

Insufficient Memory and SD card write errors when set DECODER to 1 (for PCM5102A DAC) #202

Closed steve6375 closed 1 year ago

steve6375 commented 1 year ago

I have both a VS1053B and PCM5102A DAC connected to an esp32. The only problem the VS1053 has is that m4a files don't seem to play and sometimes flac files dont fully play. SD card works OK and esp32 doesn't crash.

I used 'Release' build (not debug) and -DCORE_DEBUG_LEVEL=5

So I tried the DAC and just changed DECODER to 1 and recompiled. With DAC it does play m4a (not FLAC files as no PSRAM) and some radio stations but on other stations it will give memory errors and also reads and writes to SD card often fail and leaves blank stations.csv or settings.csv. Also crashes on occasion even from fresh boot. I tried several clean rebuilds but still a problem. I am using the small buttons previous build still (not latest main) release.

Is it using too much memory and is there anything I can do to make DAC work reliably?

This is DECODER = 0 which is basically stable and OK:

 *  Executing task: C:\Users\Steve\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor --environment esp32 

Processing esp32 (board: esp32dev; platform: https://github.com/platformio/platform-espressif32.git#v6.2.0; framework: arduino, espidf)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.2.0+sha.1d6e199) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 3MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 2.0.8+sha.d3254f7
 - framework-espidf @ 3.40404.0 (4.4.4)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0 
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP32-IR-Remote-Control @ 1.0.10+sha.869e149
|-- ESP32-vs1053_ext @ 1.0.10+sha.297b304
|-- ESP32-audioI2S-master @ 2.0.0+sha.669e61d
|-- Arduino_JSON @ 0.2.0+sha.89b92d9
|-- ac101
|-- es8388
|-- ftpsrv
|-- rtime
|-- SoapESP32 @ 1.1.5
|-- tftLib
|-- websrv
|-- wm8978
Building in release mode
Compiling .pio\build\esp32\src\audiotask.o
Compiling .pio\build\esp32\src\main.o
Linking .pio\build\esp32\firmware.elf
Retrieving maximum program size .pio\build\esp32\firmware.elf
Checking size .pio\build\esp32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  17.3% (used 56744 bytes from 327680 bytes)
Flash: [========  ]  79.1% (used 3006009 bytes from 3801088 bytes)
Building .pio\build\esp32\firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...

This is DECODER = 1

various runs...

 *  Executing task: C:\Users\Steve\.platformio\penv\Scripts\platformio.exe run --target upload --target monitor --environment esp32 

Processing esp32 (board: esp32dev; platform: https://github.com/platformio/platform-espressif32.git#v6.2.0; framework: arduino, espidf)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp32dev.html
PLATFORM: Espressif 32 (6.2.0+sha.1d6e199) > Espressif ESP32 Dev Module
HARDWARE: ESP32 240MHz, 320KB RAM, 3MB Flash
DEBUG: Current (cmsis-dap) External (cmsis-dap, esp-bridge, esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
 - framework-arduinoespressif32 @ 2.0.8+sha.d3254f7
 - framework-espidf @ 3.40404.0 (4.4.4)
 - tool-cmake @ 3.16.4
 - tool-esptoolpy @ 1.40501.0 (4.5.1)
 - tool-idf @ 1.0.1
 - tool-mconf @ 1.4060000.20190628 (406.0.0)
 - tool-mkfatfs @ 2.0.1
 - tool-mklittlefs @ 1.203.210628 (2.3)
 - tool-mkspiffs @ 2.230.0 (2.30)
 - tool-ninja @ 1.9.0
 - toolchain-esp32ulp @ 1.23500.220830 (2.35.0)
 - toolchain-xtensa-esp32 @ 8.4.0+2021r2-patch5
Warning! Arduino framework as an ESP-IDF component doesn't handle the `variant` field! The default `esp32` variant will be used.
Reading CMake configuration...
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 12 compatible libraries
Scanning dependencies...
Dependency Graph
|-- ESP32-IR-Remote-Control @ 1.0.10+sha.869e149
|-- ESP32-vs1053_ext @ 1.0.10+sha.297b304       
|-- ESP32-audioI2S-master @ 2.0.0+sha.669e61d   
|-- Arduino_JSON @ 0.2.0+sha.89b92d9
|-- ac101
|-- es8388
|-- ftpsrv
|-- rtime
|-- SoapESP32 @ 1.1.5
|-- tftLib
|-- websrv
|-- wm8978
Building in release mode
Compiling .pio\build\esp32\src\audiotask.o
Compiling .pio\build\esp32\src\main.o
Linking .pio\build\esp32\firmware.elf
Retrieving maximum program size .pio\build\esp32\firmware.elf
Checking size .pio\build\esp32\firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  17.9% (used 58568 bytes from 327680 bytes)   
Flash: [========= ]  85.4% (used 3244281 bytes from 3801088 bytes)
Building .pio\build\esp32\firmware.bin
esptool.py v4.5.1
Creating esp32 image...
Merged 25 ELF sections
Successfully created esp32 image.
Configuring upload protocol...
AVAILABLE: cmsis-dap, esp-bridge, esp-prog, espota, esptool, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa
CURRENT: upload_protocol = esptool
Looking for upload port...
Auto-detected: COM4
Uploading .pio\build\esp32\firmware.bin
esptool.py v4.5.1
Serial port COM4
Connecting.........
Chip is ESP32-D0WD-V3 (revision v3.1)
Features: WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Crystal is 40MHz
MAC: 40:22:d8:3e:8e:3c
Uploading stub...
Running stub...
Stub running...
Changing baud rate to 921600
Changed.
Configuring flash size...
Flash will be erased from 0x00001000 to 0x00005fff...
Flash will be erased from 0x00008000 to 0x00008fff...
Flash will be erased from 0x00010000 to 0x00329fff...
Compressed 18960 bytes to 13072...
Writing at 0x00001000... (100 %)
Wrote 18960 bytes (13072 compressed) at 0x00001000 in 0.5 seconds (effective 290.6 kbit/s)...
Hash of data verified.
Compressed 3072 bytes to 105...
Writing at 0x00008000... (100 %)
Wrote 3072 bytes (105 compressed) at 0x00008000 in 0.1 seconds (effective 288.3 kbit/s)...
Hash of data verified.
Compressed 3250032 bytes to 1214357...
Writing at 0x00010000... (1 %)
Writing at 0x000208e5... (2 %)
...etc.
Writing at 0x003238db... (98 %)
Writing at 0x00328bc5... (100 %)
Wrote 3250032 bytes (1214357 compressed) at 0x00010000 in 30.4 seconds (effective 856.1 kbit/s)...
Hash of data verified.

Leaving...
Hard resetting via RTS pin...

Please build project in debug configuration to get more details about an exception.
See https://docs.platformio.org/page/projectconf/build_configurations.html

--- Terminal on COM4 | 115200 8-N-1
--- Available filters and text transformations: colorize, debug, default, direct, esp32_exception_decoder, hexlify, log2file, nocontrol, printable, send_on_enter, time
--- More details at https://bit.ly/pio-monitor-filters
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H
[     1][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=21, ...)
[     2][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=50009, ...)
[     7][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=80, ...)
[    15][V][WiFiServer.h:42] WiFiServer(): WiFiServer::WiFiServer(port=80, ...)
E (1110) esp_core_dump_flash: No core dump partition found!
E (1112) esp_core_dump_flash: No core dump partition found!
ESP32 Chip: ESP32-D0WD-V3
Arduino Version: 2.0.8
ESP-IDF Version: 4.4.4
ARDUINO_LOOP_STACK_SIZE 8192 words (32 bit)

00:00:00
00:00:00        ***************************    
00:00:00        *     MiniWebRadio V2     *    
00:00:00        ***************************    

[164433][V][ssl_client.cpp:321] stop_ssl_socket(): Cleaning SSL connection. 17:18:44 AUDIO_info: buffers freed, free Heap: 67152 bytes 17:18:44 AUDIO_info: Connection has been established in 14 ms, free Heap: 66244 bytes [164494][E][Audio.cpp:2399] readPlayListData(): m3u8 playlists requires PSRAM enabled! 17:18:44 AUDIO_info: new request: "http://as-hls-uk-live.akamaized.net/pool_904/live/uk/bbc_radio_fourfm/bbc_radio_fourfm.isml/bbc_radio_fourfm-audio=96000-263691176.ts" 17:18:44 AUDIO_info: AACDecoder has been initialized, free Heap: 20272 bytes , free stack 2600 DWORDs 17:18:44 AUDIO_info: syncword found at pos 0 17:18:44 AUDIO_info: Channels: 2 17:18:44 AUDIO_info: SampleRate: 24000 17:18:44 AUDIO_info: BitsPerSample: 16 17:18:44 AUDIO_info: BitRate: 90374 17:18:44 AUDIO_info: AAC HeaderFormat: ADTS 17:18:44 AUDIO_info: AAC Codec: MPEG-4 LowComplexity 17:18:44 AUDIO_info: VBR recognized, audioFileDuration is estimated 17:18:45 file "/logo/s/BBC Radio 4 hls LOW rate.jpg" not found 17:18:45 HTML_info: SD/logo/BBC Radio 4 hls LOW rate .jpg 17:18:45 WS_onCmd: cmd="SD/logo/BBC Radio 4 hls LOW rate .jpg", params="t=1687623525741", arg="" 17:18:45 HTML_info: Length of file /common/s/unknown.jpg is 3187 [165367][E][WiFiClient.cpp:422] write(): fail on fd 54, errno: 11, "No more processes" 17:18:45 Audiocodec: AAC 17:18:46 HTML_info: SD/common/M3U8.jpg 17:18:46 WS_onCmd: cmd="SD/common/M3U8.jpg", params="t=1687623526281", arg="" 17:18:46 HTML_info: Length of file /common/s/M3U8.jpg is 8861 [165816][E][WiFiClient.cpp:422] write(): fail on fd 54, errno: 11, "No more processes" [166106][E][WiFiClient.cpp:422] write(): fail on fd 54, errno: 11, "No more processes" 17:18:50 AUDIO_info: new request: "http://as-hls-uk-live.akamaized.net/pool_904/live/uk/bbc_radio_fourfm/bbc_radio_fourfm.isml/bbc_radio_fourfm-audio=96000-263691177.ts"

17:22:53 HTML_info: next_station 17:22:53 WS_onCmd: cmd="next_station", params="", arg="" 17:22:53 in setStation 2 17:22:53 action: ... switch to station 2 17:22:54 IN connecttohost https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_fourfm.m3u8 17:22:54 AUDIO_info: Connect to new host: "https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_fourfm.m3u8" [413908][V][ssl_client.cpp:321] stop_ssl_socket(): Cleaning SSL connection. 17:22:54 AUDIO_info: buffers freed, free Heap: 69348 bytes [413936][V][ssl_client.cpp:62] start_ssl_client(): Free internal heap before TLS 69348 [413937][V][ssl_client.cpp:68] start_ssl_client(): Starting socket [413952][V][ssl_client.cpp:146] start_ssl_client(): Seeding the random number generator [413953][V][ssl_client.cpp:155] start_ssl_client(): Setting up the SSL/TLS structure... [413959][D][ssl_client.cpp:176] start_ssl_client(): WARNING: Skipping SSL Verification. INSECURE! [413968][V][ssl_client.cpp:254] start_ssl_client(): Setting hostname for TLS session... [413977][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():264]: (-32512) SSL - Memory allocation failed [413988][E][WiFiClientSecure.cpp:144] connect(): start_ssl_client: -32512 [413997][V][ssl_client.cpp:321] stop_ssl_socket(): Cleaning SSL connection. 17:22:54 AUDIO_info: Request https://a.files.bbci.co.uk/media/live/manifesto/audio/simulcast/hls/uk/sbr_high/ak/bbc_radio_fourfm.m3u8 failed! 17:22:54 StreamTitle: 17:22:54 HTML_info: SD/logo/BBC Radio 4.jpg 17:22:54 WS_onCmd: cmd="SD/logo/BBC Radio 4.jpg", params="t=1687623774793", arg="" 17:22:54 HTML_info: Length of file /logo/s/BBC Radio 4.jpg is 2980 image

------- RESET EXAMPLE ....

17:58:00 bitRate: 56Kbit/s 17:58:00 bitRate: 56Kbit/s 17:58:00 AUDIO_info: icy-name: BBC Radio 17:58:00 StationName: BBC Radio 17:58:00 icy-descr: BBC Radio [ 11618][E][mp3_decoder.cpp:1555] MP3Decoder_AllocateBuffers(): not enough memory to allocate mp3decoder buffers 17:58:00 AUDIO_info: The MP3Decoder could not be initialized [ 11628][D][SoapESP32.cpp:253] soapSSDPquery(): received SSDP packet within 34 ms: packet size: 364 [ 11644][V][SoapESP32.cpp:259] soapSSDPquery(): SSDP packet content: HTTP/1.1 200 OK CACHE-CONTROL: max-age=1800 DATE: Sat, 24 Jun 2023 16:57:59 GMT ST: urn:schemas-upnp-org:device:MediaServer:1 USN: uuid:4d696e69-444c-164e-9d41-caabf0f3bf33::urn:schemas-upnp-org:device:MediaServer:1 EXT: SERVER: 2.6.35.6-45.fc14.i686 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.0 LOCATION: http://192.168.1.1:8200/rootDesc.xml Content-Length: 0

[ 11683][D][SoapESP32.cpp:276] soapSSDPquery(): scanned ip=192.168.1.1, port=8200, location="rootDesc.xml" [ 11718][D][SoapESP32.cpp:253] soapSSDPquery(): received SSDP packet within 124 ms: packet size: 364 [ 11718][V][SoapESP32.cpp:259] soapSSDPquery(): SSDP packet content: HTTP/1.1 200 OK CACHE-CONTROL: max-age=1800 DATE: Sat, 24 Jun 2023 16:57:59 GMT ST: urn:schemas-upnp-org:device:MediaServer:1 USN: uuid:4d696e69-444c-164e-9d41-caabf0f3bf33::urn:schemas-upnp-org:device:MediaServer:1 EXT: SERVER: 2.6.35.6-45.fc14.i686 DLNADOC/1.50 UPnP/1.0 MiniDLNA/1.1.0 LOCATION: http://192.168.1.1:8200/rootDesc.xml Content-Length: 0

[ 11756][D][SoapESP32.cpp:276] soapSSDPquery(): scanned ip=192.168.1.1, port=8200, location="rootDesc.xml" 17:58:04 DLNA_info: SSDP query discovered 1 media servers [ 15624][D][SoapESP32.cpp:1182] soapGet(): 192.168.1.1:8200 GET /rootDesc.xml HTTP/1.1 17:58:04 DLNA_info: connected successfully to 192.168.1.1:8200 [ 15638][E][WiFiClient.cpp:67] fillBuffer(): Not enough memory to allocate buffer [ 15638][E][WiFiClient.cpp:467] read(): fail on fd 53, errno: 119, "Connection already in progress" [ 16638][E][SoapESP32.cpp:317] soapReadHttpHeader(): header line: 17:58:05 DLNA_info: this Server does not deliver media content [ 16649][I][WiFiClient.cpp:549] connected(): Unexpected: RES: 0, ERR: 119 [ 16649][E][WiFiClient.cpp:67] fillBuffer(): Not enough memory to allocate buffer [ 16655][E][WiFiClient.cpp:467] read(): fail on fd 53, errno: 119, "Connection already in progress" [ 17649][E][websrv.cpp:361] handlehttp(): Command client schould be available but is not! 17:58:06 Audiocodec: MP3 17:58:06 ftpServer: Ftp server waiting for connection on port 21 [ 17994][E][WiFiClient.cpp:67] fillBuffer(): Not enough memory to allocate buffer [ 17994][E][WiFiClient.cpp:467] read(): fail on fd 53, errno: 11, "No more processes" [ 18994][E][websrv.cpp:361] handlehttp(): Command client schould be available but is not!

abort() was called at PC 0x4019682b on core 1

Backtrace: 0x400836f1:0x3ffd1c10 0x4008e5a9:0x3ffd1c30 0x4009861d:0x3ffd1c50 0x4019682b:0x3ffd1cd0 0x40196872:0x3ffd1cf0 0x40196b5d:0x3ffd1d10 0x40196c1c:0x3ffd1d30 0x40120752:0x3ffd1d50 0x401208f9:0x3ffd1d80 0x40117341:0x3ffd1e10 0x400d9535:0x3ffd1e40 0x400dc7af:0x3ffd1ea0 0x400dc8aa:0x3ffd1f00 0x40116075:0x3ffd1f20

0 0x400836f1:0x3ffd1c10 in panic_abort at C:\Users\Steve.platformio\packages\framework-espidf\components\esp_system/panic.c:408

1 0x4008e5a9:0x3ffd1c30 in esp_system_abort at C:\Users\Steve.platformio\packages\framework-espidf\components\esp_system/esp_system.c:137

2 0x4009861d:0x3ffd1c50 in abort at C:\Users\Steve.platformio\packages\framework-espidf\components\newlib/abort.c:46

3 0x4019682b:0x3ffd1cd0 in cxxabiv1::terminate(void (*)()) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:47

4 0x40196872:0x3ffd1cf0 in std::terminate() at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_terminate.cc:57

5 0x40196b5d:0x3ffd1d10 in __cxa_allocate_exception at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:300

6 0x40196c1c:0x3ffd1d30 in operator new(unsigned int) at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/gcc/libstdc++-v3/libsupc++/new_op.cc:54

7 0x40120752:0x3ffd1d50 in gnu_cxx::new_allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator, (gnu_cxx::_Lock_policy)2> >::allocate(unsigned int, void const*) at c:\users\steve.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\ext/new_allocator.h:111

  (inlined by) std::allocator_traits<std::allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator<VFSFileImpl>, (__gnu_cxx::_Lock_policy)2> > >::allocate(std::allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator<VFSFileImpl>, (__gnu_cxx::_Lock_policy)2> >&, unsigned int) at c:\users\steve\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/alloc_traits.h:436
  (inlined by) std::__allocated_ptr<std::allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator<VFSFileImpl>, (__gnu_cxx::_Lock_policy)2> > > std::__allocate_guarded<std::allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator<VFSFileImpl>, (__gnu_cxx::_Lock_policy)2> > >(std::allocator<std::_Sp_counted_ptr_inplace<VFSFileImpl, std::allocator<VFSFileImpl>, (__gnu_cxx::_Lock_policy)2> >&) at c:\users\steve\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/allocated_ptr.h:97
  (inlined by) std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<VFSFileImpl, std::allocator<VFSFileImpl>, VFSImpl*, char const*&, char const*&>(VFSFileImpl*&, std::_Sp_alloc_shared_tag<std::allocator<VFSFileImpl> >, VFSImpl*&&, char const*&, char const*&) at c:\users\steve\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:675
  (inlined by) std::__shared_ptr<VFSFileImpl, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<VFSFileImpl>, VFSImpl*, char const*&, char const*&>(std::_Sp_alloc_shared_tag<std::allocator<VFSFileImpl> >, VFSImpl*&&, char const*&, char const*&) at c:\users\steve\.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr_base.h:1342
  (inlined by) std::shared_ptr<VFSFileImpl>::shared_ptr<std::allocator<VFSFileImpl>, VFSImpl*, char const*&, char const*&>(std::_Sp_alloc_shared_tag<std::allocator<VFSFileImpl> >, VFSImpl*&&, 

char const&, char const&) at c:\users\steve.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:359 (inlined by) std::shared_ptr std::allocate_shared<VFSFileImpl, std::allocator, VFSImpl, char const&, char const&>(std::allocator const&, VFSImpl&&, char const&, char const&) at c:\users\steve.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:706 (inlined by) std::shared_ptr std::make_shared<VFSFileImpl, VFSImpl, char const&, char const&>(VFSImpl&&, char const&, char const&) at c:\users\steve.platformio\packages\toolchain-xtensa-esp32\xtensa-esp32-elf\include\c++\8.4.0\bits/shared_ptr.h:722

8 0x401208f9:0x3ffd1d80 in VFSImpl::open(char const, char const, bool) at C:/Users/Steve/.platformio/packages/framework-arduinoespressif32-src-52b8cdec3e60619426e51a1d18d1c3fa/libraries/FS/src/vfs_api.cpp:47

9 0x40117341:0x3ffd1e10 in fs::FS::open(char const, char const, bool) at C:/Users/Steve/.platformio/packages/framework-arduinoespressif32-src-52b8cdec3e60619426e51a1d18d1c3fa/libraries/FS/src/FS.cpp:234

10 0x400d9535:0x3ffd1e40 in updateSettings() at src/main.cpp:417

11 0x400dc7af:0x3ffd1ea0 in check_1sec() at src/main.cpp:2243

12 0x400dc8aa:0x3ffd1f00 in loop() at src/main.cpp:2269 (discriminator 1)

13 0x40116075:0x3ffd1f20 in loopTask(void*) at C:/Users/Steve/.platformio/packages/framework-arduinoespressif32-src-52b8cdec3e60619426e51a1d18d1c3fa/cores/esp32/main.cpp:50

ELF file SHA256: b3d397abfc4fb8c7

E (12025) esp_core_dump_flash: Core dump flash config is corrupted! CRC=0x7bd5c66f instead of 0x0 Rebooting... ets Jul 29 2019 12:21:46

rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)

schreibfaul1 commented 1 year ago

Finding a trade-off between storage usage and features is difficult. Without PSRAM with I2S DAC only mp3 and aac will work properly. 1) The InBuffer, which temporarily stores the raw audio data, is about 16000 bytes large without PSRAM and about 640000 bytes with PSRAM. So FLAC with a block size of 8KB, only 2 frames fit into the buffer, which is very little. 2) Some WLAN functions are swapped out to the PSRAM, if available 3) mbetTLS (https://...) needs more than 20KB and should therefore be written to PSRAM. 4) VS1053 is a HW decoder, the SW decoders need additional memory, PSRAM is used where possible 5) I reduced the stack in the audio task by 2000 DWORDs (8000bytes), that might help. If you click on the question mark, the 'highest water level' is displayed in the log. There should still be some space at the top, if you reach zero there is a risk of a crash. If you want to use all functions, PSRAM is advisable. Especially OPUS, VORBIS and FLAC are very memory hungry.

steve6375 commented 1 year ago

Thanks for reply. Changing CONFIG_MBEDTLS_INTERNAL_MEM_ALLOC didn't help. The memory stats when using the test ? button in the web ui station screen dont show much difference (but playing some radio stations cause buffer errors as soon as they are played on the DAC still). I guess an esp32 with PSRAM is needed. Do you have a recommendation for a suitable esp32, audio board and TFT that will work the best? Is any model of esp32+PSRAM OK?

schreibfaul1 commented 1 year ago

An ESP32 with 4MB PSRAM is sufficient. PSRAM is faster with ESP32-S3, even faster with octal PSRAM. AAC with SBR is then also activated for the S3 (only ext. DAC). An external DAC would also be good, like PCM5102 instead of the old VS1053B

steve6375 commented 1 year ago

FreeNove WROVER + PSRAM + camera board with PCM5102 solves the problem.

I get warnings

08:21:06 AUDIO_info: slow stream, dropouts are possible 08:21:07 AUDIO_info: slow stream, dropouts are possible 08:21:08 AUDIO_info: slow stream, dropouts are possible

but seems OK.