Skip to content

Commit f892ae7

Browse files
committed
Add watchdog clock accuracy to STM targets.
1 parent 82e5952 commit f892ae7

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

targets/TARGET_STM/watchdog_api.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,24 @@ watchdog_features_t hal_watchdog_get_platform_features(void)
123123
features.max_timeout = MAX_TIMEOUT_MS;
124124
features.update_config = true;
125125
features.disable_watchdog = false;
126+
127+
/* STM32 IWDG (Independent Watchdog) is clocked by its own dedicated low-speed clock (LSI) */
128+
features.clock_typical_frequency = LSI_VALUE;
129+
130+
/* See LSI oscillator characteristics in Data Sheet */
131+
#if defined(STM32F1)
132+
features.clock_max_frequency = 60000;
133+
#elif defined(STM32L0) || defined(STM32L1)
134+
features.clock_max_frequency = 56000;
135+
#elif defined(STM32F2) || defined(STM32F4) || defined(STM32F7)
136+
features.clock_max_frequency = 47000;
137+
#elif defined(STM32F0) || defined(STM32F3)
138+
features.clock_max_frequency = 50000;
139+
#elif defined(STM32H7) || defined(STM32L4) || defined(STM32WB)
140+
features.clock_max_frequency = 33600;
141+
#else
142+
#error "unsupported target"
143+
#endif
126144

127145
return features;
128146
}

0 commit comments

Comments
 (0)