The firmware is bare-metal CMSIS (with a thin HAL bring-up shim retained from CubeMX) running on the STM32F303RE at 64 MHz from the HSI/2 × PLL — no external crystal required.
TIM1 update IRQ (5 kHz with PSC, 500 Hz with STAIR) → Pwm_TIM1_UpdateHandler dispatches to the active modulator. The active modulator owns all PWM CCR writes.
TIM6 (1 kHz) sets g_sense_pending. The main loop calls Sensing_Service() for the blocking bit-banged SPI reads — keeps the bit-banger out of interrupt context.
Main loop runs FSM_Run() — handles UART commands, services sensing, runs protection, manages state transitions, and emits the 20 Hz telemetry frame.