The stm32 series CPU has up to 8 timers;
1. Among them, tmi1 and tim8 are advanced timers that can generate three pairs of PWM complementary outputs, which are commonly used in the drive of Three-Phase Motors. Their clock is generated by apb2 output;
2. The other six are common timers, and the clock is generated by the apb1 output;
Timer function:
1. Timing function 2. Counting Function 3. Input capture 4. Matching output 5. PWM pulse wave output
Overview:
A universal timer is a 16-bit automatic loading counter driven by a programmable predivider. It is suitable for various scenarios, including measuring the pulse length of an input signal (input collection) or generating an output waveform (output comparison and pwm ).
The timer is completely independent and does not share any resources with each other. They can be synchronized together;
Note: As long as the default database configuration method is used to configure the clock to 72 m, whether tim1 or timx, their counting frequency is 72 m;
Main features
Common timx timer features include:
?? The counter is automatically loaded up, down, and up/down in 16 bits.
?? 16-bit programmable pre-divider. The frequency division coefficient of the counter clock frequency is 1 ~ Any value between 65535
?? Four independent channels:
-Input capture
-Output comparison
-PWM generation (edge or intermediate alignment Mode)
-Single pulse mode output
?? Use an external signal to control the Synchronization Circuit of the timer and the timer.
?? The following events may interrupt/DMA:
-Update: the counter overflows up/down, and the counter is initialized (triggered by software or internal/external)
-Trigger event (counter start, stop, initialization, or internal/external trigger count)
-Input capture
-Output comparison
// To be continued .....
Universal timer Tim for stm32