Metronome
Configure TIM2 for a 1kHz periodic interrupt on the STM32F4.
Your firmware should:
- Enable TIM2 clock (RCC APB1ENR, bit 0)
- Set the prescaler (PSC) so the timer ticks at 1MHz (16MHz / 16 = 1MHz)
- Set the auto-reload (ARR) for 1kHz overflow (1000 ticks)
- Enable the timer (CR1 bit 0 = CEN)
After your firmware runs, we inspect the TIM2 registers directly, like probing a real chip with a debugger. This is a state-inspection challenge: correctness is judged by register values, not GPIO output.
Key concepts:
- Timer clock tree and prescaler math
- Auto-reload register for period control
- Timer enable bit (CEN)