PineTime DevKit

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

Interface Hardware Supported TinyGo Support
GPIO YES YES
UART YES YES
SPI YES YES
I2C YES YES
ADC YES YES
PWM YES YES
USBDevice NO NO

Pins

Pin Hardware pin Alternative names
LED1 P0_23 LED, LCD_BACKLIGHT_HIGH
LED2 P0_22 LCD_BACKLIGHT_MID
LED3 P0_14 LCD_BACKLIGHT_LOW
UART_TX_PIN P0_11
SPI0_SCK_PIN P0_02 LCD_SCK
SPI0_SDO_PIN P0_03 LCD_SDI
SPI0_SDI_PIN P0_04
SDA_PIN P0_06
SCL_PIN P0_07
BUTTON_IN P0_13
BUTTON_OUT P0_15
VIBRATOR_PIN P0_16
LCD_RS P0_18
LCD_CS P0_25
LCD_RESET P0_26

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 pin J-Link pin
SWDIO SWIO
SWDCLK CLK
3.3V VCC Vref
GND GND

If you get the following error:

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:

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:

tinygo flash -target=pinetime-devkit0 examples/blinky1