Git Product home page Git Product logo

p8b-infinitime's Introduction

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:

  • Linux
  • GCC, Build-essentials, Git, Bash, Wget, Unzip
  • ARM Cortex toolchain
  • NRF52 tools
  • Apache Mynewt Newt
  • CMake
  • Python3 + Pip3

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

  • State: Stock P8b (Stock)
  • Take a note of your stock firmware identification string. E.g. something like MOY-TFK5-1.7.7. This will not be available after overwriting the bootloader, however knowing it will be useful later when picking the right InfiniTime build, and/or will be useful if your watch is a new variant that we have not seen yet. See also the file HardwareVariants.md to figure out which build is right for you.

Step 1

  • State: Stock P8b (Stock)
  • Process: DFU update using DaFlasher
  • Payload: DaFlasherFiles/DaFitBootloader23Hacked.bin

Step 2

  • State: Hacked Bootloader (Three colorful squares)
  • Process: DFU update using DaFlasher or NrfConnect
  • Payload: DaFlasherFiles/FitBootloaderDFU2.0.1.zip

Step 3

  • State: Fit Bootloader (One square)
  • Process: DFU update using DaFlasher or NrfConnect
  • Payload: wasp-os/build-p8/bootloader-daflasher.zip (P8b variant)

Step 4

  • State: Wasp-OS Bootloader (Wasp image)
  • Process: DFU update using dfu.py (scripts/load_wasp_reloader.sh p8) or NrfConnect (or DaFlasher?)
  • Payload: wasp-os/build-p8/reloader-factory.zip (P8b variant w/ mcuboot & Infinitime recovery loader)

Step 5

  • State: Wasp-OS Reloader (Small pinecone)
  • Process: Wait for internal flash overwrite (pinecone turns red), then reboot by pressing button long, or it reboots automatically

Step 6

  • State: MCUBoot Bootloader (Big pinecone V1.0.0)
  • Process: Wait for bootloader to boot recovery installer

Step 7

  • State: Infinitime recovery installer (Triangle with progress bar)
  • Process: Wait for external flash to be written (progress bar). Reboots automatically

Step 8

  • State: MCUBoot Bootloader
  • Process: Press button until big pinecone is red. Bootloader then installs recovery image. Wait for reboot.

Step 9

  • State: Infinitime recovery (Triangle without progress bar)
  • Process: DFU update using dfu.py (scripts/load_infinitime.sh) or NRFConnect or GadgetBridge (or DaFlasher?)
  • Payload: InfiniTime/build/src/pinetime-mcuboot-app-dfu-1.8.0.zip

Step 10

  • State: MCUBoot Bootloader
  • Process: Press button until pinecone turns blue, this loads the main app.

Step 11

  • State: Infinitime Application (Watchface)
  • Process: Verify firmware works, and then confirm firmware valid in settings. (Important, otherwise bootloader reverts to recovery)

SWD Flash Path:

Do this at your own risk

For OTA

  • State: Broken or empty
  • Process: Open watch, flash using SWD, eg. J-Link, then continue from wasp-bootloader
  • Payload: wasp-os/build-p8/bootloader.hex (P8b variant)

For Development

  • State: Development on InfiniTime
  • Process: Open watch, flash using SWD, eg. J-Link
  • Payload: InfiniTime/build/src/pinetime-app-1.8.0.hex (P8b variant without bootloader)

TODO

  • Verify OTA process on sealed watch done
  • Verify drivers on genuine Pinetime done
  • Use LFRC clock instead of SYNT on variants without external LF crystal done
  • Verify acceleration sensor done
  • Update mcuboot to latest done
  • Fix wake from sleep done
  • Update Infinitime to latest (requires touch driver improvements) done
  • Test and adjust to P8a watch done
  • Implement tap to wake on P8a workaround
  • Upstream changes to InfiniTime (WIP: InfiniTimeOrg/InfiniTime#1050)

Third-party modules & Thanks to

p8b-infinitime's People

Contributors

purdeaandrei avatar stargate01 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

p8b-infinitime's Issues

MOY-TON5-2.04 seen watch working when using MOY-UNK2 / version 1.12?

Hi there,
maybe this helps others: When I used the binary release MOY_TON5 or compiled p8b-infinitime for MOY_TON5, my watch startet, everything seemed normal and I could swipe through screens, but every tap was just ignored, so I couldn't start any app.
After I gave the MOY_UNK2 a try, everything just works, binary and my build!

Another thing is: I tried to compile the Inifnitime 1.12 main release for MOY-TON5 and MOY-UNK (same compiler version, same nRFsdk), but I get the errors:
<command-line>: error: ISO C++11 requires whitespace after the macro name [-Werror]
If I let ignore these errors, I can build and flash the pinetime-mcu-boot-app. The start screen is visible for a few seconds, but then it just reboots to the previous firmware.
Is anyone using 1.12 version with a p8b?

P8B Display Flipped

Have flashed your zip as I'm not sure the state of the PRs into the standard Infinitime release. I believe I have a p8b based on magnetic charger. Ordered recently from Aliexpress and the stock firmware worked okay.

Everything seems to be working except ... the display is flipped left-to-right. Same behaviour was seen in the bootloader.

20220622_204727

I don't see anything immediately obvious for build options or config. The touchscreen interactions aren't flipped. Before I start digging in driver code, do you have any suggestions?

Help with P8-b MOY-GAM5-2.3.0 Variant

Hey,
I recently picked up a P8-b with 'MOY-GAM5-2.3.0' firmware and want to flash Infinitime onto it.
Have you encountered this model before, and can you recommend a specific build ? If not, could I try builds for different hardware versions without risking bricking the watch and having to open it ?
Thanks for your help and this awesome port!

Flashing MOY-TON5 back

I´m really sorry for bother you, but I need help returnig to my P8b (TON5) stock firmware. So far I´ve the bin firmware file and I was trying to build a dfu zip witn nrfutil without success

Going back to different firmwares.

Hey there, cool project, tank you for the effort :)

I have a P8b watch, was able to install WaspOS, then this OS. Everything works only that I am not able to change to any different OS anymore. I am just asking to ensure i don't miss something obvious.

I am using ota-dfu-python/dfu.py utilities from my linux machine.

Trying to load python3 ota-dfu-python/dfu.py -z micropython.zip -a D4:EA:B6:CD:32:13 --legacy works but once done it just return to the 2 triangles infinitime screen.

Trying to load python3 ota-dfu-python/dfu.py -z espruino_2v05.31_p8_SDK14_SD50.zip -a D4:EA:B6:CD:32:13 --legacy will fail after Waiting for Image Size notification with timeout.

Flashing back from this repository works again.

P8 hybrid watch

I've P8 watch bought at mid-2020 (manufacturer's code MOY-TIN5). Tried both of your P8a and P8b FW.

  1. with P8a FW: works fine except doesn't see Accel. About screen reports Accel: ???
  2. with P8b FW: touch works for swype but NOT for taps. So I can't check if the Accel works. About screen reports I have Accel: SC7A20, touch: b4.0.2.

It seems I have a "chimera" P8 )))

BTW it's worth having the HW info stored somewhere, I like that site: https://smarterwat.ch/soc-list/nordic-semiconductor/p8.html . You can expand that or I can do that.
If you want, you can catch me in Matrix/Gitter.

(Most likely) bricked MOY-TFK5 watch using DaFlasher

Hi,
i had a old stock MOY-TFK5 watch in my drawer and dared to try install some alternative firmware.

I usesd files from here:
https://github.com/StarGate01/p8b-infinitime/releases/download/v1.11.0.0/moy_tfk5.zip

Followed instructions from Readme.md Step 1 and Step 2 were fine, just like my other P8a i flashed long time ago.
Step3 was also working, flashing bootloader-daflasher.zip.
But then i tried Step 4 to flash reloader-factory.zip with DaFlasher which got to 100% and then the watch turned black and nothing works anymore.

So i guess it is bricked now.
a) Do you have any hint (besides openeing it and solder SWD) how i can try revive it?
b) I guess Step 4 is potentionally bricking when using DaFlasher - would you mind adding a note/hint that that might be the case? Would be nice for others.

Best Regards, AlmightyFrog

What model to get?

I was looking at the p8 watch on aliexpress and don't know what model is the correct one. Is there a correct link to make sure its the correct model?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.