ESP32-PICO-D4 Chip revision and pSRAM limitations

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby PaulFreund » Fri Nov 13, 2020 10:09 am

do you get again a stack overflow in task LogWriterTask or was it an other?
I don't really know unfortunately. The way the UART output looks I see three scenarios:
  • LogWriterTask on CPU1 still runs and throws new exceptions (thats why there is no "bootup" output
  • The "bootup" output is suppressed by something and we don't know how often CPU0 rebooted
  • The error output is repeated over and over for some reason until WiFi is able to connect again
can you check the "unconnect func" - what happens with the socket pointer ( free ? ) , and how you generate then a new ( enough MEM ? ) do you check before using socket handler ( pointer ) that the pointer is valid ?
The LogWriterTask only contains code for writing to MicroSD and posting HTTP messages with esp_http_client, I don't open my own sockets here, I would assume this is correct but need to check. Memory is constantly monitored and with external pSRAM (as in this case) minimum heap free was 3.9MByte and for the test without pSRAM minimum was 17kByte
is the psram still wired in this modul or do you remove it too after you remove psram using in firmware and change to inside malloc?
pSRAM is still wired, I disable it in menuconfig and replace one macro from heap_caps_malloc(size, MALLOC_CAP_SPIRAM) to malloc(size)

I am constantly trying to narrow it down further. The electronic can be switched between AP and STA mode. In AP mode the whole application hangs, sometimes for multiple seconds if an STA connects to it with at least release/v4.2 head, but not with tags/v4.1 or tags/v4.2-beta1. I'm currently also trying to narrow down which versions are exposing this behavior

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby PaulFreund » Fri Nov 13, 2020 1:46 pm

From now on I will start to do all testing with tags/v4.1 to make sure I don't use any currently unsupported ESP-IDF version. With release/v4.2 I had very strange behaviour, for example the application worked with pSRAM disabled, with pSRAM enabled but not used (usage disabled everywhere in menuconfig and only internal malloc) the application crashed somewhere in vsprintf -> memset. With pSRAM enabled and used it did not crash but the application hung sometimes when connecting to the AP (seemingly without the Watchdog noticing). I will continue to investigate. I also made one application that allocates all malloc and everything else in pSRAM with tags/v4.1 and so far there was no change in behaviour. I will report with further information

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby PaulFreund » Mon Nov 16, 2020 1:07 pm

I found one error that explains at least a big portion of the reboots, not yet sure if all. In case of a WIFI_EVENT_STA_DISCONNECTED event I used esp_netif_destroy in order to clean the old state and then esp_netif_create_default_wifi_sta to recreate the state. I was able to observe a crash every time I stopped the AP with this. Now I don't destroy but just restart it and the crash seems to be gone. WiFi disconnect would explain the randomness of the disconnects.

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby rudi ;-) » Tue Nov 17, 2020 12:35 am

PaulFreund wrote:
Mon Nov 16, 2020 1:07 pm
I found one error that explains at least a big portion of the reboots, not yet sure if all.
In case of a WIFI_EVENT_STA_DISCONNECTED event I used esp_netif_destroy in order to clean the old state and then esp_netif_create_default_wifi_sta to recreate the state.
I was able to observe a crash every time I stopped the AP with this.
Now I don't destroy but just restart it and the crash seems to be gone.
WiFi disconnect would explain the randomness of the disconnects.
Hi Paul
no hurry - can i ask you which version you use in this case, tags/v4.1 right?
bw
rudi
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby PaulFreund » Tue Nov 17, 2020 7:14 am

Hi rudi,

for sure I can say that with my current ESP-IDF revision tags/v4.1 I have a crash if I call esp_netif_destroy from WIFI_EVENT_STA_DISCONNECTED. Now that I seem to have a stable revision I can try to test this also with other revisions.

User avatar
rudi ;-)
Posts: 1729
Joined: Fri Nov 13, 2015 3:25 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby rudi ;-) » Sun Nov 22, 2020 8:32 pm

PaulFreund wrote:
Tue Nov 17, 2020 7:14 am
Hi rudi,

for sure I can say that with my current ESP-IDF revision tags/v4.1 I have a crash if I call esp_netif_destroy from WIFI_EVENT_STA_DISCONNECTED. Now that I seem to have a stable revision I can try to test this also with other revisions.
Hi Paul, thanks - ok - it is strange,
let us must look deeper in this coming time - i think it is a pointer fail perhaps ...
you are ready for OpenOCD ?
which IDE you use usually?
best wishes
rudi ;-)
-------------------------------------
love it, change it or leave it.
-------------------------------------
問候飛出去的朋友遍全球魯迪

PaulFreund
Posts: 45
Joined: Wed Nov 15, 2017 9:07 pm

Re: ESP32-PICO-D4 Chip revision and pSRAM limitations

Postby PaulFreund » Mon Nov 23, 2020 7:30 am

Hi rudi,

first a little update, I have 10 appliances running with the reconnect fix for about 7 days now including heavy application pSRAM usage (albeit with the LWIP and WiFi sRAM usage disabled) so I would say for v4.1 pSRAM is working fine.

At this moment I work without debugging but with the new hardware I could try again, we have some 0ohm resisters to desolder in order to use JTAG instead of MicroSD, unfortunately our company PCs are pretty locked and I never got the setup fully running so far, but I will try.

Best regards,

Paul

Who is online

Users browsing this forum: Baidu [Spider] and 109 guests