Skip to content

Conversation

@harshithsunku
Copy link
Contributor

@harshithsunku harshithsunku commented Dec 22, 2025

  • Add wdog_facade module (30s timeout, SoC reset on expiry)

  • Initialize watchdog in main.c at boot

  • Integrate task-level watchdog: only feed if pusher thread is alive

  • Add pusher_check_and_reset_alive() to transport.c for thread monitoring

  • Disable watchdog before system power-off in button.c

  • Enable CONFIG_WATCHDOG in devkit v2 config
    [devkit2] - watchdog timer with a 30s timeout #3434

- Add wdog_facade module (30s timeout, SoC reset on expiry)

- Initialize watchdog in main.c at boot

- Integrate task-level watchdog: only feed if pusher thread is alive

- Add pusher_check_and_reset_alive() to transport.c for thread monitoring

- Disable watchdog before system power-off in button.c

- Enable CONFIG_WATCHDOG in devkit v2 config
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a watchdog timer with a 30-second timeout, significantly enhancing system robustness. The implementation correctly includes early initialization during boot, task-level monitoring of the pusher thread, and proper deinitialization before system power-off. The use of atomic operations for thread liveness checks is an appropriate and thread-safe approach.


int watchdog_deinit(void)
{
return wdt_disable(wdt_dev);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The watchdog_deinit function does not check if wdt_dev is NULL before calling wdt_disable. If watchdog_init fails (e.g., the watchdog device is not ready), wdt_dev might remain NULL. Calling wdt_disable with a NULL device pointer could lead to a system crash. It's important to ensure wdt_dev is valid before attempting to disable the watchdog.

    if (wdt_dev) {
        return wdt_disable(wdt_dev);
    }
    return 0;

@harshithsunku
Copy link
Contributor Author

Hi @TuEmb ,

Ported watchdog support to devkit. The original implementation only feeds the watchdog from the main loop. I've added task-level monitoring for the pusher thread as a sample. Should I extend this to other threads, or should we keep the watchdog feed only in main like the original?

My recommendation: Extending to other threads would be better since any hung thread can cause the device to become unresponsive, not just main. The main loop running doesn't guarantee the whole system is healthy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant