PineTime

The PineTime is a smartwatch by Pine64 that is based on the Nordic Semiconductor nRF52832 SoC. As of October 2019, a limited amount has been produced for developers.

Interfaces

InterfaceHardware SupportedTinyGo Support
GPIOYESYES
UARTYESYES
SPIYESYES
I2CYESYES
ADCYESYES
PWMYESYES

Machine Package Docs

Documentation for the machine package for the PineTime

Flashing

The PineTime comes with some (proprietary?) default firmware and has the flash locked. This means that to flash this smartwatch, the chip must be unlocked (which erases all flash). There are two options for that, OpenOCD or nrfjprog.

Make sure to connect the SWD and power pins. For example, if you’re using the J-Link EDU Mini, connect the following pins:

PineTime pinJ-Link pin
SWDIOSWIO
SWDCLKCLK
3.3V VCCVref
GNDGND

If you get the following error:

  1. Error: Could not find MEM-AP to control the core

it means the chip is locked. See below for how to unlock and erase it.

Unlock chip using nrfjprog

If you have nrfjprog installed, you can easily unlock the chip using the following command:

  1. nrfjprog -f nrf52 --recover

You can find how to install nrfjprog in the documentation for the pca10040 board.

Unlock chip using OpenOCD

Recent OpenOCD versions support unlocking/erasing the flash. Unfortunately, it isn’t supported by OpenOCD 0.10, which is (as of October 2019) included in most Linux distributions. So you’ll have to compile OpenOCD from source and use that. See this StackOverflow answer for more details.

After unlocking, you can use a regular OpenOCD version (like 0.10) for flashing.

Flash a new program

See above for how to connect the PineTime to your computer. When it is connected, you can flash programs to it. For example, to blink the LCD backlight:

  1. tinygo flash -target=pinetime-devkit0 examples/blinky1