You set two registers, the prescaler (PSC) and the auto-reload (ARR), so that the timer's input clock divided by both equals your target rate: f_update = f_clk / ((PSC+1) * (ARR+1)). The prescaler divides the input clock down to a convenient counter tick rate, and the auto-reload sets how many of those ticks make one period before the counter wraps and raises an update event. For example, to get a 1 kHz interrupt from a 72 MHz timer clock you might set PSC = 7199 (dividing to a 10 kHz counter) and ARR = 9 (wrapping every 10 ticks = 1 ms). Then you enable the update interrupt (UIE in DIER), enable the counter (CEN in CR1), and in the ISR clear the update flag (UIF) before doing the periodic work. The two non-obvious parts are the +1 on each divider and using the actual timer clock (which on STM32 may be doubled relative to its APB bus). Choosing PSC vs ARR is a tradeoff: a larger prescaler gives coarser resolution but longer reach for a 16-bit counter.
Embedded Systems Fundamentals · Interview question
How do you configure a timer to interrupt at a specific frequency?
A strong answer
What a weak answer sounds like
You know the answer. Do you know what gets you dinged?
Pro breaks down the answer most candidates actually give to this question — and the specific reason an interviewer marks it down. It’s the difference between sounding correct and sounding senior, on all 472 questions.
From the lesson
Timers & Counters
Count clock ticks to make precise time: prescaler and auto-reload set the period, and output-compare/input-capture modes generate and measure waveforms, with no CPU delay loops.