Automaton
State Machine Fault Reported Late Debug
Symptom
The fault line rose halfway through spin-up, but the log still shows STATE:RUNNING. PA5 goes high before STATE:FAULT. The registers and bit fields are on the Datasheet tab.
Circuit
Pass condition
Entering a state prints STATE:<name> on USART1, and PA5 is high only in RUNNING. In any state, STATE:FAULT is logged within 2 ms of PA1 rising.
Notes
The bench presses START on PA0 and raises the driver's FLT on PA1 while the program runs. Keep the machine running for as long as the board runs. Spin-up and spin-down each take 10 ms. A press during either is ignored. USART1 runs at 9600 baud: BRR = 0x683.