Page 1 of 1

All tasks on both cores hang/deadlock

Posted: Mon Oct 24, 2022 9:21 pm
by tlaritz
I am building a gateway that will forward my car's CAN messages and messages from a GPS receiver to my iphone via WiFi. I have the Wifi code and TCP stack running on core 0. The code that processes the GPS and CAN messages are running one CORE 1. A "router function" forwards messages from CORE 1 to CORE 0 via a byte type ring buffer. Also on core 0 is a status/telemetry task which collects and forwards statistics of the code running on the ESP32 to the iPhone.

I am consistently seeing all tasks on both cores hang. I know this via several methods:
1. I use a tri-colored LED to show tasks' heartbeats. The leds under the hang state no longer changes.
2. The status/telemetry task no long displays its counts on the console.
3. The rate of received WiFi messages on my iPhone goes to 0.

To me, a hang on both cores of all tasks feels like some kind of dead lock situation where my code is competing for a shared resource. These hangs appeared about the time I switched from my queuing code to the freeRTOS' ring buffer. I am not protecting simultaneous access to the ring buffer because the programming reference states:

"If multiple cores access the same memory address, their access will be serialized at the memory bus level."

The other function that is common across cores is a "clock services" function which wraps getimeofday(). I found that gettimeofday is *NOT* thread safe despite some documentation I have seen to the contrary. I therefore for wrap my call to gettimeofday with taskENTER_CRITICAL(&mutex) and taskEXIT_CRITICAL(&mutex).

I have ordered a ESP evaluation board which facilitates debugging via JTAG.

Ideas, anyone?

Re: All tasks on both cores hang/deadlock

Posted: Tue Oct 25, 2022 1:59 am
by ESP_Sprite
Any chance you can get the serial log when this happens? Could it be that the device simply paniced, for example?