General-purpose timers (TIM)
ï€ Select Hall Sensor
9. TIM specific remapping management includes the Remapping configuration of
specific timers
22.2.3 TimeBase management functions
TIM Driver: how to use it in Timing(Time base) Mode
To use the Timer in Timing(Time base) mode, the following steps are mandatory:
1. Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx,
ENABLE) function
2. Fill the TIM_TimeBaseInitStruct with the desired parameters.
3. Call TIM_TimeBaseInit(TIMx, &TIM_TimeBaseInitStruct) to configure the Time Base
unit with the corresponding configuration
4. Enable the NVIC if you need to generate the update interrupt.
5. Enable the corresponding interrupt using the function TIM_ITConfig(TIMx,
TIM_IT_Update)
6. Call the TIM_Cmd(ENABLE) function to enable the TIM counter.
All other functions can be used separately to modify, if needed, a specific feature
of the Timer.
ï‚· TIM_DeInit()
ï‚· TIM_TimeBaseInit()
ï‚· TIM_TimeBaseStructInit()
ï‚· TIM_PrescalerConfig()
ï‚· TIM_CounterModeConfig()
ï‚· TIM_SetCounter()
ï‚· TIM_SetAutoreload()
ï‚· TIM_GetCounter()
ï‚· TIM_GetPrescaler()
ï‚· TIM_UpdateDisableConfig()
ï‚· TIM_UpdateRequestConfig()
ï‚· TIM_UIFRemap()
ï‚· TIM_ARRPreloadConfig()
ï‚· TIM_SelectOnePulseMode()
ï‚· TIM_SetClockDivision()
ï‚· TIM_Cmd()
22.2.4 Input Capture management functions
TIM Driver: how to use it in Input Capture Mode
To use the Timer in Input Capture mode, the following steps are mandatory:
1. Enable TIM clock using RCC_APBxPeriphClockCmd(RCC_APBxPeriph_TIMx,
ENABLE) function
2. Configure the TIM pins by configuring the corresponding GPIO pins
3. Configure the Time base unit as described in the first part of this driver, if needed,
else the Timer will run with the default configuration: