Getting Started with STM32 and Nucleo Part 6: Timers and Timer Interrupts | Digi-Key Electronics

In this tutorial, Shawn shows you how to set up timers in STM32 and use those timers to measure execution time, create non-blocking code, and trigger interrupts. If you are not familiar with STM32CubeIDE, we recommend watching this video first: We first cover the basics of timers in STM32. A timer is a piece of hardware in the microcontroller that continually increments a stored value each clock pulse it receives. Most general purpose timers in microcontrollers are connected to the main CPU clock through one or more prescalers. A prescaler acts to divide the cock. For example, an 80 MHz clock that goes through a prescaler of 80 would cause a timer to increment (tick) at a rate of 1 MHz. These timers can be used to trigger interrupts to run arbitrary code at given intervals, measure the time between events, or automatically control hardware, as in the case of output compare and pulse width modulation (PWM). We show you how to configure a timer using STM32CubeIDE
Back to Top