Watchdog triggered Task
Posted: Fri Sep 01, 2023 10:23 am
Hello,
I have a strange error when running 2 tasks in my design, the Watchdog get triggered after 5 seconds from the starting run of the CPU,[in my configuration file the parameter Task Watchdog timeout period(seconds) is set to 5.], with:
and change screen task has a 1000ms delay
this is my code:
the error is:
in this way:
everything works correctly.
Why my task get stuck when running the lvgl_change_scr_task code?
could you please give me some advice to avoid this error?
thanks
I have a strange error when running 2 tasks in my design, the Watchdog get triggered after 5 seconds from the starting run of the CPU,[in my configuration file the parameter Task Watchdog timeout period(seconds) is set to 5.], with:
My code is :E (5662) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (5662) task_wdt: - IDLE (CPU 1)
E (5662) task_wdt: Tasks currently running:
E (5662) task_wdt: CPU 0: IDLE
E (5662) task_wdt: CPU 1: lvgl_change_scr
E (5662) task_wdt: Print CPU 1 backtrace
- - Main function
- display init
- time task
- change screen task
Code: Select all
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(10) );
Code: Select all
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(1000) );
Code: Select all
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "esp_timer.h"
#include "esp_heap_task_info.h"
#include "display/display.h"
#include "display/gc9a01.h"
#include "display/ui_helpers.h"
/* PRIVATE STRUCTRES ---------------------------------------------------------*/
#define MAX_TASK_NUM 20 // Max number of per tasks info that it can store
#define MAX_BLOCK_NUM 20 // Max number of per block info that it can store
/* VARIABLES -----------------------------------------------------------------*/
static const char *TAG = "main";
/* DEFINITIONS ---------------------------------------------------------------*/
/* MACROS --------------------------------------------------------------------*/
/* PRIVATE FUNCTIONS DECLARATION ---------------------------------------------*/
static void lvgl_time_task(void*param);
static void lvgl_change_scr_task(void* param);
/* FUNCTION PROTOTYPES -------------------------------------------------------*/
void app_main(void)
{
ESP_LOGI(TAG, "Start Main");
gc9a01_displayInit();
displayConfig();
xTaskCreatePinnedToCore(lvgl_time_task, "lvgl_time_task", 2048*5, NULL, 3, NULL, 1);
xTaskCreatePinnedToCore(lvgl_change_scr_task, "lvgl_change_screen", 2048*5, NULL, 4, NULL, 1);
}
/**
* @brief LVGL library timer task. Necessary to run once every 10ms
*
*/
void lvgl_time_task(void* param)
{
ESP_LOGI(TAG, "TIME Task");
TickType_t xLastWakeTime = xTaskGetTickCount();
while(1)
{
// The task running lv_timer_handler should have lower priority than that running `lv_tick_inc`
lv_timer_handler();
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(10) );
}
}
/**
* @brief my task to test the screen called once every 1000ms
*
*/
void lvgl_change_scr_task(void* param)
{
TickType_t xLastWakeTime = xTaskGetTickCount();
static uint16_t counter=0;
while(1)
{
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS(1000) );
//ESP_LOGI(TAG, "Chart Task %d ", counter);
//--- check screen on display
if(lv_scr_act() == ui_Screen2)
ESP_LOGI(TAG, "Chart Task Screen 2 on display");
if(lv_scr_act() == ui_Screen1)
ESP_LOGI(TAG, "Chart Task Screen 1 on display");
if(lv_scr_act() == ui_Screen3)
ESP_LOGI(TAG, "Chart Task Screen 3 on display");
if(lv_scr_act() == ui_Screen4)
ESP_LOGI(TAG, "Chart Task Screen 4 on display");
//execute action when counter is equal to a specific number
if(counter == 6)
{
_ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_NONE, 500, 0, &ui_Screen1_screen_init);
ESP_LOGI(TAG, "Chart Task Called screen_change function to SCREEN 1");
}
if(counter == 12)
{
_ui_screen_change(&ui_Screen4, LV_SCR_LOAD_ANIM_NONE, 500, 0, &ui_Screen4_screen_init);
ESP_LOGI(TAG, "Chart Task Called screen_change function to SCREEN 4");
}
if(counter == 18)
{
_ui_screen_change(&ui_Screen3, LV_SCR_LOAD_ANIM_NONE, 500, 0, &ui_Screen3_screen_init);
ESP_LOGI(TAG, "Chart Task Called screen_change function to SCREEN 3");
}
counter++;
}
}
the error is:
BUT if i change the first if condition in the lvgl_change_scr_task task waiting only 3 seconds to execute the first actionPS C:\ESP_IDF\40_MySensor_LVGL> set IDF_PATH=C:\Users\Admin\esp\esp-idf
PS C:\ESP_IDF\40_MySensor_LVGL> C:\Users\Admin\.espressif\python_env\idf5.0_py3.11_env\Scripts\python.exe C:\Users\Admin\esp\esp-idf\tools\idf_monitor.py -p COM3 -b 115200 --toolchain-prefix xtensa-esp32-elf- --target esp32 c:\ESP_IDF\40_MySensor_LVGL\build\40_MySensor_LVGL.elf
--- WARNING: GDB cannot open serial ports accessed as COMx
--- Using \\.\COM3 instead...
--- idf_monitor on \\.\COM3 115200 ---
--- Quit: Ctrl+] | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0030,len:6984
load:0x40078000,len:15512
load:0x40080400,len:3864
0x40080400: _init at ??:?
entry 0x40080650
I (26) boot: ESP-IDF v5.0.3 2nd stage bootloader
I (27) boot: compile time 15:56:53
I (27) boot: Multicore bootloader
I (30) boot: chip revision: v1.0
I (33) boot.esp32: SPI Speed : 40MHz
I (38) boot.esp32: SPI Mode : DIO
I (43) boot.esp32: SPI Flash Size : 4MB
I (47) boot: Enabling RNG early entropy source...
I (53) boot: Partition Table:
I (56) boot: ## Label Usage Type ST Offset Length
I (63) boot: 0 nvs WiFi data 01 02 00009000 00004000
I (71) boot: 1 otadata OTA data 01 00 0000d000 00002000
I (78) boot: 2 phy_init RF data 01 01 0000f000 00001000
I (86) boot: 3 factory factory app 00 00 00010000 00200000
I (93) boot: End of partition table
I (98) boot: Defaulting to factory image
I (102) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=1a67ch (108156) map
I (150) esp_image: segment 1: paddr=0002a6a4 vaddr=3ffb0000 size=020ach ( 8364) load
I (153) esp_image: segment 2: paddr=0002c758 vaddr=40080000 size=038c0h ( 14528) load
I (162) esp_image: segment 3: paddr=00030020 vaddr=400d0020 size=4825ch (295516) map
I (271) esp_image: segment 4: paddr=00078284 vaddr=400838c0 size=0a6c4h ( 42692) load
I (296) boot: Loaded app from partition at offset 0x10000
I (296) boot: Disabling RNG early entropy source...
I (307) cpu_start: Multicore app
I (307) cpu_start: Pro cpu up.
I (307) cpu_start: Starting app cpu, entry point is 0x40081264
0x40081264: call_start_cpu1 at C:/Users/Admin/esp/esp-idf/components/esp_system/port/cpu_start.c:143
I (0) cpu_start: App cpu up.
I (328) cpu_start: Pro cpu start user code
I (328) cpu_start: cpu freq: 160000000 Hz
I (328) cpu_start: Application information:
I (332) cpu_start: Project name: 40_MySensor_LVGL
I (338) cpu_start: App version: 1
I (343) cpu_start: Compile time: Aug 28 2023 18:32:32
I (349) cpu_start: ELF file SHA256: f52e61426bea9df4...
I (355) cpu_start: ESP-IDF: v5.0.3
I (360) cpu_start: Min chip rev: v0.0
I (364) cpu_start: Max chip rev: v3.99
I (369) cpu_start: Chip rev: v1.0
I (374) heap_init: Initializing. RAM available for dynamic allocation:
I (381) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (387) heap_init: At 3FFBAF48 len 000250B8 (148 KiB): DRAM
I (393) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (400) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (406) heap_init: At 4008DF84 len 0001207C (72 KiB): IRAM
I (414) spi_flash: detected chip: generic
I (417) spi_flash: flash io: dio
I (422) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (432) main: Start Main
I (432) display: Turn off LCD backlight
I (442) gpio: GPIO[18]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (452) display: Initialize SPI bus
I (452) display: Install panel IO
I (462) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (462) display: Install GC9A01 panel driver
I (472) gpio: GPIO[22]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (602) display: Turn on LCD backlight
I (602) display: Initialize LVGL library
I (602) display: Register display driver to LVGL
I (612) display: Install LVGL tick timer
I (612) display: Display LVGL MySensor Widget
I (662) main: TIME Task
I (1662) main: Chart Task Screen 2 on display
I (2662) main: Chart Task Screen 2 on display
I (3662) main: Chart Task Screen 2 on display
I (4662) main: Chart Task Screen 2 on display
E (5662) task_wdt: Task watchdog got triggered. The following tasks/users did not reset the watchdog in time:
E (5662) task_wdt: - IDLE (CPU 1)
E (5662) task_wdt: Tasks currently running:
E (5662) task_wdt: CPU 0: IDLE
E (5662) task_wdt: CPU 1: lvgl_change_scr
E (5662) task_wdt: Print CPU 1 backtrace
Backtrace: 0x40085A0A:0x3FFB1430 0x40082F95:0x3FFB1450 0x400D5FB1:0x3FFCA6C0 0x400D678B:0x3FFCA6F0 0x400D564B:0x3FFCA710 0x400D5216:0x3FFCA730 0x4000BD83:0x3FFCA750 0x4000117D:0x3FFCA770 0x400592FE:0x3FFCA790 0x4005937A:0x3FFCA7B0 0x40107B43:0x3FFCA7D0 0x4011340B:0x3FFCA800 0x4010EE32:0x3FFCA820 0x4010EFAD:0x3FFCAB30 0x40118261:0x3FFCAB60 0x4008C885:0x3FFCAB90 0x400D6801:0x3FFCABE0 0x40089A79:0x3FFCAC10
0x40085a0a: esp_crosscore_isr at C:/Users/Admin/esp/esp-idf/components/esp_system/crosscore_int.c:96
0x40082f95: _xt_lowint1 at C:/Users/Admin/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/xtensa_vectors.S:1118
0x400d5fb1: uart_tx_char at C:/Users/Admin/esp/esp-idf/components/vfs/vfs_uart.c:154
0x400d678b: uart_write at C:/Users/Admin/esp/esp-idf/components/vfs/vfs_uart.c:209
0x400d564b: console_write at C:/Users/Admin/esp/esp-idf/components/vfs/vfs_console.c:73
0x400d5216: esp_vfs_write at C:/Users/Admin/esp/esp-idf/components/vfs/vfs.c:436 (discriminator 4)
0x40107b43: __sfvwrite_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/fvwrite.c:251
0x4011340b: __sprint_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:429
(inlined by) __sprint_r at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vfprintf.c:399
0x4010ee32: _vfprintf_r at ??:?
0x4010efad: vprintf at /builds/idf/crosstool-NG/.build/HOST-x86_64-w64-mingw32/xtensa-esp32-elf/src/newlib/newlib/libc/stdio/vprintf.c:34 (discriminator 5)
0x40118261: esp_log_writev at C:/Users/Admin/esp/esp-idf/components/log/log.c:200
0x4008c885: esp_log_write at C:/Users/Admin/esp/esp-idf/components/log/log.c:210
0x400d6801: lvgl_change_scr_task at C:/ESP_IDF/40_MySensor_LVGL/main/main.c:76 (discriminator 13)
0x40089a79: vPortTaskWrapper at C:/Users/Admin/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:154
in this way:
Code: Select all
...
if(counter == 3)
{
_ui_screen_change(&ui_Screen1, LV_SCR_LOAD_ANIM_NONE, 500, 0, &ui_Screen1_screen_init);
//lv_obj_clean(ui_Screen2);
//lv_disp_load_scr(ui_Screen1);
ESP_LOGI(TAG, "Chart Task Called screen_change function to SCREEN 1");
}
...
Why my task get stuck when running the lvgl_change_scr_task code?
could you please give me some advice to avoid this error?
thanks