Chat freely about anything...

User avatar
By tomte76
#30432 I solved the problem by passing the struct using call by reference via the argument feature of os_timer_setfn instead of just declaring and using it as a global variable. works like a charm now.
User avatar
By xtal
#30486 Glad it's working...
Most WDT's usually have a method to restart , so you just issue restarts at convenient places in your code.
Are you sure the WDT will trigger if your code fails now? Not sure how you would test this, without modify code
with HANG [ branch on self]
User avatar
By tomte76
#30813 As far as I understand, in a custom firmware based on SDK 1.3 you cannot feed the HW watchdog yourself. You have to take care that you do not occupy the cpu longer the specific intervals mentioned in the SDK programmer's documentation (page 15). Also according to the SDK 1.3 documentation you can poll the system's boot code by reading values from a SDK provided struct. e.g.

Code: Select all     
 struct rst_info* reset_info;
 reset_info = system_get_rst_info();
 os_printf("Boot-Cause: %d\n", reset_info->reason);



where reason is a ENUM you can find in the SDKs documentation:

Code: Select all       
enum rst_reason {
     REANSON_DEFAULT_RST = 0,
     REANSON_WDT_RST = 1,
     REANSON_EXCEPTION_RST = 2,
     REANSON_SOFT_WDT_RST = 3,
     REANSON_SOFT_RESTART = 4,
     REANSON_DEEP_SLEEP_AWAKE = 5,
     REANSON_EXT_SYS_RST = 6,
};



So I called the above in user_init and I got an output 1 which is a REANSON_WDT_RST. So I assume the watchdog triggered the reset. Also I found some threads on the ESP Arduino forum describing compareable poblems using global static or volatile variables instead of passing the data by reference or value to the specific callback.