Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
STM32 Timer Overview
STM32 timers are versatile and categorized as:
Image Not Showing
Possible Reasons
- The image was uploaded to a note which you don't have access to
- The note which the image was originally uploaded to has been deleted
Learn More →
Each timer has:
- Prescaler (PSC) – Divides input clock
- Auto-reload register (ARR) – Sets timer period
- Counter (CNT) – Current count value
- Interrupts – Triggered on overflow (update event)
Example: 1-Second Timer Interrupt (Using TIM2)
Objective:
Generate a 1 Hz interrupt using TIM2 on STM32 (assume 72 MHz system clock)
Steps:
1. Clock Configuration
Make sure TIM2 is enabled:
2. Configure Prescaler & ARR
3. Enable Interrupt and Start Timer
4. Interrupt Handler
Key Notes
- Timer clocks are on APB1/APB2, which may be prescaled – always check in CubeMX or reference manual.
- You can use STM32CubeIDE or HAL libraries to configure this with abstraction.