All Projects → lupyuen → pinetime-updater

lupyuen / pinetime-updater

Licence: Apache-2.0 license
Flash firmware to PineTime the friendly wired way with OpenOCD

Programming Languages

shell
77523 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to pinetime-updater

TeslondaServer
The back-end, server app for the Teslonda Dashboard on Raspberry Pi.
Stars: ✭ 20 (-62.26%)
Mutual labels:  raspberrypi
comi
ComiGO:Simple, cross-platform manga reader。简单、跨平台的漫画阅读器。シンプルな漫画リーダー。
Stars: ✭ 34 (-35.85%)
Mutual labels:  raspberrypi
genie-server
The home server version of Almond
Stars: ✭ 237 (+347.17%)
Mutual labels:  raspberrypi
Raspberry-W25Q64
SPI Flash Memory W25Q64 Access Library for RaspberryPi
Stars: ✭ 37 (-30.19%)
Mutual labels:  raspberrypi
Poke-Pi-Dex
Our deep learning for computer vision related project for nostalgic poke weebs (Sistemi digitali, Unibo).
Stars: ✭ 18 (-66.04%)
Mutual labels:  raspberrypi
WebGPIO
A simple web UI for controlling the GPIO pins on a Raspberry Pi
Stars: ✭ 69 (+30.19%)
Mutual labels:  raspberrypi
aprenda-python
Aprendizado, dicas e projetos sobre Python
Stars: ✭ 22 (-58.49%)
Mutual labels:  raspberrypi
blinkt
A Rust library for the Pimoroni Blinkt!, and any similar APA102 or SK9822 LED strips or boards, on a Raspberry Pi.
Stars: ✭ 18 (-66.04%)
Mutual labels:  raspberrypi
Pigrow
Raspberry Pi Grow Box Control Software
Stars: ✭ 98 (+84.91%)
Mutual labels:  raspberrypi
Report-IP-hourly
📬 Report Linux IP by email hourly.
Stars: ✭ 43 (-18.87%)
Mutual labels:  raspberrypi
balena-plant-saver
We're building a plant monitor (and saver) - this is the early stage
Stars: ✭ 68 (+28.3%)
Mutual labels:  raspberrypi
wiringpi-tft-tool
TFT Command Line Tool for Raspberry Pi
Stars: ✭ 35 (-33.96%)
Mutual labels:  raspberrypi
Realtek-USB-Wireless-Adapter-Drivers
Realtek USB Wireless Adapter Drivers [0bda:f179] (Kernel 4.15.x ~ 5.9.x)
Stars: ✭ 34 (-35.85%)
Mutual labels:  raspberrypi
boozer
Kegerator Monitoring Platform. RPi + Docker + Beer + Metrics + Slack. k3s kubernetes friendly.
Stars: ✭ 93 (+75.47%)
Mutual labels:  raspberrypi
packages
PiKVM Packages
Stars: ✭ 18 (-66.04%)
Mutual labels:  raspberrypi
octoscreen
A touchscreen client for Octoprint
Stars: ✭ 26 (-50.94%)
Mutual labels:  raspberrypi
kvmd
The main Pi-KVM daemon
Stars: ✭ 125 (+135.85%)
Mutual labels:  raspberrypi
rust-crosscompiler-arm
Docker images for Rust dedicated to cross compilation for ARM v6 and more
Stars: ✭ 48 (-9.43%)
Mutual labels:  raspberrypi
PowerBlock
Driver for petrockblock.com PowerBlock
Stars: ✭ 37 (-30.19%)
Mutual labels:  raspberrypi
background-radiation-monitor
Monitor and record background radiation levels with a cheap detector and a Raspberry Pi.
Stars: ✭ 25 (-52.83%)
Mutual labels:  raspberrypi

pinetime-updater: Flash firmware to PineTime the friendly wired way with OpenOCD

Requirements

How To Run

# For macOS Only: Install brew according to https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# For Raspberry Pi Only: Enable SPI port with raspi-config
# Select Interfacing Options → SPI → Yes
sudo raspi-config

# Download the bash and OpenOCD scripts
git clone https://github.com/lupyuen/pinetime-updater

# Run the bash script
cd pinetime-updater
chmod +x run.sh
./run.sh

We should see Done! when the flashing has completed.

(In case of problems, compare with the logs at the end of this doc)

Remove Flash ROM Protection

The above steps will fail when PineTime has Flash ROM Protection enabled.

All PineTime watches shipped before August 2020 will have Flash ROM Protection enabled.

To remove PineTime's Flash ROM Protection (with Raspberry Pi only)...

  1. Power off our Raspberry Pi

  2. Connect our Raspberry Pi with Raspberry Pi OS (32-bit) to PineTime via the SPI port...

    "Connect PineTime to Raspberry Pi"

  3. Power on our Raspberry Pi. Open the Terminal and enter...

    cd pinetime-updater
    ./scripts/flash-unprotect.sh

    We should see...

    Removing flash protection and erasing flash...
    Shut down and power off your Raspberry Pi. Wait 30 seconds then power on your Raspberry Pi. Run flash-unprotect.sh to check flash protection.
    
  4. Follow the instructions to power off the Raspberry Pi.

  5. After 30 seconds, power it on and enter...

    cd pinetime-updater
    ./scripts/flash-unprotect.sh

    We should see...

    Flash is already unprotected
    
  6. Follow the steps in the previous section to flash our PineTime

Raspberry Pi Troubleshooting

(This section is for Raspberry Pi only)

If we see Clock Speed and nothing else after that…

Info : BCM2835 SPI SWD driver
Info : SWD only mode enabled
Info : clock speed 31200 kHz
Info : SWD DPIDR 0x2ba01477

Then the connection to the SWD Port is probably loose, please check the pins.

If we don't see this DPIDR number, or if we see a different DPIDR number...

SWD DPIDR 0x2ba01477

Then the connection to the SWD Port is most likely loose, please check the pins.

Also enter sudo raspi-config and confirm that the SPI port has been enabled.

If the PineTime battery is completely empty, this may also cause connectivity problems.

How It Works

See run.sh for the flashing steps.

Once the latest MCUBoot Bootloader and InfiniTime Firmware have been flashed to PineTime, we will be able to update the firmware wirelessly with the nRF Connect mobile app like this...

"Download PineTime Firmware"

(Except we won't be downloading the firmware from GitHub Actions. We will have the official link soon.)

For more about PineTime...

"PineTime doesn't run Linux... But that's OK!"

Sample Log for Raspberry Pi

----- Downloading https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v4.1.7/mynewt_nosemi.elf.bin to /tmp/mynewt_nosemi.elf.bin... (If it stops here, URL is invalid)
+ wget -q https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v4.1.7/mynewt_nosemi.elf.bin -O /tmp/mynewt_nosemi.elf.bin
+ '[' '!' -f /tmp/mynewt_nosemi.elf.bin ']'
+ set +x

----- Flashing /tmp/mynewt_nosemi.elf.bin to address 0x0...
+ openocd-spi/bin/openocd -c ' set filename "/tmp/mynewt_nosemi.elf.bin" ' -c ' set address  "0x0" ' -f scripts/swd-pi.ocd -f scripts/flash-program.ocd
Open On-Chip Debugger 0.10.0+dev-01130-g9d1b46f5 (2020-08-03-21:20)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
/tmp/mynewt_nosemi.elf.bin
0x0
Info : only one transport option; autoselect 'swd'
force hard breakpoints
Info : BCM2835 SPI SWD driver
Info : SWD only mode enabled
Info : clock speed 31200 kHz
Info : SWD DPIDR 0x2ba01477
Info : nrf52.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Stopping...
target halted due to debug-request, current mode: Thread 
xPSR: 0x61000000 pc: 0x000001ce msp: 0x2000ffd8

Flashing ROM...
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000
Enabled ARM Semihosting to show debug output
** Programming Started **
Info : nRF52832-QFAA(build code: E1) 512kB Flash, 64kB RAM
Warn : Adding extra erase range, 0x000056d8 .. 0x00005fff
** Programming Finished **
** Verify Started **
** Verified OK **

Restarting...
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000, semihosting
Enabled ARM Semihosting to show debug output

Sample Log for ST-Link

----- Downloading https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v4.1.7/mynewt_nosemi.elf.bin to /tmp/mynewt_nosemi.elf.bin... (If it stops here, URL is invalid)
+ wget -q https://github.com/lupyuen/pinetime-rust-mynewt/releases/download/v4.1.7/mynewt_nosemi.elf.bin -O /tmp/mynewt_nosemi.elf.bin
+ '[' '!' -f /tmp/mynewt_nosemi.elf.bin ']'
+ set +x

----- Flashing /tmp/mynewt_nosemi.elf.bin to address 0x0...
+ xpack-openocd/bin/openocd -c ' set filename "/tmp/mynewt_nosemi.elf.bin" ' -c ' set address  "0x0" ' -f scripts/swd-stlink.ocd -f scripts/flash-program.ocd
xPack OpenOCD, x86_64 Open On-Chip Debugger 0.10.0+dev-00378-ge5be992df (2020-06-26-12:31)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
/tmp/mynewt_nosemi.elf.bin
0x0

nRF52 device has a CTRL-AP dedicated to recover the device from AP lock.
A high level adapter (like a ST-Link) you are currently using cannot access
the CTRL-AP so 'nrf52_recover' command will not work.
Do not enable UICR APPROTECT.

force hard breakpoints
Stopping...
target halted due to debug-request, current mode: Thread 
xPSR: 0x41000000 pc: 0x00000da0 msp: 0x2000ffa0

Flashing ROM...
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000
Enabled ARM Semihosting to show debug output
** Programming Started **
** Programming Finished **
** Verify Started **
** Verified OK **

Restarting...
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x000000d8 msp: 0x20010000, semihosting
Enabled ARM Semihosting to show debug output

**** Done!
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].