Watchdog triggered in CPU1,

yoko911
Posts: 6
Joined: Fri Feb 24, 2023 12:42 am

Watchdog triggered in CPU1,

Postby yoko911 » Fri Apr 07, 2023 5:16 am

I have been doing some test code in ESP32, I took an sample code, so I am not using RTOS, I know that main is invoked from a RTOS task underline in esp32-idf.
My main program is now running long at 30k ticks I get a Task watchdog trigger:

Code: Select all

E (30232) task_wdt: Task watchdog got triggered. The following tasks did not reset the watchdog in time:
E (30232) task_wdt:  - IDLE (CPU 0)
E (30232) task_wdt: Tasks currently running:
E (30232) task_wdt: CPU 0: main
E (30232) task_wdt: CPU 1: IDLE
E (30232) task_wdt: Print CPU 0 (current core) backtrace
I tried adding vTaskDelay(100); on the heavy load loop but then I get this error:

Code: Select all

***ERROR*** A stack overflow in task main has been detected.
So maybe RTOS is not correctly enabled? Any tips?

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

Re: Watchdog triggered in CPU1,

Postby ESP_Sprite » Sat Apr 08, 2023 3:09 am

Hard to say. Can you post your code?

MicroController
Posts: 1709
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Watchdog triggered in CPU1,

Postby MicroController » Sun Apr 09, 2023 8:01 pm

Fact: If your task never vTaskDelays and never blocks the idle task does not get any CPU time, so cannot reset its watchdog.
Speculation: I believe the OS is responsible for actively checking stack limits, unless an MPU is present and configured. This means that the stack overflow may have happened "anywhere" in your code but only gets detected when you yield control to the OS, e.g. via vTaskDelay, and as such the problem is unrelated to the call to vTaskDelay.

The reason for the stack overflow may be that you do a lot of things in the main task and have a lot of local variables and/or arrays in app_main(). If that is the case, you can try and increase the main task's stack size (menuconfig -> Component Config -> ESP system settings). The better option would of course be to restructure your code, and move variables, especially arrays, to the heap, constants to flash &c.

Who is online

Users browsing this forum: No registered users and 99 guests