Skip to content

Commit eeb9672

Browse files
committed
STM32: Check TIM_AUTORELOAD_PRELOAD_DISABLE
F2 family also require that TIM_AUTORELOAD_PRELOAD_DISABLE is set, otherwise the field could have undefined value from the stacj and may lead to undefined behavior. The error was found using USE_FULL_ASSERT HAL option. Rather than adding F2 to the list of family, let's set this parameter for any family where TIM_AUTORELOAD_PRELOAD_DISABLE applies.
1 parent 8576993 commit eeb9672

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
101101
#if !TARGET_STM32L1
102102
TimMasterHandle.Init.RepetitionCounter = 0;
103103
#endif
104-
#if TARGET_STM32F0||TARGET_STM32F7
104+
#ifdef TIM_AUTORELOAD_PRELOAD_DISABLE
105105
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
106106
#endif
107107
HAL_TIM_OC_Init(&TimMasterHandle);

0 commit comments

Comments
 (0)