Page 1 of 1

Odd timing on micro:bit (V1)

Posted: Fri May 14, 2021 5:57 pm
by MicroGuy
I created a short program to toggle pin 16 on a V1 board every 10 milliseconds (10,000 usec) to test timing accuracy:

while True:
pins.digital_write_pin(DigitalPin.P16, 1)
control.wait_micros(10000)
pins.digital_write_pin(DigitalPin.P16, 0)
control.wait_micros(10000)

A scope trace of the output signal on pin 16 often includes shortened logic-0 and shortened logic-1 periods. The attached images show the results and the scope cursors isolate the pulse measurements for a logic-0 period. Any ideas why the micro:bit does this to what should be a square-wave output?
DS0002.jpg
DS0002.jpg (88.37 KiB) Viewed 8931 times
DS0001.jpg
DS0001.jpg (83.16 KiB) Viewed 8931 times