Difference between revisions of "PineTime FAQ"

From PINE64
Jump to navigation Jump to search
(New PineTime watches have no flash protection)
m
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
=== How do I install new software on it? ===
=== How do I install new software on it? ===


See [[Reprogramming_the_PineTime|this page to see various methods of reprogramming the devkit PineTime]].
The nRF Connect mobile app (Android and iOS) may also be used to update the firmware on your PineTime. See [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#download-and-test-our-pinetime-firmware "Download and Test Our PineTime Firmware"]
 
Also see [[Reprogramming_the_PineTime|this page to see various methods of reprogramming the devkit PineTime the wired way]].


=== Does the PineTime run Linux? ===
=== Does the PineTime run Linux? ===
Line 13: Line 15:
=== My PineTime arrived, now what? ===
=== My PineTime arrived, now what? ===


You should start by testing out all the features of the watch, to make sure everything works. You can do this using the software that was preinstalled on your device. Before doing any programming, setting up a dev cradle is recommended to keep the watch, its wires and your programmer nicely in place (Check out Lup Yuen Lee's first PineTime article for dev cradle inspiration: https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159). Finally, you should remove the device's flash protection, after which you can flash your own software or someone else's to the device.
You should start by testing out all the features of the watch, to make sure everything works. Power it on and check the display.
 
PineTime is shipped with InfiniTime firmware. Press the watch button to show the clock, then swipe up on the touchscreen to reveal the menu.
 
On your Android phone, install the nRF Connect mobile app to sync the date and time with PineTime. See [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#set-pinetime-date-and-time-with-nrf-connect "Set PineTime Date and Time with nRF Connect"] (nRF Connect on iOS can't be used for setting the date and time, because it doesn't implement the GATT Time Service)


=== How do I remove flash protection? ===
The nRF Connect mobile app (Android and iOS) may also be used to update the firmware on your PineTime. See [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#download-and-test-our-pinetime-firmware "Download and Test Our PineTime Firmware"]
 
=== What's the OS that's preinstalled on the PineTime by default? ===
 
PineTime ships with the open source [https://github.com/JF002/Pinetime InfiniTime firmware].
 
To support firmware update and rollback, PineTime includes the open source [https://lupyuen.github.io/pinetime-rust-mynewt/articles/mcuboot MCUBoot Bootloader].
 
=== Can we use this OS or its source code? ===
 
Yes, [https://github.com/JF002/Pinetime InfiniTime] and the [https://lupyuen.github.io/pinetime-rust-mynewt/articles/mcuboot MCUBoot Bootloader] are open source.
 
=== Why is the back exposed? Is it supposed to snap on? ===


PineTime watches shipped before 20 Sep 2020 have flash protection enabled.
The back cover of the PineTime dev kit is exposed so that you can flash and debug the device with the SWD pins. The main unit and cover does not snap (lock) together. If you want to attach the back cover anyway, you can use glue or tape.


The flash protection can be removed using multiple different methods. If you don't have anything except the PineTime, not even a Raspberry Pi, then you have to order a programmer online: you can use a J-Link, CMSIS-DAP dongle and various other programmers. See [[Reprogramming_the_PineTime|this page to see various methods of reprogramming the PineTime]].
=== What hardware should I use to flash code to the PineTime? ===


If your PineTime was shipped after 20 Sep 2020, you don't need to remove flash protection. They are shipped with flash protection disabled.
There are several ways you can do this, check out [[Reprogramming the PineTime]]


=== How do I connect the PineTime to a programmer? ===
=== How do I connect the PineTime to a programmer? ===
Line 27: Line 45:
Here's how: [[PineTime devkit wiring]]
Here's how: [[PineTime devkit wiring]]


=== Why can't you use ST-Link to remove nRF52 Flash Protection? ===
=== How do I set the time on PineTime? ===
 
You can use either nRF Connect, custom GadgetBridge build or the proprietary Da Fit app. See [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#set-pinetime-date-and-time-with-nrf-connect "Set PineTime Date and Time with nRF Connect"]
 
=== Is there a standard agreed method of pushing OTA updates so that one could seal the PineTime dev kit nicely? ===


Because ST-Link is a High Level Adapter. It doesn't really implement all SWD functions, just a subset. For performance I think. More details in the section "Why Visual Studio Code with ST-Link (instead of nRFgo Studio with J-LINK)" in the article "Coding nRF52 with Rust and Apache Mynewt on Visual Studio Code" here: https://medium.com/@ly.lee/coding-nrf52-with-rust-and-apache-mynewt-on-visual-studio-code-9521bcba6004?source=friends_link&sk=bb4e2523b922d0870259ab3fa696c7da
InfiniTime supports firmware updates over Bluetooth LE with the nRF Connect mobile app. See [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud#download-and-test-our-pinetime-firmware "Download and Test Our PineTime Firmware"]


=== Since we need a low level SWD adapter like Raspberry Pi anyway, can we do everything on a Pi instead of ST-Link + Windows? ===
=== My PineTime's screen shows garbage, how do I fix it? ===


Current progress with Pi and PineTime is here https://medium.com/@ly.lee/debug-rust-mynewt-firmware-for-pinetime-on-raspberry-pi-4b9ac2d093a9?source=friends_link&sk=edb508c31e43d3ec40ecd8554f3405f6
This is usually caused by unplugging the device after it has booted, it needs to be reinitialised. To do so just restart the watch by removing power to it.


=== What's the OS that's preinstalled on the PineTime by default? ===
=== Can I use Pinebook Pro for developing PineTime? ===


The watch, and its preinstalled OS, is built by a friend of TL. The software is proprietary and not made by Pine64 or its community. It can interact with the "Da Fit" app on Android. The dev kit contains this OS (and as a result, the flash protection) so that developers can test if all the hardware on their device is working correctly before they flash the device and start working on their own software.
Yes, use the [https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm/downloads Arm Embedded Toolchain arm-none-eabi-gcc]


The next version of the dev kit will be preloaded with Infinitime: https://github.com/JF002/Pinetime
=== I have experience developing on Arduino. How does the PineTime compare? ===


=== Can we use this OS or its source code? ===
To learn programming on PineTime, [https://lupyuen.github.io/pinetime-rust-mynewt/articles/cloud check out this article]


While it's not what the dev kit is for, you are of course free to use the watch with its preinstalled software as is. The preinstalled OS is proprietary, and its owner will not release the source code, so we cannot use this OS as a starting point.
Arduino provides the Arduino IDE (or you use the avr-gcc and avrdude command-line tools) which you can use to compile and upload code to an Arduino board. The PineTime and its ARM processor doesn't have this, so you'll have to familiarize yourself with tools like GCC for AVR, and OpenOCD. Some experience with Arduino does translate over to the PineTime, especially if you've worked with LCD's, or SPI. The PineTime is at least four times faster than an Arduino Uno (even faster at certain specific workloads due to hardware acceleration), and it has 32 times more RAM and 16 times more flash storage.


=== Why is the back exposed? Is it supposed to snap on? ===
=== Can I code firmware for PineTime without an actual PineTime? ===


The back cover of the PineTime dev kit is exposed so that you can flash and debug the device with the SWD pins. The main unit and cover does not snap (lock) together. If you want to attach the back cover anyway, you can use glue or tape.
You may code PineTime Watch Faces and preview them in a web browser (thanks to WebAssembly)...


=== What hardware should I use to flash code to the PineTime? ===
[https://lupyuen.github.io/pinetime-rust-mynewt/articles/simulator PineTime Simulator]


There are several ways you can do this, check out [[Reprogramming the PineTime]]
Then flash your firmware remotely to a real PineTime via Telegram, and watch your firmware run in a live video stream...


=== I have experience developing on Arduino. How does the PineTime compare? ===
[https://github.com/lupyuen/remote-pinetime-bot/blob/master/README.md Remote PineTime]


Arduino provides the Arduino IDE (or you use the avr-gcc and avrdude command-line tools) which you can use to compile and upload code to an Arduino board. The PineTime and its ARM processor doesn't have this, so you'll have to familiarize yourself with tools like GCC for AVR, and OpenOCD. Some experience with Arduino does translate over to the PineTime, especially if you've worked with LCD's, or SPI. The PineTime is at least four times faster than an Arduino Uno (even faster at certain specific workloads due to hardware acceleration), and it has 32 times more RAM and 16 times more flash storage.
=== What is Arm Semihosting? ===


=== My PineTime has the stock proprietary software on it, how do I set the time? ===
We use the SWD (Single Wire Debug) protocol created by Arm for flashing and debugging PineTime's nRF52832 microcontroller, which contains an Arm CPU. (SWD is derived from standard JTAG, but with fewer wires) With Arm CPUs you can trigger a software breakpoint, and allow the debugger (OpenOCD) to do something really nifty: Display a message, read console input, dump out a file, even read a file. That's called Arm Semihosting. [http://www.keil.com/support/man/docs/armcc/armcc_pge1358787046598.htm More about Arm Semihosting]


You can use either nRF Connect, custom GadgetBridge build or the proprietary Da Fit app.
=== What is OpenOCD? ===


=== My PineTime's screen shows garbage, how do I fix it? ===
OpenOCD is Open On-Chip Debugger. It's the software that drives your microcontroller debugger/flasher. We need it for running any kind of flashing and debugging with Pi or ST-Link. gdb talks to OpenOCD for debugging firmware. gdb also works with VSCode for debugging firmware visually. [http://openocd.org/doc-release/html/About.html#What-is-OpenOCD_003f More about OpenOCD]


This is usually caused by unplugging the device after it has booted, it needs to be reinitialised. To do so just restart the watch by removing power to it.
Please use [https://xpack.github.io/openocd xPack OpenOCD] with PineTime. Other versions of OpenOCD seem to have problems with PineTime.


=== Is there a 3D model of PineTime available somewhere? ===
=== How do I remove flash protection? ===


Not yet. Someone did design a cover you can snap on to keep the back shut: https://www.thingiverse.com/thing:4172849
PineTime watches shipped before 20 Sep 2020 have flash protection enabled.


=== Is there a standard agreed method of pushing OTA updates so that one could seal the PineTime dev kit nicely? ===
The flash protection can be removed using multiple different methods. If you don't have anything except the PineTime, not even a Raspberry Pi, then you have to order a programmer online: you can use a J-Link, CMSIS-DAP dongle and various other programmers. See [[Reprogramming_the_PineTime|this page to see various methods of reprogramming the PineTime]].


Infinitime is implementing OTA updates and a bootloader, allowing for other software to be flashed over Bluetooth.
If your PineTime was shipped after 20 Sep 2020, you don't need to remove flash protection. They are shipped with flash protection disabled. You can flash and debug PineTime right away with ST-Link, JLink and Raspberry Pi.


=== What is ARM Semihosting? ===
=== Why can't you use ST-Link to remove nRF52 Flash Protection? ===


So we know that we use the SWD (Single Wire Debug) protocol created by Arm for flashing and debugging Arm embedded CPUs. SWD being derived from standard JTAG, but with fewer wires
Because ST-Link is a High Level Adapter. It doesn't really implement all SWD functions, just a subset (probably to keep the price low). More details in the section "Why Visual Studio Code with ST-Link (instead of nRFgo Studio with J-LINK)" in the article [https://medium.com/@ly.lee/coding-nrf52-with-rust-and-apache-mynewt-on-visual-studio-code-9521bcba6004?source=friends_link&sk=bb4e2523b922d0870259ab3fa696c7da "Coding nRF52 with Rust and Apache Mynewt on Visual Studio Code"].
With Arm CPUs you can trigger an software interrupt, and allow the debugger (OpenOCD) to do something really nifty
Display a message, read console input, dump out a file, even read a file! That's called ARM Semihosting http://www.keil.com/support/man/docs/armcc/armcc_pge1358787046598.htm


=== What is OpenOCD? ===
=== Since we need a low level SWD adapter like Raspberry Pi anyway, can we do everything on a Pi instead of ST-Link + Windows? ===


OpenOCD is Open On-Chip Debugger. It's the software that drives your microcontroller debugger/flasher. We need it for running any kind of flashing and debugging with Pi or ST-Link. gdb talks to OpenOCD for debugging firmware. And VSCode talks to gdb for debugging firmware visually. http://openocd.org/doc-release/html/About.html#What-is-OpenOCD_003f
Yes, Raspberry Pi works for flashing and debugging PineTime, even for removing flash protection. We have a special version of OpenOCD called OpenOCD SPI that talks to PineTime's SWD port over SPI (without bit-banging). See [https://github.com/lupyuen/pinetime-updater/blob/master/README.md PineTime Updater]
There have been no official updates for years, the closest one is by ntfreak: https://github.com/ntfreak/openocd (My SPI fork is based on this)


=== Can I use Pinebook Pro for developing PineTime? ===
=== Is there a 3D model of PineTime available somewhere? ===


Arm Embedded Toolchain for Pinebook Pro is here, if anyone needs it. It's linked with dynamic libraries, so I fear it might not work on your Pinebook Pro. Hoping to save you 7 hours of painful toolchain building... https://github.com/lupyuen/pinetime-rust-mynewt/releases/tag/v1.0.5
Not yet. Someone did design a cover you can snap on to keep the back shut. [https://www.thingiverse.com/thing:4172849 More details]


=== Are there any alternatives to the wrist band provided with the PineTime? ===
=== Are there any alternatives to the wrist band provided with the PineTime? ===
Line 93: Line 112:


Note that some sellers have a different point of view on what standard is. So you should always check the fitting to make sure it looks like the one used by PineTime.
Note that some sellers have a different point of view on what standard is. So you should always check the fitting to make sure it looks like the one used by PineTime.
=== I'm stuck. How can I get help? ===
Chat with the PineTime Community on [[PineTime#Community|Matrix / Discord / Telegram / IRC]] (They are bridged into a single chatroom)

Revision as of 23:57, 22 September 2020

How do I install new software on it?

The nRF Connect mobile app (Android and iOS) may also be used to update the firmware on your PineTime. See "Download and Test Our PineTime Firmware"

Also see this page to see various methods of reprogramming the devkit PineTime the wired way.

Does the PineTime run Linux?

No. Please read this forum article for information about Linux on PineTime: https://forum.pine64.org/showthread.php?tid=8112

How long does it take to ship my PineTime?

That depends on whether you chose for Standard or Express shipping. Standard shipping for the dev kit may take up to a few weeks.

My PineTime arrived, now what?

You should start by testing out all the features of the watch, to make sure everything works. Power it on and check the display.

PineTime is shipped with InfiniTime firmware. Press the watch button to show the clock, then swipe up on the touchscreen to reveal the menu.

On your Android phone, install the nRF Connect mobile app to sync the date and time with PineTime. See "Set PineTime Date and Time with nRF Connect" (nRF Connect on iOS can't be used for setting the date and time, because it doesn't implement the GATT Time Service)

The nRF Connect mobile app (Android and iOS) may also be used to update the firmware on your PineTime. See "Download and Test Our PineTime Firmware"

What's the OS that's preinstalled on the PineTime by default?

PineTime ships with the open source InfiniTime firmware.

To support firmware update and rollback, PineTime includes the open source MCUBoot Bootloader.

Can we use this OS or its source code?

Yes, InfiniTime and the MCUBoot Bootloader are open source.

Why is the back exposed? Is it supposed to snap on?

The back cover of the PineTime dev kit is exposed so that you can flash and debug the device with the SWD pins. The main unit and cover does not snap (lock) together. If you want to attach the back cover anyway, you can use glue or tape.

What hardware should I use to flash code to the PineTime?

There are several ways you can do this, check out Reprogramming the PineTime

How do I connect the PineTime to a programmer?

Here's how: PineTime devkit wiring

How do I set the time on PineTime?

You can use either nRF Connect, custom GadgetBridge build or the proprietary Da Fit app. See "Set PineTime Date and Time with nRF Connect"

Is there a standard agreed method of pushing OTA updates so that one could seal the PineTime dev kit nicely?

InfiniTime supports firmware updates over Bluetooth LE with the nRF Connect mobile app. See "Download and Test Our PineTime Firmware"

My PineTime's screen shows garbage, how do I fix it?

This is usually caused by unplugging the device after it has booted, it needs to be reinitialised. To do so just restart the watch by removing power to it.

Can I use Pinebook Pro for developing PineTime?

Yes, use the Arm Embedded Toolchain arm-none-eabi-gcc

I have experience developing on Arduino. How does the PineTime compare?

To learn programming on PineTime, check out this article

Arduino provides the Arduino IDE (or you use the avr-gcc and avrdude command-line tools) which you can use to compile and upload code to an Arduino board. The PineTime and its ARM processor doesn't have this, so you'll have to familiarize yourself with tools like GCC for AVR, and OpenOCD. Some experience with Arduino does translate over to the PineTime, especially if you've worked with LCD's, or SPI. The PineTime is at least four times faster than an Arduino Uno (even faster at certain specific workloads due to hardware acceleration), and it has 32 times more RAM and 16 times more flash storage.

Can I code firmware for PineTime without an actual PineTime?

You may code PineTime Watch Faces and preview them in a web browser (thanks to WebAssembly)...

PineTime Simulator

Then flash your firmware remotely to a real PineTime via Telegram, and watch your firmware run in a live video stream...

Remote PineTime

What is Arm Semihosting?

We use the SWD (Single Wire Debug) protocol created by Arm for flashing and debugging PineTime's nRF52832 microcontroller, which contains an Arm CPU. (SWD is derived from standard JTAG, but with fewer wires) With Arm CPUs you can trigger a software breakpoint, and allow the debugger (OpenOCD) to do something really nifty: Display a message, read console input, dump out a file, even read a file. That's called Arm Semihosting. More about Arm Semihosting

What is OpenOCD?

OpenOCD is Open On-Chip Debugger. It's the software that drives your microcontroller debugger/flasher. We need it for running any kind of flashing and debugging with Pi or ST-Link. gdb talks to OpenOCD for debugging firmware. gdb also works with VSCode for debugging firmware visually. More about OpenOCD

Please use xPack OpenOCD with PineTime. Other versions of OpenOCD seem to have problems with PineTime.

How do I remove flash protection?

PineTime watches shipped before 20 Sep 2020 have flash protection enabled.

The flash protection can be removed using multiple different methods. If you don't have anything except the PineTime, not even a Raspberry Pi, then you have to order a programmer online: you can use a J-Link, CMSIS-DAP dongle and various other programmers. See this page to see various methods of reprogramming the PineTime.

If your PineTime was shipped after 20 Sep 2020, you don't need to remove flash protection. They are shipped with flash protection disabled. You can flash and debug PineTime right away with ST-Link, JLink and Raspberry Pi.

Why can't you use ST-Link to remove nRF52 Flash Protection?

Because ST-Link is a High Level Adapter. It doesn't really implement all SWD functions, just a subset (probably to keep the price low). More details in the section "Why Visual Studio Code with ST-Link (instead of nRFgo Studio with J-LINK)" in the article "Coding nRF52 with Rust and Apache Mynewt on Visual Studio Code".

Since we need a low level SWD adapter like Raspberry Pi anyway, can we do everything on a Pi instead of ST-Link + Windows?

Yes, Raspberry Pi works for flashing and debugging PineTime, even for removing flash protection. We have a special version of OpenOCD called OpenOCD SPI that talks to PineTime's SWD port over SPI (without bit-banging). See PineTime Updater

Is there a 3D model of PineTime available somewhere?

Not yet. Someone did design a cover you can snap on to keep the back shut. More details

Are there any alternatives to the wrist band provided with the PineTime?

No, but PineTime accepts standard 20mm wrist band that is widely available by a third party.

Note that some sellers have a different point of view on what standard is. So you should always check the fitting to make sure it looks like the one used by PineTime.

I'm stuck. How can I get help?

Chat with the PineTime Community on Matrix / Discord / Telegram / IRC (They are bridged into a single chatroom)