I use as a basis a debug board - ESP-WROOM-32 ESP32 30 Pin, which is inserted into my cross board with the rest of the harness.
Platform.ini file -
Code: Select all
[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
upload_port = COM31
monitor_port = COM31
board_build.partitions = partitions.csv
monitor_filters = esp32_exception_decoder
lib_deps =
arduino-libraries/Arduino_JSON @ 0.1.0
esp32async/ESPAsyncWebServer@^3.7.0I write all the code using only the functions of the IDF framework, except for the web server, this is the only Arduino library that I use.
Once a day I do a forced reboot of the controller, through - esp_restart();
Initially, I did not configure any WDT myself, but the controller froze once every three days, although I reboot it every day(24 h).
I assumed that the system itself turns on the WDT timer and in case of freezing it will reset the MС.
Then I added some code where I also set the WDT for one of the tasks, a simple task that just resets the timer. Here is the WDT setup code.
Code: Select all
void FnInitWDT(void)
{
esp_err_t err;
esp_task_wdt_config_t cfg_wdt;
cfg_wdt.timeout_ms = WDT_TIME_OUT;
cfg_wdt.trigger_panic = true;
cfg_wdt.idle_core_mask = 0x00;
err = esp_task_wdt_init(&cfg_wdt);
if(err!=ESP_OK) ESP_LOGE(TAG,"ERR_INIT WDT");
err = esp_task_wdt_add(NULL);
if(err!=ESP_OK) ESP_LOGE(TAG,"ERR_ADD WDT");
}Code: Select all
for(;;) //infinite cycle in task
{
ulTaskNotifyTake(pdTRUE, 100/portTICK_PERIOD_MS);
esp_task_wdt_reset();
}
How can it be that the WDT does not reset the MC in case of a freeze?
No other MC works like this, if the system freezes - the hardware timer of the WDT must reset the microcontroller.
I ask for help with this problem.