Crosstalk
STM32 Garbled Log Lines Debug
Symptom
A door logger prints numbered sample lines on its trace console, and an event line each time the door sensor pulses. Since the event lines were added, the log has broken lines: two lines run into one, digits go missing, and part of a line shows up twice.
Circuit
Pass condition
Every line is whole, sample N or event N. The samples run from sample 1 to sample 300 with none missing or repeated, and each pulse gives one event line, numbered from 1 in order. The core runs EXTI0_IRQHandler once for every pulse. Each test pulses the sensor a different number of times.
Notes
The sensor pulses PA0 high for 0.2 ms, at least 1 ms apart, while your program runs. Leave the trace setup and _write as they are. Your program is built and run at -O0, then again at -O2. Both builds must pass.