-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Watchdog Example not working as expected on a Nordic chip #29991
Comments
If you can confirm my conclusion, I am happy to write a patch for it. |
@caco3 Please do. There are multiple parts of the watchdog API that aren't entirely cross-vendor capable, so documenting it would be good. But:
No, we don't want that. C defines that static variables, like file-scope variables, are default-initialized to all zeros, so the value will be |
I faced same problem on SiFive HiFive1 rev.b board. No one has enough time to callback wdt_callback() because WDT_FLAG_RESET_SOC request I think this sample (and also tests/drivers/watchdog) is a little strange. So in my opinion, shall we split sample into 2 parts:
I will be appreciated any comments from you. Thanks. |
Copied from slack for posterity:
So I don't think this change is appropriate and the sample needs to be fixed in a different way. |
The current implementation of watchdog sample application is incorrect and violates original design of watchdog API. It is not possible to reliably support scenario when watchdog timeout triggers a callback and SoC reset at the same time. The watchdog API was not designed to be used this way. The scenario described by jyates where watchdog timeout triggers a callback followed by SoC reset can only be supported in a reliable manner by a multistage watchdog. This requires dedicated hardware support and can be enabled by Unfortunately, none of the existing drivers seems to implement support for multistage watchdog. I propose to fix the sample application and improve watchdog API specification. |
PR #31925 addresses the reported issue and would close this. However, there are a variety of additional problems with that sample, and with several drivers, that mandate further attention early in 2.6, including:
Those issues as well as the concerns in #29991 (comment) should be tracked in an enhancement issue for a review of the watchdog API and implementation. |
In the Watchdog Example the example shows that it is possible to trigger a callback on a watchdog trigger before the hardwired watchdog action. The callback re-feeds the watchdog and prints a whole line to the log.
At least on a Nordic nrf52 chip, this does not work as shown in the example!
Expected Outcome:
The log shows the line "Handled things..ready to reset" before the device gets reset
Seen Outcome:
Only the first 1 character is shown:
A▒*** Booting Zephyr OS build zephyr-v2.4.0 ***
(Note: Character 3 and later are already the next startup)
https://devzone.nordicsemi.com/f/nordic-q-a/38926/wdt-and-error-handler states the following:
This leads me to the conclusion, that the Watchdog Example (at least on a Nordic nRF52) does not work as expected!
Suggestions:
static bool handled_event;
should be changed tostatic bool handled_event = false;
to make sure it does not have a random value!The text was updated successfully, but these errors were encountered: