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

samples: driver: watchdog: Sample fails on disco_l475_iot1 #32376

Closed
hwilmers opened this issue Feb 16, 2021 · 4 comments · Fixed by #32387
Closed

samples: driver: watchdog: Sample fails on disco_l475_iot1 #32376

hwilmers opened this issue Feb 16, 2021 · 4 comments · Fixed by #32387
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@hwilmers
Copy link
Contributor

hwilmers commented Feb 16, 2021

Describe the bug
The sample app samples/driver/watchdog fails at runtime, sending an error message.
Tested using Zephyr 2.5.0 on disco_l475_iot1.

To Reproduce
Steps to reproduce the behavior:

  1. cd samples/driver/watchdog
  2. west build -b disco_l475_iot1
  3. west flash
  4. See error

Expected behavior
The expected behaviour of the app is to repeat following sequence:

  • initialise watchdog
  • feed the watchdog a few times
  • stop feeding, and wait for a watchdog reset

Impact
The watchdog is not functional.

Logs and console output
Console log:

*** Booting Zephyr OS build zephyr-v2.5.0 ***
Watchdog sample application
Attempting to test pre-reset callback
Watchdog install error

Environment (please complete the following information):

  • OS: Linux
  • Toolchain: zephyr 0.11.2
  • Zephyr Release 2.5.0
@hwilmers hwilmers added the bug The issue is a bug, or the PR is fixing a bug label Feb 16, 2021
@hwilmers
Copy link
Contributor Author

hwilmers commented Feb 16, 2021

Further debugging shows that wdt_install_timeout() returrns -EINVAL here, on line 112:

wdt_channel_id = wdt_install_timeout(wdt, &wdt_config);
if (wdt_channel_id == -ENOTSUP) {
/* IWDG driver for STM32 doesn't support callback */
printk("Callback support rejected, continuing anyway\n");
wdt_config.callback = NULL;
wdt_channel_id = wdt_install_timeout(wdt, &wdt_config);
}
if (wdt_channel_id < 0) {
printk("Watchdog install error\n");

@hwilmers
Copy link
Contributor Author

hwilmers commented Feb 16, 2021

In the driver, at the attempt of setting timeout to 100ms, here the calculated timeout is set to 26214us:

calculated_timeout = wwdg_stm32_get_timeout(dev, prescaler, counter);

Is this the max timeout achievable with this MCU? Or is there a calculation error somewhere?

@hwilmers
Copy link
Contributor Author

hwilmers commented Feb 16, 2021

When using the IWDG, the sample works with the timeout values used in the sample.

This opens up for two possible workarounds:

  • remove the overlay file boards/disco_l475_iot1.overlay, so the default IWDG is used instead of WWDG
  • if WWDG shall be used, set WDT_MAX_WINDOW to a value <= 26

@erwango
Copy link
Member

erwango commented Feb 17, 2021

@hwilmers Thanks for reporting. Actually the wwdg test should run with APB bu clock tunning: CONFIG_CLOCK_STM32_APB1_PRESCALER=16
Problem is that tunning is provided in sample.yaml file and then only applied when running twister.

I'll modify so this is available even when run with west.

erwango added a commit to erwango/zephyr that referenced this issue Feb 17, 2021
A different configuration is applied when running this test
using west or using twister.
Both will use the disco_l475_iot1 overlay, but the extra config
for clock bus tunning is applied only when using twister and
samples is failed when run with west.
Move this extra config from sample.yaml to board .conf file so
it is applied in both cases.

Fixes zephyrproject-rtos#32376

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
@nashif nashif added the priority: low Low impact/importance bug label Feb 17, 2021
galak pushed a commit that referenced this issue Feb 19, 2021
A different configuration is applied when running this test
using west or using twister.
Both will use the disco_l475_iot1 overlay, but the extra config
for clock bus tunning is applied only when using twister and
samples is failed when run with west.
Move this extra config from sample.yaml to board .conf file so
it is applied in both cases.

Fixes #32376

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
zephyrbot pushed a commit that referenced this issue Feb 19, 2021
A different configuration is applied when running this test
using west or using twister.
Both will use the disco_l475_iot1 overlay, but the extra config
for clock bus tunning is applied only when using twister and
samples is failed when run with west.
Move this extra config from sample.yaml to board .conf file so
it is applied in both cases.

Fixes #32376

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
nashif pushed a commit that referenced this issue Feb 24, 2021
A different configuration is applied when running this test
using west or using twister.
Both will use the disco_l475_iot1 overlay, but the extra config
for clock bus tunning is applied only when using twister and
samples is failed when run with west.
Move this extra config from sample.yaml to board .conf file so
it is applied in both cases.

Fixes #32376

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants