Skip to content
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

watch dog timer causes the reboot on SAME70 board #16385

Closed
jwu1980 opened this issue May 24, 2019 · 5 comments
Closed

watch dog timer causes the reboot on SAME70 board #16385

jwu1980 opened this issue May 24, 2019 · 5 comments
Assignees
Labels
area: Watchdog Watchdog bug The issue is a bug, or the PR is fixing a bug platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) priority: low Low impact/importance bug

Comments

@jwu1980
Copy link

jwu1980 commented May 24, 2019

Describe the bug
By default, WDT is enabled on SAME70 board because of the following commit. After that, system reboots when doing a while loop processing.

commit 2e01e86
drivers: watchdog: wdt_sam: use the generic disable option
Use the generic option WDT_DISABLE_AT_BOOT instead of the SAM specific
one WDT_SAM_DISABLE_AT_BOOT (note the generic one has been introduced
after the SAM one).
This also have the consequence of changing the default value for yes to
no, fixing the watchdog tests.

To Reproduce
In the hello_world sample, run this code.
#include <zephyr.h>
#include <misc/printk.h>
void main(void)
{
int i = 0;
while(1){
printk("Iteration %d\n", i++);
}
}

Steps to reproduce the behavior:

  1. mkdir build; cd build
  2. cmake -DBOARD=sam_e70_xplained ../
  3. make flash
  4. System will reboot around iteration 12347

Expected behavior
No reboot

Impact
System reboots randomly.

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: Zephyr SDK 0.10.0
  • Commit SHA: cfa32af
@jwu1980 jwu1980 added the bug The issue is a bug, or the PR is fixing a bug label May 24, 2019
@carlescufi carlescufi added area: Watchdog Watchdog platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) labels May 24, 2019
@ioannisg
Copy link
Member

Not sure if this should be treated as a bug; there is an option to disable the watchdog with CONFIG_WDT_DISABLE_AT_BOOT=y if desired so.

We could also select WDT_DISABLE_AT_BOOT in the board definition, if we want this to be the default behavior. @aurel32 do I understand this correctly? What's your take?

@jwu1980
Copy link
Author

jwu1980 commented May 25, 2019

@ioannisg Thanks for the replay.
Disable the WDT is just a workaround right?
If we need to disable WDT all the time, what’s the reason to have it in the first place?

I would expect WDT can get pet even there is a while loop processing.

@ioannisg ioannisg added the priority: medium Medium impact/importance bug label May 28, 2019
@ioannisg
Copy link
Member

@f7488405 I am reading the watch dog API

/**
 * @brief Set up watchdog instance.
 *
 * This function is used for configuring global watchdog settings that
 * affect all timeouts. It should be called after installing timeouts.
 * After successful return, all installed timeouts are valid and must be
 * serviced periodically by calling wdt_feed().
 *
 * @param dev Pointer to the device structure for the driver instance.
 * @param options Configuration options as defined by the WDT_OPT_* constants
 *
 * @retval 0 If successful.
 * @retval -ENOTSUP If any of the set options is not supported.
 * @retval -EBUSY If watchdog instance has been already setup.
 */
static inline int wdt_setup(struct device *dev, u8_t options)

So it seems to me that it is the responsibility of the application developer to feed the watchdog periodically. Therefore, your eternal while look in the snipped you posted requires to have a watchdog feed function call. Do you agree?

@ioannisg ioannisg added the Waiting for response Waiting for author's response label Jun 28, 2019
@jwu1980
Copy link
Author

jwu1980 commented Jun 28, 2019

Hi, @ioannisg ,

Thanks for the reply.
From the bug perspective, I didn't call wdt_setup() at all and the issue doesn't happen if I put a k_sleep(1000) in the while loop. If the issue is because user didn't feed the watchdog periodically, adding k_sleep(1000) should still cause WDT to reboot the board, right? The real root cause still needs to be found.

From user experience perspective, if the WDT is enabled by default and all users need to feed the WDT periodically in all applications, that will create a lot of problem and most of user will struggle the reboot issue because they are not aware of this detail.

I would suggest to disable the WDT by default before we root cause the real issue.

What do you think?

Thanks.

Best,

Larry

@dleach02 dleach02 added priority: low Low impact/importance bug and removed Waiting for response Waiting for author's response priority: medium Medium impact/importance bug labels Oct 15, 2019
@dleach02 dleach02 assigned ioannisg and unassigned aurel32 Oct 15, 2019
@mnkp
Copy link
Member

mnkp commented May 26, 2020

Initially #21142 and later #22859 enabled WDT_DISABLE_AT_BOOT option by default on all Atmel SAM boards. As a result the watchdog is disabled. The few sample applications that require watchdog to function explicitly set WDT_DISABLE_AT_BOOT to n. I'm closing this issue.

@mnkp mnkp closed this as completed May 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Watchdog Watchdog bug The issue is a bug, or the PR is fixing a bug platform: Microchip SAM Microchip SAM Platform (formerly Atmel SAM) priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

6 participants