samples: task_wdt: Increase min watchdog timeout
MCUX watchdog timer supports min window of 500ms. Increase maximum task watchdog timeout window to 500ms by default, so that this sample can run on iMX RT SOCs. Also update iMX RT watchdog driver to reject timeout maximums under 500ms with a useful error message Fixes #40153 Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
This commit is contained in:
parent
e6d8296eaf
commit
41a63f48fd
2 changed files with 7 additions and 2 deletions
|
@ -13,7 +13,7 @@
|
||||||
#include <logging/log.h>
|
#include <logging/log.h>
|
||||||
LOG_MODULE_REGISTER(wdt_mcux_wdog);
|
LOG_MODULE_REGISTER(wdt_mcux_wdog);
|
||||||
|
|
||||||
#define WDOG_TMOUT_SEC(x) ((x * 2 / MSEC_PER_SEC) - 1)
|
#define WDOG_TMOUT_SEC(x) (((x * 2) / MSEC_PER_SEC) - 1)
|
||||||
|
|
||||||
struct mcux_wdog_config {
|
struct mcux_wdog_config {
|
||||||
WDOG_Type *base;
|
WDOG_Type *base;
|
||||||
|
@ -75,6 +75,11 @@ static int mcux_wdog_install_timeout(const struct device *dev,
|
||||||
WDOG_GetDefaultConfig(&data->wdog_config);
|
WDOG_GetDefaultConfig(&data->wdog_config);
|
||||||
data->wdog_config.interruptTimeValue = 0U;
|
data->wdog_config.interruptTimeValue = 0U;
|
||||||
|
|
||||||
|
if (cfg->window.max < (MSEC_PER_SEC / 2)) {
|
||||||
|
LOG_ERR("Invalid window max, shortest window is 500ms");
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
data->wdog_config.timeoutValue =
|
data->wdog_config.timeoutValue =
|
||||||
WDOG_TMOUT_SEC(cfg->window.max);
|
WDOG_TMOUT_SEC(cfg->window.max);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,6 @@ CONFIG_WDT_LOG_LEVEL_DBG=y
|
||||||
CONFIG_WDT_DISABLE_AT_BOOT=y
|
CONFIG_WDT_DISABLE_AT_BOOT=y
|
||||||
|
|
||||||
CONFIG_TASK_WDT=y
|
CONFIG_TASK_WDT=y
|
||||||
CONFIG_TASK_WDT_MIN_TIMEOUT=100
|
CONFIG_TASK_WDT_MIN_TIMEOUT=500
|
||||||
|
|
||||||
CONFIG_THREAD_NAME=y
|
CONFIG_THREAD_NAME=y
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue