Firmware · UART
Printing debug messages on a slow serial link can disrupt the very timing you are trying to observe.