All tasks on both cores hang/deadlock

tlaritz
Posts: 9
Joined: Tue Mar 15, 2022 3:01 am

All tasks on both cores hang/deadlock

Postby tlaritz » Mon Oct 24, 2022 9:21 pm

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?

ESP_Sprite
Posts: 9766
Joined: Thu Nov 26, 2015 4:08 am

Re: All tasks on both cores hang/deadlock

Postby ESP_Sprite » Tue Oct 25, 2022 1:59 am

Any chance you can get the serial log when this happens? Could it be that the device simply paniced, for example?

Who is online

Users browsing this forum: No registered users and 77 guests