Skip to content

Commit b15fc6a

Browse files
committed
STM32: TIM: Initialize new TIM parameter
1 parent cdcaf2a commit b15fc6a

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

targets/TARGET_STM/hal_tick_16b.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
118118
TimMasterHandle.Init.Prescaler = (uint32_t)(SystemCoreClock / 1000000) - 1; // 1 us tick
119119
TimMasterHandle.Init.ClockDivision = 0;
120120
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
121+
#ifdef TARGET_STM32F0
122+
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
123+
#endif
121124
HAL_TIM_Base_Init(&TimMasterHandle);
122125

123126
// Configure output compare channel 1 for mbed timeout (enabled later when used)

targets/TARGET_STM/hal_tick_32b.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,9 @@ HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
9999
TimMasterHandle.Init.CounterMode = TIM_COUNTERMODE_UP;
100100
#if !TARGET_STM32L1
101101
TimMasterHandle.Init.RepetitionCounter = 0;
102+
#endif
103+
#ifdef TARGET_STM32F0
104+
TimMasterHandle.Init.AutoReloadPreload = TIM_AUTORELOAD_PRELOAD_DISABLE;
102105
#endif
103106
HAL_TIM_OC_Init(&TimMasterHandle);
104107

0 commit comments

Comments
 (0)