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.
pull/4402/head
Laurent MEUNIER 2017-05-29 11:00:13 +02:00
parent 8576993a1a
commit eeb9672387
1 changed files with 1 additions and 1 deletions

View File

@ -101,7 +101,7 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
#if !TARGET_STM32L1
TimMasterHandle.Init.RepetitionCounter = 0;
#endif
#if TARGET_STM32F0||TARGET_STM32F7
#ifdef TIM_AUTORELOAD_PRELOAD_DISABLE
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
#endif
HAL_TIM_OC_Init(&TimMasterHandle);