Go to file
JF 3c29a11c78 Fix link error because of missing file "nrf_common.ld" 2020-01-12 16:26:20 +07:00
cmake-nRF5x Improve power consumption and SLEEP mode : 2020-01-05 11:09:07 +07:00
doc Add documentation about building a stub using NRF52-DK. 2020-01-02 15:19:28 +07:00
images Add documentation about building a stub using NRF52-DK. 2020-01-02 15:19:28 +07:00
src Fix link error because of missing file "nrf_common.ld" 2020-01-12 16:26:20 +07:00
CMakeLists.txt Fix typo in main CMakeLists.txt file. 2020-01-05 19:55:01 +07:00
README.md Update doc (current state about touch panel) 2020-01-03 16:35:34 +07:00
gcc_nrf52.ld Fix link error because of missing file "nrf_common.ld" 2020-01-12 16:26:20 +07:00
nrf_common.ld Fix link error because of missing file "nrf_common.ld" 2020-01-12 16:26:20 +07:00

README.md

PineTime

The PineTime is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery as well as a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project, which means that it will ultimately be up to the developers and end-users to determine when they deem the PineTime ready to ship.

We envision the PineTime as a companion for not only your PinePhone but also for your favorite devices — any phone, tablet, or even PC.

https://www.pine64.org/pinetime/

The goal of this project is to build a firmware designed for the PineTime around FreeRTOS. It's coded using a mix of C and C++ : the NRF52-SDK and FreeRTOS are written in C, but I prefer to write my own code in C++.

Please NOTE : for now, this project is in heavy development state. Feel free to use it, contribute to it or fork it !

This project is based on https://github.com/JF002/nrf52-baseproject. It's a CMake project that configure everything needed to build applications for the PineTime (https://wiki.pine64.org/index.php/PineTime).

I tested this project (compile only) with the following versions:

I've tested this project on the actual PineTime hardware.

Current state

Pinetime

  • Project builds and runs on the Pinetime;
  • Logs available via JLink RTT;
  • Basic (but faster) LCD driver.
  • One big font to display the time (hours : minutes)
  • BLE advertising, connection and bonding
  • BLE CTS client (retrieves the time from the connected device if it implements a CTS server)
  • Push button to go to disable screen (and go to low power mode) / enable screen (and wake-up). NOTE : I'm not completely sure the power consumption is optimal, especially in sleep mode. Any help to measure and debug this is welcome.
  • Touch panel : wake up when sleeping and draw square on screen when running

Stub using NRF52-DL

Pinetime stub

See this page

How to build

  • Download and unzip arm-none-eabi and NRF52 SDK

  • Clone this repo

  • Call CMake with the following command line argument

    • -DARM_NONE_EABI_TOOLCHAIN_PATH=[Path to the toolchain]
    • -DNRF5_SDK_PATH=[Path to the SDK]
    • -DNRFJPROG=[Path to NRFJProg]
$ mkdir build
$ cd build
$ cmake -DCMAKE_BUILD_TYPE=Debug -DARM_NONE_EABI_TOOLCHAIN_PATH=... -DNRF5_SDK_PATH=... -DNRFJPROG=... ../
  • Make
$ make -j

RTT

RTT is a feature from Segger's JLink devices that allows bidirectionnal communication between the debugger and the target. This feature can be used to get the logs from the embedded software on the development computer.

  • Program the MCU with the code (see above)
  • Start JLinkExe
$ JLinkExe -device nrf52 -if swd -speed 4000 -autoconnect 1
  • Start JLinkRTTClient
$ JLinkRTTClient

Tools

BLE connection, bonding and time synchronization

At runtime, BLE advertising is started. You can then use a smartphone or computer to connect and bond to your Pinetime. As soon as a device is bonded, Pinetime will look for a CTS server (Current Time Service) on the connected device.

Here is how to do it with an Android smartphone running NRFConnect:

  • Build and program the firmware on the Pinetime
  • Install NRFConnect (https://www.nordicsemi.com/Software-and-Tools/Development-Tools/nRF-Connect-for-desktop)
  • Start NRFConnect and create a CTS server :
    • Tap the hamburger button on the top left and select "Configure GATT server"
    • Tap "Add service" on the bottom
    • Select server configuration "Current Time Service" and tap OK
  • Go back to the main screen and scan for BLE devices. A device called "PineTime" should appear
  • Tap the button "Connect" next to the PineTime device. It should connect to the PineTime and switch to a new tab.
  • On this tab, on the top right, there is a 3 dots button. Tap on it and select Bond. The bonding process begins, and if it is sucessful, the PineTime should update its time and display it on the screen.