ESP32Radio-V2 icon indicating copy to clipboard operation
ESP32Radio-V2 copied to clipboard

stop_mp3client() causes reboot

Open aly-fly opened this issue 1 year ago • 5 comments

All libraries are up to date (removed specific versions in the platformio.ini) When switching the presets the function stop_mp3client is called which causes reboot of the system:

[ 19693][I][main.cpp:1225] showstreamtitle(): [main] StreamTitle='BILLY JOEL - MY LIFE';
[136929][W][AsyncTCP.cpp:930] _poll(): pcb is NULL
Stack loopTask is 5808
Stack Playtask is  484
ADC reading is 0, filtered 0
0 IR interrupts seen
[147514][I][main.cpp:895] nextPreset(): [main] nextPreset is 7
[147516][I][main.cpp:3303] radiofuncs(): [main] Radiofuncs cmd is 1
[147523][I][main.cpp:1303] stop_mp3client(): [main] Stopping client

assert failed: tcp_update_rcv_ann_wnd IDF/components/lwip/lwip/src/core/tcp.c:951 (new_rcv_ann_wnd <= 0xffff)
Backtrace: ....
Rebooting...

After checking various variants I found that the abort command causes crash.

    //mp3client->close() ;                         // Causes memory leak! --> uncommenting this fixes the issue
    mp3client->abort() ;                           // This works better --> causes reboot

Using both lines fixes the issue and disconnection is smooth.

aly-fly avatar Mar 25 '24 20:03 aly-fly

Thanks, I will try that.

Edzelf avatar Mar 26 '24 07:03 Edzelf

I use the platform = espressif32@^6.6.0 in plattformIO.ini because ;platform = espressif32 do not work for me, because newer version do not or may not use SPIFFS anymore.

I also had problems with SDCard, stack error...

I changed the Stack to 16000 in main.cpp in the Sd task, the error is gone. Line 2704: xTaskCreatePinnedToCore ( SDtask, // Task to get filenames from SD card "SDtask", // Name of task. 16000, // Stack size of task original 4000 NULL, // parameter of the task

Now I had reboot, bootloop errors if i use the sd card as soon I select an CS pin for it in the config. I had also SPI Errors, CRC errors. I delete your SD folder in lib\ VSC PlattformIO now uses the sd.h from
C:\Users"user".platformio\packages\framework-arduinoespressif32\libraries\SD\src

Errors are gone and I found this difference in SDdiskIO.cpp between your version and the one from espressive. (may be there are more differences)

// Fix mount issue - sdWait fail ignored before command GO_IDLE_STATE digitalWrite(card->ssPin, LOW); if(!sdWait(pdrv, 500)){ log_w("sdWait fail ignored, card initialize continues"); }

If I copy your files, without this "fix", back to the lib/SD/src folder the error came back instantly. If I copy the files from espressife folder to your lib folder, it use this files and the errors also gone.

Since I am an absolute beginner with this, you may can do more with this information. I did this only as "try and error" and it work for me. Be warned, only deleting the sd folder may result in compiling errors. This is happen at another computer!

I have no clue why my computer was able to find the files automaticly in the mentioned espressife folder.

May be it is better to copy the files directly to the lib/Sd/src folder.

Solar320 avatar Apr 23 '24 18:04 Solar320

Espressif platform version 6.6.0 is the latest up to now. It should be okay to use it. The SD directory in the project should be deleted, it was a left-over of a previous version of the radio. The stack size needed for the SD card is a problem. A bigger size may cause the webinterface to crash.

Edzelf avatar Apr 24 '24 12:04 Edzelf

Thanks for the reply, Then I will use it now in this way.

Changing the stack size was try and error , may be I can use fewer stack without problems. I have to test this.

best Regards Carsten

Solar320 avatar Apr 24 '24 15:04 Solar320

I now go in steps back to 4000 for stack size, no problem to switch between Mp3Player/SD Task and Webradio Task.

May be this stack error was only an follow Up error because of the wrong SD library...

At the moment it ist stable, I also have my sd card at 16Mhz, if it real switched to this frequency if I do this. #define SDSPEED 16000000 // SPI speed of SD card

At 20Mhz the VS chip randomly will not reconized. The SDcard works till 40Mhz.

xTaskCreatePinnedToCore ( SDtask, // Task to get filenames from SD card "SDtask", // Name of task. 4000, // Stack size of task original 4000 NULL, // parameter of the task 2, // priority of the task &xsdtask, // Task handle to keep track of created task 0 ) ; // Run on CPU 0 #endif

Solar320 avatar Apr 24 '24 16:04 Solar320