1. References
"STM32F1 Development Guide - Library Function Version" - Chapter 13, 14, 15
"STM32 Chinese Reference Manual V10" - Chapter 14 General Timer
2. Overview of General Timer
STM32 timer
Differences between three STM32 timers
·General timer function features description
The general TIMx (TIM2, TIM3, TIM4 and TIM5) timer features of STM32 include:
Located on the low-speed APB1 bus (APB1)
16-bit up, down, up/down (center-aligned) counting modes with auto-reload counter (TIMx_CNT).
16-bit programmable (can be modified in real time) prescaler (TIMx_PSC), the counter clock frequency division factor is any value between 1 and 65535.
4 independent channels (TIMx_CH1~4), which can be used as:
① Input capture
② Output comparison
③PWM generation (edge or center aligned mode)
④Single pulse mode output
· Synchronous circuits that can use external signals (TIMx_ETR) to control timers and timer interconnections (one timer can be used to control another timer).
Generate interrupts/DMA on the following events (6 independent IRQ/DMA request generators):
① Update: counter overflow/underflow, counter initialization (by software or internal/external trigger)
②Trigger event (counter start, stop, initialization or internal/external trigger counting)
③ Input capture
④ Output comparison
⑤Support incremental (orthogonal) encoder and Hall sensor circuits for positioning
⑥Trigger input as external clock or cycle-by-cycle current management
The general-purpose timer of STM32 can be used to measure the pulse length of the input signal (input capture) or generate output waveforms (output comparison and PWM), etc.
·Using the timer prescaler and RCC clock controller prescaler, the pulse length and waveform period can be adjusted from a few microseconds to a few milliseconds. Each general-purpose timer of STM32 is completely independent and does not share any resources with each other.
Counter mode
The general timer can count up, count down, and count in both up and down bidirectional modes.
① Up counting mode: The counter starts counting down from the automatically loaded value (TIMx_ARR) to 0, then starts counting again from 0 and generates a counter overflow event.
② Down counting mode: The counter starts counting down from the automatically loaded value (TIMx_ARR) to 0, then restarts from the automatically loaded value and generates a counter underflow event.
③ Center-aligned mode (up/down counting): The counter starts counting from 0 to the automatically loaded value -1, generates a counter overflow event, then counts down to 1 and generates a counter
Overflow event; then restart the count from 0.
·General timer working process
Count clock selection
Time base unit
Update events
·Capture comparison array introduction
Input capture mode
PWM mode
Previous article:STM32 timer interrupt experiment-TIM3
Next article:STM32 clock system review
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- EEWORLD University Hall----mmWave sensors improve artificial intelligence algorithms to use elevators more efficiently
- Nuvoton Solution Sharing: IoT Development Based on NUC472 Development Board and Connected to Gizwits
- [Project Source Code] Altera SOPC FrameBuffer System Design Tutorial
- What is FRAM?
- Can 1N4007 be used to isolate 220V mains?
- W5500 TCP Client Network Debug Assistant cannot connect
- Analog circuits are much more difficult to learn than digital circuits. China’s real weak spot is actually analog chips.
- DIY a server for 5 dollars?
- [Project source code] AHT10 temperature and humidity sensor experiment based on FPGA
- Transformer and Inductor Design Handbook (4th Edition)