Skip to content

Instantly share code, notes, and snippets.

What would you like to do?

What is OpenOCD? Why Raspberry Pi and not ROCK64 or Nvidia Jetson Nano?

OpenOCD (Open On-Chip Debugger) is the open-source tool that we use to flash and debug PineTime.

OpenOCD runs on our Raspberry Pi and connects via GPIO Pins to the SWD (Serial Wire Debug) port of PineTime to perform flashing and debugging.

Because SWD is a serial protocol, OpenOCD needs to have very precise timing in order to control PineTime correctly. (More about SWD)

OpenOCD on Raspberry Pi uses the Broadcom GPIO driver to achieve precise timing. We can see this in the OpenOCD configuration file for Raspberry Pi: swd-pi.ocd

Other single-board computers like ROCK64 and Nvidia Jetson Nano don't run on the Broadcom microcontroller. So this OpenOCD configuration won't work.

OpenOCD works reliably on Raspberry Pi when there are no background tasks running, because OpenOCD uses timing-sensitive Bit-Banging to send data over the GPIO Pins. I recommend booting Raspberry Pi in Console mode and connecting to Pi via ssh to perform flashing...

ssh pi@raspberrypi.local

Disconnect the HDMI cable from the Pi while flashing, because updating the display requires computing power too.

Is it possible to implement the SWD protocol with Raspberry Pi's reliable Bidirectional SPI interface, instead of unreliable Bit-Banging GPIO?

Work in progress...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment