StarGate01 / p8b-infinitime

Run InfiniTime & Bootloader on the P8 smartwatch
MIT License
22 stars 3 forks source link
infinitime nrf52 nrf52832 p8-smartwatch pinetime smartwatch

InfiniTime on P8

This repository contains some slightly adjusted versions of the Infinitime application, bootloader and reloader (based on wasp-os), to run on the P8a and P8b (and of course, the PineTime as well) smartwatch.

P8a vs P8b

The P8b has a magnetic charging bay, with the two gold contacts in the center top. The P8a uses a charging clip, with the contacts in the center as well. The PineTime uses a magnetic charging bay, with the contacts shifted to one corner.

The (at least the one I have) P8b uses a different SPI flash chip. The bootloader is configured to accept a range of chips.

In addition, the touch driver is a bit different. The P8 touch driver cannot wake up from sleep mode, so instead the accelerometer is used to detect taps and double taps to wake up. The touch driver configuration set in the factory may also vary. A compile time variable is provided. See the file HardwareVariants.md for more info.

High-Resolution BLE Accelerometer

This firmware fork is able to broadcast the 12-bit accelerometer sensor data using a sampling rate of 200 Hz instead of 10 Hz. A companion Android app to read these values in real-time can be found here: https://github.com/StarGate01/PineTimeAcc .

LFCLK and missing LF crystals

The P8b watch comes without an external low frequency crystal. This is a problem, because precise timing is required for Bluetooth connections. However, the NRF52 can be configured to use its internal RC clock to generate the low frequency clock.

The wasp-os bootloader as well as the mcuboot bootloader are configured to use this LFRC source. Wasp-os uses the Nordic softdevice, which takes care of properly configuring and calibrating the LF RC source. Mcuboot does not perform any calibration, however it does not require Bluetooth at all.

Usage of the LFRC source in InfiniTime and its Nimble stack is now implemented with proper calibration in my p8b fork.

Download Binaries

If you don't want to compile the firmware yourself, you can download binaries on the release page.

Development Setup

Requirements for compilation:

If you use Nix, a flake.nix is provided.

Run scripts/init.sh to set up the repositories, do not clone this repo with all recursive submodules. This loads all the required submodules, and downloads the newt and python packages.

Compiling

Use the scripts in scripts/, run e.g. build_all.sh moy-ton5 to build all the firmware for the P8b watch. The Wasp reloader factory package will package the builds of mcuboot and the Infinitime minimal recovery loader.

All scripts accept either pinetime, the moy- designators, or p8 as the first argument (Default: pinetime). This argument configures the target hardware platform.

You can change the compile time parameters in build_infinitime.sh if your smartwatch has a different hardware configuration.

See the file HardwareVariants.md for detailed configuration options for different watches.

OTA Stock Upgrade Path:

Note: NRF connect sometimes seems to overload the connection, if it fails use another tool listed (or look at https://wiki.pine64.org/wiki/PineTime#Companion_Apps)

In general, sometimes the Bluetooth connection crashes, maybe due to interference. Just try again.

Do this at your own risk

Step 0

Step 1

Step 2

Step 3

Step 4

Step 5

Step 6

Step 7

Step 8

Step 9

Step 10

Step 11

SWD Flash Path:

Do this at your own risk

For OTA

For Development

TODO

Third-party modules & Thanks to