From ff70bd1197e581cc43d5a1880323e71676a4b30d Mon Sep 17 00:00:00 2001 From: Andrew Leech Date: Tue, 15 Aug 2023 15:29:15 +1000 Subject: [PATCH] stm32/timer: Fix deadtime config on Advanced Timer peripherals. Newer MCU series have additional fields in the struct which need to be initialised to zero, eg Break2AFMode on WB55. This work was funded by Planet Innovation. Signed-off-by: Andrew Leech --- ports/stm32/timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ports/stm32/timer.c b/ports/stm32/timer.c index b4fa1d6cf9..5319ae4ece 100644 --- a/ports/stm32/timer.c +++ b/ports/stm32/timer.c @@ -507,7 +507,7 @@ STATIC mp_int_t compute_ticks_from_dtg(uint32_t dtg) { } STATIC void config_deadtime(pyb_timer_obj_t *self, mp_int_t ticks, mp_int_t brk) { - TIM_BreakDeadTimeConfigTypeDef deadTimeConfig; + TIM_BreakDeadTimeConfigTypeDef deadTimeConfig = {0}; deadTimeConfig.OffStateRunMode = TIM_OSSR_DISABLE; deadTimeConfig.OffStateIDLEMode = TIM_OSSI_DISABLE; deadTimeConfig.LockLevel = TIM_LOCKLEVEL_OFF;