zephyr/drivers/watchdog/Kconfig.stm32
Martin Jäger 916dd0f6c4 drivers: watchdog: iwdg_stm32: Fix timeout calculation
CONFIG_IWDG_STM32_TIMEOUT allowed values of 100 us for initial watchdog
timeout, which was actually rounded to zero in the driver, which uses
milliseconds resolution for timeouts. This resulted in the reload value
being set to maximum possible (calculation: 0U - 1).

This commit updates the calculation of timeout minimum and maximum
values considering the actual LSI frequency of the used MCU.

As the resolution of CONFIG_IWDG_STM32_TIMEOUT in microseconds doesn't
make sense if the driver supports only milliseconds, it is renamed to
IWDG_STM32_INITIAL_TIMEOUT (this prevents accidental wrong settings in
existing firmware) and the unit is changed to ms.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-12-04 23:09:42 -05:00

35 lines
1.0 KiB
Plaintext

# STM32 IWDG configuration
# Copyright (c) 2016 Open-RnD Sp. z o.o.
# Copyright (c) 2017 RnDity Sp. z o.o.
# Copyright (c) 2019 Centaur Analytics, Inc
# SPDX-License-Identifier: Apache-2.0
menuconfig IWDG_STM32
bool "Independent Watchdog (IWDG) Driver for STM32 family of MCUs"
depends on SOC_FAMILY_STM32
help
Enable IWDG driver for STM32 line of MCUs
config IWDG_STM32_INITIAL_TIMEOUT
int "Value for IWDG timeout in ms"
depends on IWDG_STM32
default 100
range 1 26214
help
Set initial timeout value for IWDG in ms if enabled at boot.
The min timeout supported is 1 ms. The max timeout depends on the
MCU's LSI clock frequency and can be calculated with:
max. prescaler value (256) * max. reload ticks (4096) / LSI freq.
Limiting maximum timeout to a safe value of 26214 ms here, which was
calculated for highest LSI frequency among STM32 MCUs of 40 kHz.
config WWDG_STM32
bool "System Window Watchdog (WWDG) Driver for STM32 family of MCUs"
depends on SOC_FAMILY_STM32
help
Enable WWDG driver for STM32 line of MCUs