Odd timing on micro:bit (V1)

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
Post Reply
MicroGuy
Posts: 10
Joined: Sun Jan 17, 2021 8:31 pm

Odd timing on micro:bit (V1)

Post by MicroGuy » Fri May 14, 2021 5:57 pm

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 991 times
DS0001.jpg
DS0001.jpg (83.16 KiB) Viewed 991 times

Post Reply