Greetings,
I have recently incorporated the Task Watchdog library in our custom application for our custom board based on nRF52840 MCU with success and everything works as expected.
The only issue I have not been able to solve is getting the information on which thread was responsible for a watchdog timeout.
Inside the task watchdog callback I tried printing the information of the log using printk, the logging system (LOG_WRN/INF/DBG) & saving the information in the internal flash so that I can at least retrieve it and print it using the logger after the reset on initialization.
Below a have attached the callback used for all the task watchdog channels.
void task_wdt_callback(int channel_id, void *user_data) { // LOG_INF("Task watchdog channel %d callback, thread: %s", // channel_id, k_thread_name_get((k_tid_t)user_data)); printk("Task watchdog channel %d callback, thread: %s\n", channel_id, k_thread_name_get((k_tid_t)user_data)); // ch_id = channel_id; // LOG_INF("ch_id: %d", ch_id); wdt_state_t state = { .wdt_reboot = true, .channel_id = channel_id, .user_data = user_data }; fs_store_wdt_info( state ); /* * If the issue could be resolved, call task_wdt_feed(channel_id) here * to continue operation. * * Otherwise we can perform some cleanup and reset the device. */ printk("Resetting device...\n"); // LOG_INF("Resetting device..."); //k_msleep(2000); sys_reboot(SYS_REBOOT_COLD); }
Whatever I put inside this callback seems like it is never executed, not even storing the values with the LittleFS system using fs_store_wdt_info (which is already implemented and tested and works great as in many other modules of our custom application, when I retrieve the values from flash on initialization I get irrelevant invalid values).
What could be the problem here?
I have confirmed using the debugger that the callback function is indeed called when simulating a hang in a thread (by inserting an infinite loop in the thread) but seems like the code inside the callback is not running at all.
I look forward to hearing from you with any feedback on what could be causing this.
Thank you!
Best regards,
Stavros