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

Block diagram: SW1 start button drives PA0 and U2's fault output drives PA1 on U1, an STM32F4, whose PA5 enables the M1 motor driver and whose USART1 TX runs to a serial console at J1

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.

State diagram: IDLE moves to STARTING on a press, STARTING to RUNNING after 10 ms, RUNNING to STOPPING on a press, STOPPING back to IDLE after 10 ms, and PA1 rising takes any state to FAULT; each box carries its PA5 level

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.

Related challenges

Loading the interactive arena.