EasyManua.ls Logo

ST STM32F31xx

ST STM32F31xx
584 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
General-purpose timers (TIM)
UM1581
456/584
DocID023800 Rev 1
Autoreload value = 0xFFFF
Prescaler value = 0x0000
Counter mode = Up counting
Clock Division = TIM_CKD_DIV1
4. Fill the TIM_ICInitStruct with the desired parameters including:
TIM Channel: TIM_Channel
TIM Input Capture polarity: TIM_ICPolarity
TIM Input Capture selection: TIM_ICSelection
TIM Input Capture Prescaler: TIM_ICPrescaler
TIM Input CApture filter value: TIM_ICFilter
5. Call TIM_ICInit(TIMx, &TIM_ICInitStruct) to configure the desired channel with the
corresponding configuration and to measure only frequency or duty cycle of the input
signal, or, Call TIM_PWMIConfig(TIMx, &TIM_ICInitStruct) to configure the desired
channels with the corresponding configuration and to measure the frequency and the
duty cycle of the input signal
6. Enable the NVIC or the DMA to read the measured frequency.
7. Enable the corresponding interrupt (or DMA request) to read the Captured value,
using the function TIM_ITConfig(TIMx, TIM_IT_CCx) (or TIM_DMA_Cmd(TIMx,
TIM_DMA_CCx))
8. Call the TIM_Cmd(ENABLE) function to enable the TIM counter.
9. Use TIM_GetCapturex(TIMx); to read the captured value.
All other functions can be used separately to modify, if needed, a specific feature
of the Timer.
TIM_ICInit()
TIM_ICStructInit()
TIM_PWMIConfig()
TIM_GetCapture1()
TIM_GetCapture2()
TIM_GetCapture3()
TIM_GetCapture4()
TIM_SetIC1Prescaler()
TIM_SetIC2Prescaler()
TIM_SetIC3Prescaler()
TIM_SetIC4Prescaler()
22.2.5 Advanced-control timers (TIM1 and TIM8) specific features
TIM Driver: how to use the Break feature
After configuring the Timer channel(s) in the appropriate Output Compare mode:
1. Fill the TIM_BDTRInitStruct with the desired parameters for the Timer Break Polarity,
dead time, Lock level, the OSSI/OSSR State and the AOE(automatic output enable).
2. Call TIM_BDTRConfig(TIMx, &TIM_BDTRInitStruct) to configure the Timer
3. Enable the Main Output using TIM_CtrlPWMOutputs(TIM1, ENABLE)
4. Once the break even occurs, the Timer's output signals are put in reset state or in a
known state (according to the configuration made in TIM_BDTRConfig() function).
TIM_BDTRConfig()
TIM_Break1Config()

Table of Contents

Related product manuals