drivers: watchdog: stm32 iwdg starts with timeout install
It Follows the sequence to configure and launch the IWDG watchdog for the stm32 mcus Signed-off-by: Francois Ramu <francois.ramu@st.com>
This commit is contained in:
parent
b4e9ef0691
commit
c2db84ee8a
1 changed files with 3 additions and 4 deletions
|
@ -77,7 +77,7 @@ static void iwdg_stm32_convert_timeout(uint32_t timeout,
|
||||||
|
|
||||||
static int iwdg_stm32_setup(const struct device *dev, uint8_t options)
|
static int iwdg_stm32_setup(const struct device *dev, uint8_t options)
|
||||||
{
|
{
|
||||||
IWDG_TypeDef *iwdg = IWDG_STM32_STRUCT(dev);
|
ARG_UNUSED(dev);
|
||||||
|
|
||||||
/* Deactivate running when debugger is attached. */
|
/* Deactivate running when debugger is attached. */
|
||||||
if (options & WDT_OPT_PAUSE_HALTED_BY_DBG) {
|
if (options & WDT_OPT_PAUSE_HALTED_BY_DBG) {
|
||||||
|
@ -99,7 +99,7 @@ static int iwdg_stm32_setup(const struct device *dev, uint8_t options)
|
||||||
return -ENOTSUP;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
LL_IWDG_Enable(iwdg);
|
/* Enable the IWDG only when the timeout is installed */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,6 +134,7 @@ static int iwdg_stm32_install_timeout(const struct device *dev,
|
||||||
|
|
||||||
tickstart = k_uptime_get_32();
|
tickstart = k_uptime_get_32();
|
||||||
|
|
||||||
|
LL_IWDG_Enable(iwdg);
|
||||||
LL_IWDG_EnableWriteAccess(iwdg);
|
LL_IWDG_EnableWriteAccess(iwdg);
|
||||||
|
|
||||||
LL_IWDG_SetPrescaler(iwdg, prescaler);
|
LL_IWDG_SetPrescaler(iwdg, prescaler);
|
||||||
|
@ -172,12 +173,10 @@ static const struct wdt_driver_api iwdg_stm32_api = {
|
||||||
static int iwdg_stm32_init(const struct device *dev)
|
static int iwdg_stm32_init(const struct device *dev)
|
||||||
{
|
{
|
||||||
#ifndef CONFIG_WDT_DISABLE_AT_BOOT
|
#ifndef CONFIG_WDT_DISABLE_AT_BOOT
|
||||||
IWDG_TypeDef *iwdg = IWDG_STM32_STRUCT(dev);
|
|
||||||
struct wdt_timeout_cfg config = {
|
struct wdt_timeout_cfg config = {
|
||||||
.window.max = CONFIG_IWDG_STM32_INITIAL_TIMEOUT
|
.window.max = CONFIG_IWDG_STM32_INITIAL_TIMEOUT
|
||||||
};
|
};
|
||||||
|
|
||||||
LL_IWDG_Enable(iwdg);
|
|
||||||
iwdg_stm32_install_timeout(dev, &config);
|
iwdg_stm32_install_timeout(dev, &config);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue