Phantom

Works at -O0, Fails at -O2 Debug

Symptom

At -O0 the report reaches the terminal and PA5 pulses. At -O2, nothing arrives and PA5 never moves. This bench grades the -O2 build. The registers and bit fields are on the Datasheet tab.

Circuit

Block diagram: PS1 particle detector drives the PA0 pin of U1, an STM32F4, with a pulse about 100 ns wide per event, whose USART1 transmit line runs to a serial console and whose PA5 pin runs to a logic analyzer probe

Pass condition

The bench sends one burst of pulses on PA0 while your program runs. The burst ends once PA0 has been quiet for 5 ms. Within 15 ms of its last pulse, USART1 sends COUNT:<n> then LEVEL:<band>, and PA5 pulses once.

Expected output for a four-pulse burst: four 100 ns pulses on PA0, a quiet gap of 5 ms that ends the burst, then the lines COUNT colon 4 and LEVEL colon MEDIUM on the serial console within 15 ms of the last pulse, and after them one pulse on PA5

Notes

Bands by count: 1 to 2 LOW, 3 to 5 MEDIUM, 6 and up HIGH. The build refuses optimization pragmas and attributes.

Related challenges

Loading the interactive arena.