Conductor

STM32 Timer Interrupt Exercise

Task

Bring up TIM2 to update every 1 ms and TIM3 every 4 ms. Count each in TIM2_IRQHandler (IRQ 28) and TIM3_IRQHandler (IRQ 29) while the board runs. The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: SW1 snapshot button from +3V3 into U1 STM32F4 pin PA0, R1 pulling PA0 to ground while the button is open, TIM2 and TIM3 inside U1 fed by one 16 MHz timer clock, and pin PA9 carrying the USART1 report to TP1, a serial monitor

Pass condition

The bench may raise PA0. If PA0 rises -> print both counts at once, T2 first. Until then -> print nothing.

Expected output: TIM2 updates every millisecond and TIM3 every fourth millisecond from reset; when PA0 rises the serial monitor prints two lines, T2 and T3, each the number of updates that timer made before the edge

Notes

The given code sets up USART1, and the timers are yours.

Related challenges

Loading the interactive arena.