https://wiki.pine64.org/api.php?action=feedcontributions&user=Danielt&feedformat=atomPINE64 - User contributions [en]2024-03-29T12:35:15ZUser contributionsMediaWiki 1.37.1https://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&diff=11356Switching your PineTime between InfiniTime and Wasp-os2021-09-09T09:01:24Z<p>Danielt: </p>
<hr />
<div>[[File:Flash-reloader-mcuboot.jpg|600px|thumb|right|Flashing <code>reloader-mcuboot.zip</code>]]<br />
[[File:Flash-micropython.jpg|400px|thumb|right|Flashing <code>micropython.zip</code>]]<br />
== Introduction ==<br />
Both Infinitime and Wasp-os are very cool OS'es for the [[PineTime]] and many people will want to try both. This is possible, even with a sealed device!<br />
<br />
Both devices use the same Nordic (legacy) DFU protocol for updating firmware over the air. But the BLE stack and the bootloaders for both are different. That's why we need to use the [https://github.com/daniel-thompson/wasp-reloader reloader]. However, instructions you find elsewhere (including [https://www.youtube.com/watch?v=lPasAt1LJmo Daniel Thompsons video]) are somewhat outdated.<br />
<br />
Flashing can be done with any of<br />
* nRF Connect for Mobile ([https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp Android], [https://apps.apple.com/us/app/nrf-connect-bluetooth-app/id1054362403 iOS])<br />
* [https://www.gadgetbridge.org Gadgetbridge] (Android >= 4.4)<br />
* [https://github.com/piggz/harbour-amazfish Amazfish] (SailfishOS and Linux)<br />
* [https://github.com/alexr4535/siglo Siglo] (Linux desktop and Pinephone) (Use the 'Manual OTA File' option)<br />
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows)<br />
* ota-dfu-python (Linux CLI) which is included in sources of both Infinitime and Wasp-os<br />
** <code>InfiniTime/bootloader/ota-dfu-python/dfu.py</code><br />
** <code>wasp-os/tools/ota-dfu-python/dfu.py</code><br />
<br />
This guide has been last updated for Infinitime 1.1.0 and Wasp-os 0.4.1<br />
<br />
== InfiniTime => Wasp-os ==<br />
<br />
All the zips you need can be found from the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide].<br />
<br />
* Make sure the watch is running Infinitime and can be found by your companion device (PC, phone, etc).<br />
* First we need to flash the reloader, with the wasp-os bootloader as payload. To do this, flash: <br><code>wasp-os-0.4/build-pinetime/reloader-mcuboot.zip</code><br />
* After flashing, it will boot using the Infinitime bootloader (green large pine cone), then it'll hang for a few seconds, then it'll show the reloader animation (blue smaller pine cone), and then it'll boot the wasp-os bootloader.<br />
* Make sure the watch is on the screen with the pine cone and arrow. If it is in a bootloop instead, then reboot the watch by holding the button until the arrow appears.<br />
* Now you can flash micropython with wasp-os: <br><code>wasp-os-0.4/build-pinetime/micropython.zip</code><br />
* Wasp-os should now boot. Enjoy!<br />
<br />
== Wasp-os => InfiniTime ==<br />
[[File:Flash-reloader-infinitime-recovery.jpg|500px|thumb|right|Flashing <code>reloader-infinitime-recovery-0.14.1.zip.zip</code>]]<br />
[[File:Flash-infinitime.jpg|600px|thumb|right|Flashing <code>pinetime-mcuboot-app-dfu-1.1.0.zip.zip</code>]]<br />
<br />
The <code>reloader-factory.zip</code> was broken in the original wasp-os 0.4 but was fixed in wasp-os 0.4.1. However the Infinitime binaries are outdated the 0.4 release and I do not recommend flashing these. Older InfiniTime versions have flaky BLE which makes upgrading from there very unreliable.<br />
<br />
You can get newer binaries from the wasp-os projects CI system (see the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide]) or alternatively, I made my own containing just the [https://github.com/JF002/InfiniTime/releases/tag/0.14.1 InfiniTime 0.14.1] [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/develop/README.md#recovery-firmware recovery firmware]. This allows you to flash any future release of InfiniTime without having to find a new reloader zip. Get the [https://github.com/Peetz0r/wasp-reloader/releases/tag/infinitime-0.14.1-recovery reloader zip here] and the [https://github.com/JF002/InfiniTime/releases latest Infinitime here].<br />
<br />
* Reboot the watch by holding the button until the pine cone arrow appears.<br />
* Flash the reloader zip: <br><code>reloader-infinitime-recovery-0.14.1.zip</code><br />
* After flashing, the reloader will run (blue smaller pine cone), then it'll boot the InfiniTime bootloader (large pine cone) will run.<br />
* Boot the watch into recovery mode by holding the button until the pine cone turns red. It'll boot again (large pine cone will turn green) and then the InfiniTime loo will appear.<br />
* You can now flash InfiniTime 1.1.0 (or any other version): <br><code>pinetime-mcuboot-app-dfu-1.1.0.zip</code><br />
* InfiniTime should now boot. Enjoy!<br />
<br />
<br />
[[Category:PineTime]][[Category:Guide]]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_Hardware_Wishlist&diff=10889PineTime Hardware Wishlist2021-07-14T10:51:08Z<p>Danielt: /* Hardware */</p>
<hr />
<div>This page contains a list of things people wish PineTime did differently<br />
<br />
=== Hardware ===<br />
<br />
* Long pressing the button should power-cycle the watch without any software being involved<br />
* Other display tech could be explored. [//en.Wikipedia.org/wiki/Transflective_liquid-crystal_display A transflective LCD] would probably be a nice option. Or potentially OLED?<br />
* Touchscreen should possibly have a configurable sensitivity level for both glove-wearing and droplet-resistance. Preferably it should still be a capacitive one, a resistive touchscreen would have too many trade-offs.<br />
* A slightly bigger 256×256 pixel graphics display size is preferable for its binary alignment, affording some low-level simplicity – it has the property that its X and Y coordinates are each addressable with a single byte, with no out-of-bounds; its total number of pixels is 65536 (another power of 2), and each pixel is addressable with exactly 2 bytes, with perfect efficiency. The [http://Pelulamu.net/ibniz IBNIZ (Ideally Bare Numeric Impression giZmo) virtual machine], designed for fun minimalist demoscene graphics, has chosen 256×256 for its virtual display, and makes use of these simplicity advantages. If PineTime also chose 256×256 then it would be a target platform for unclipped IBNIZ demoscene programmes, which would be really fun to play around with on one's wrist!<br />
* A full 16-bit redraw on the display takes 120ms at the very least, which is 8Hz (although modest optimization is possible by adopting 12-bit color). A smooth scrolling/usage/animation experience would be 30Hz minimum, preferably 60. Display redraw is currently bottlenecked by the nRF52832 maximum SPI clock (8MHz).<br />
* Some sort of scroll wheel would be nice for convenience.<br />
* Changed GPIO assignment so more functionality is available (i.e. NFC and VSYNC)<br />
* Wireless charging, or Qi Charging capability<br />
* An external RTC circuit saving the current time to allow the main MCU go to deep-sleep.<br />
* nRF5840 update: QSPI, CryptoCell + Secure Key Storage, has more RAM, a coprocessor and the possibility to expose USB through power pins<br />
* Preferably a pre-certified MCU module with a ceramic antenna<br />
* Version without sensors but maybe bigger battery<br />
* A couple of pins on the programmer connector to allow UART while developing (currently there is a TX test point on PCB). (Note: There's ARM SemiHosting and Segger RTT)<br />
* Connect the pin of LCD controller that allows RD/WR from it in order to save RAM on the MCU. (The MOSI pin for the SPI is already connected to the nor flash that shares the same pins, pin number is P0.04)<br />
* LCD must be centered on case. Currently is not and watchfaces seems different when clock is put on the other wrist.<br />
* A NFC antenna around the case, connected to the NFC pins.<br />
* Used sensors should be NDA-free and preferably also blob-free. For example the BMA421 accelerometer doesn't have a datasheet (it seems private to some hardware integrators): a more open one would be much easier to develop for. Special attention should be paid to advanced features, such as step counting integration or flick detection.<br />
* PineTime SoC could support USB or have a FTDI chip with the relevant pins exposed. It could allow flashing a sealed device, just like Arduinos work. The same USB-C could also be used for charging. <br />
* A bigger pulldown resistor for the power button, because 100k still leaks a noticeable amount of power when the button is always on.<br />
* Ceramic Bluetooth antenna for better signal reception<br />
* Ultra low quiescent current PMIC for better deep sleep. Better shipping/storage/turned off mode<br />
<br />
<br />
[[Category:PineTime]]</div>Danielthttps://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&diff=10827Switching your PineTime between InfiniTime and Wasp-os2021-06-23T15:33:46Z<p>Danielt: Use the offical wasp-os docs to help users identify whether they want a release or a CI build.</p>
<hr />
<div>[[File:Flash-reloader-mcuboot.jpg|600px|thumb|right|Flashing <code>reloader-mcuboot.zip</code>]]<br />
[[File:Flash-micropython.jpg|400px|thumb|right|Flashing <code>micropython.zip</code>]]<br />
== Introduction ==<br />
Both Infinitime and Wasp-os are very cool OS'es for the [[PineTime]] and many people will want to try both. This is possible, even with a sealed device!<br />
<br />
Both devices use the same Nordic (legacy) DFU protocol for updating firmware over the air. But the BLE stack and the bootloaders for both are different. That's why we need to use the [https://github.com/daniel-thompson/wasp-reloader reloader]. However, instructions you find elsewhere (including [https://www.youtube.com/watch?v=lPasAt1LJmo Daniel Thompsons video]) are somewhat outdated.<br />
<br />
Flashing can be done with any of<br />
* nRF Connect for Mobile ([https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp Android], [https://apps.apple.com/us/app/nrf-connect-bluetooth-app/id1054362403 iOS])<br />
* [https://www.gadgetbridge.org GadgetBridge] (Android >= 4.4)<br />
* [https://github.com/piggz/harbour-amazfish Amazfish] (SailfishOS and Linux)<br />
* [https://github.com/alexr4535/siglo Siglo] (Linux desktop and Pinephone) (Use the 'Manual OTA File' option)<br />
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows)<br />
* ota-dfu-python (Linux CLI) which is included in sources of both Infinitime and Wasp-os<br />
** <code>InfiniTime/bootloader/ota-dfu-python/dfu.py</code><br />
** <code>wasp-os/tools/ota-dfu-python/dfu.py</code><br />
<br />
This guide has been last updated for Infinitime 1.1.0 and Wasp-os 0.4<br />
<br />
== InfiniTime => Wasp-os ==<br />
<br />
All the zips you need can be found from the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide].<br />
<br />
* Make sure the watch is running Infinitime and can be found by your companion device (PC, phone, etc).<br />
* First we need to flash the reloader, with the wasp-os bootloader as payload. To do this, flash: <br><code>wasp-os-0.4/build-pinetime/reloader-mcuboot.zip</code><br />
* After flashing, it will boot using the Infinitime bootloader (green large pine cone), then it'll hang for a few seconds, then it'll show the reloader animation (blue smaller pine cone), and then it'll boot the wasp-os bootloader.<br />
* Make sure the watch is on the screen with the pine cone and arrow. If it is in a bootloop instead, then reboot the watch by holding the button until the arrow appears.<br />
* Now you can flash micropython with wasp-os: <br><code>wasp-os-0.4/build-pinetime/micropython.zip</code><br />
* Wasp-os should now boot. Enjoy!<br />
<br />
== Wasp-os => InfiniTime ==<br />
[[File:Flash-reloader-infinitime-recovery.jpg|500px|thumb|right|Flashing <code>reloader-infinitime-recovery-0.14.1.zip.zip</code>]]<br />
[[File:Flash-infinitime.jpg|600px|thumb|right|Flashing <code>pinetime-mcuboot-app-dfu-1.1.0.zip.zip</code>]]<br />
<br />
The <code>reloader-factory.zip</code> was broken in the original wasp-os 0.4 but was fixed in the subsequent re-release. However the Infinitime binaries are outdated the 0.4 release and I do not recommend flashing these. Older InfiniTime versions have flaky BLE which makes upgrading from there very unreliable.<br />
<br />
You can get newer bineries from the wasp-os projects CI system (see the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide]) or alternatively, I made my own containing just the [https://github.com/JF002/InfiniTime/releases/tag/0.14.1 InfiniTime 0.14.1] [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/develop/README.md#recovery-firmware recovery firmware]. This allows you to flash any future release of InfiniTime without having to find a new reloader zip. Get the [https://github.com/Peetz0r/wasp-reloader/releases/tag/infinitime-0.14.1-recovery reloader zip here] and the [https://github.com/JF002/InfiniTime/releases latest Infinitime here].<br />
<br />
* Reboot the watch by holding the button until the pine cone arrow appears.<br />
* Flash the reloader zip: <br><code>reloader-infinitime-recovery-0.14.1.zip</code><br />
* After flashing, the reloader will run (blue smaller pine cone), then it'll boot the InfiniTime bootloader (large pine cone) will run.<br />
* Boot the watch into recovery mode by holding the button until the pine cone turns red. It'll boot again (large pine cone will turn green) and then the InfiniTime loo will appear.<br />
* You can now flash InfiniTime 1.1.0 (or any other version): <br><code>pinetime-mcuboot-app-dfu-1.1.0.zip</code><br />
* InfiniTime should now boot. Enjoy!<br />
<br />
<br />
[[Category:PineTime]][[Category:Guide]]</div>Danielthttps://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&diff=10826Switching your PineTime between InfiniTime and Wasp-os2021-06-23T15:31:45Z<p>Danielt: Update with latest status regarding binaries from wasp-os</p>
<hr />
<div>[[File:Flash-reloader-mcuboot.jpg|600px|thumb|right|Flashing <code>reloader-mcuboot.zip</code>]]<br />
[[File:Flash-micropython.jpg|400px|thumb|right|Flashing <code>micropython.zip</code>]]<br />
== Introduction ==<br />
Both Infinitime and Wasp-os are very cool OS'es for the [[PineTime]] and many people will want to try both. This is possible, even with a sealed device!<br />
<br />
Both devices use the same Nordic (legacy) DFU protocol for updating firmware over the air. But the BLE stack and the bootloaders for both are different. That's why we need to use the [https://github.com/daniel-thompson/wasp-reloader reloader]. However, instructions you find elsewhere (including [https://www.youtube.com/watch?v=lPasAt1LJmo Daniel Thompsons video]) are somewhat outdated.<br />
<br />
Flashing can be done with any of<br />
* nRF Connect for Mobile ([https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp Android], [https://apps.apple.com/us/app/nrf-connect-bluetooth-app/id1054362403 iOS])<br />
* [https://www.gadgetbridge.org GadgetBridge] (Android >= 4.4)<br />
* [https://github.com/piggz/harbour-amazfish Amazfish] (SailfishOS and Linux)<br />
* [https://github.com/alexr4535/siglo Siglo] (Linux desktop and Pinephone) (Use the 'Manual OTA File' option)<br />
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows)<br />
* ota-dfu-python (Linux CLI) which is included in sources of both Infinitime and Wasp-os<br />
** <code>InfiniTime/bootloader/ota-dfu-python/dfu.py</code><br />
** <code>wasp-os/tools/ota-dfu-python/dfu.py</code><br />
<br />
This guide has been last updated for Infinitime 1.1.0 and Wasp-os 0.4<br />
<br />
== InfiniTime => Wasp-os ==<br />
<br />
All the zips you need can be found on the [https://github.com/daniel-thompson/wasp-os/releases/ Wasp-os Releases] page, for example in [https://github.com/daniel-thompson/wasp-os/releases/download/v0.4/wasp-os-0.4.1.tar.gz wasp-os-0.4.1.tar.gz].<br />
<br />
* Make sure the watch is running Infinitime and can be found by your companion device (PC, phone, etc).<br />
* First we need to flash the reloader, with the wasp-os bootloader as payload. To do this, flash: <br><code>wasp-os-0.4/build-pinetime/reloader-mcuboot.zip</code><br />
* After flashing, it will boot using the Infinitime bootloader (green large pine cone), then it'll hang for a few seconds, then it'll show the reloader animation (blue smaller pine cone), and then it'll boot the wasp-os bootloader.<br />
* Make sure the watch is on the screen with the pine cone and arrow. If it is in a bootloop instead, then reboot the watch by holding the button until the arrow appears.<br />
* Now you can flash micropython with wasp-os: <br><code>wasp-os-0.4/build-pinetime/micropython.zip</code><br />
* Wasp-os should now boot. Enjoy!<br />
<br />
== Wasp-os => InfiniTime ==<br />
[[File:Flash-reloader-infinitime-recovery.jpg|500px|thumb|right|Flashing <code>reloader-infinitime-recovery-0.14.1.zip.zip</code>]]<br />
[[File:Flash-infinitime.jpg|600px|thumb|right|Flashing <code>pinetime-mcuboot-app-dfu-1.1.0.zip.zip</code>]]<br />
<br />
The <code>reloader-factory.zip</code> was broken in the original wasp-os 0.4 but was fixed in the subsequent re-release. However the Infinitime binaries are outdated the 0.4 release and I do not recommend flashing these. Older InfiniTime versions have flaky BLE which makes upgrading from there very unreliable.<br />
<br />
You can get newer bineries from the wasp-os projects CI system (see the [https://wasp-os.readthedocs.io/en/latest/install.html#binary-downloads wasp-os installation guide]) or alternatively, I made my own containing just the [https://github.com/JF002/InfiniTime/releases/tag/0.14.1 InfiniTime 0.14.1] [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/develop/README.md#recovery-firmware recovery firmware]. This allows you to flash any future release of InfiniTime without having to find a new reloader zip. Get the [https://github.com/Peetz0r/wasp-reloader/releases/tag/infinitime-0.14.1-recovery reloader zip here] and the [https://github.com/JF002/InfiniTime/releases latest Infinitime here].<br />
<br />
* Reboot the watch by holding the button until the pine cone arrow appears.<br />
* Flash the reloader zip: <br><code>reloader-infinitime-recovery-0.14.1.zip</code><br />
* After flashing, the reloader will run (blue smaller pine cone), then it'll boot the InfiniTime bootloader (large pine cone) will run.<br />
* Boot the watch into recovery mode by holding the button until the pine cone turns red. It'll boot again (large pine cone will turn green) and then the InfiniTime loo will appear.<br />
* You can now flash InfiniTime 1.1.0 (or any other version): <br><code>pinetime-mcuboot-app-dfu-1.1.0.zip</code><br />
* InfiniTime should now boot. Enjoy!<br />
<br />
<br />
[[Category:PineTime]][[Category:Guide]]</div>Danielthttps://wiki.pine64.org/index.php?title=Switching_your_PineTime_between_InfiniTime_and_Wasp-os&diff=10825Switching your PineTime between InfiniTime and Wasp-os2021-06-23T15:25:18Z<p>Danielt: Fix link to wasp-os binaries.</p>
<hr />
<div>[[File:Flash-reloader-mcuboot.jpg|600px|thumb|right|Flashing <code>reloader-mcuboot.zip</code>]]<br />
[[File:Flash-micropython.jpg|400px|thumb|right|Flashing <code>micropython.zip</code>]]<br />
== Introduction ==<br />
Both Infinitime and Wasp-os are very cool OS'es for the [[PineTime]] and many people will want to try both. This is possible, even with a sealed device!<br />
<br />
Both devices use the same Nordic (legacy) DFU protocol for updating firmware over the air. But the BLE stack and the bootloaders for both are different. That's why we need to use the [https://github.com/daniel-thompson/wasp-reloader reloader]. However, instructions you find elsewhere (including [https://www.youtube.com/watch?v=lPasAt1LJmo Daniel Thompsons video]) are somewhat outdated.<br />
<br />
Flashing can be done with any of<br />
* nRF Connect for Mobile ([https://play.google.com/store/apps/details?id=no.nordicsemi.android.mcp Android], [https://apps.apple.com/us/app/nrf-connect-bluetooth-app/id1054362403 iOS])<br />
* [https://www.gadgetbridge.org GadgetBridge] (Android >= 4.4)<br />
* [https://github.com/piggz/harbour-amazfish Amazfish] (SailfishOS and Linux)<br />
* [https://github.com/alexr4535/siglo Siglo] (Linux desktop and Pinephone) (Use the 'Manual OTA File' option)<br />
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows)<br />
* ota-dfu-python (Linux CLI) which is included in sources of both Infinitime and Wasp-os<br />
** <code>InfiniTime/bootloader/ota-dfu-python/dfu.py</code><br />
** <code>wasp-os/tools/ota-dfu-python/dfu.py</code><br />
<br />
This guide has been last updated for Infinitime 1.1.0 and Wasp-os 0.4<br />
<br />
== InfiniTime => Wasp-os ==<br />
<br />
All the zips you need can be found on the [https://github.com/daniel-thompson/wasp-os/releases/ Wasp-os Releases] page, for example in [https://github.com/daniel-thompson/wasp-os/releases/download/v0.4/wasp-os-0.4.1.tar.gz wasp-os-0.4.1.tar.gz].<br />
<br />
* Make sure the watch is running Infinitime and can be found by your companion device (PC, phone, etc).<br />
* First we need to flash the reloader, with the wasp-os bootloader as payload. To do this, flash: <br><code>wasp-os-0.4/build-pinetime/reloader-mcuboot.zip</code><br />
* After flashing, it will boot using the Infinitime bootloader (green large pine cone), then it'll hang for a few seconds, then it'll show the reloader animation (blue smaller pine cone), and then it'll boot the wasp-os bootloader.<br />
* Make sure the watch is on the screen with the pine cone and arrow. If it is in a bootloop instead, then reboot the watch by holding the button until the arrow appears.<br />
* Now you can flash micropython with wasp-os: <br><code>wasp-os-0.4/build-pinetime/micropython.zip</code><br />
* Wasp-os should now boot. Enjoy!<br />
<br />
== Wasp-os => InfiniTime ==<br />
[[File:Flash-reloader-infinitime-recovery.jpg|500px|thumb|right|Flashing <code>reloader-infinitime-recovery-0.14.1.zip.zip</code>]]<br />
[[File:Flash-infinitime.jpg|600px|thumb|right|Flashing <code>pinetime-mcuboot-app-dfu-1.1.0.zip.zip</code>]]<br />
<br />
The <code>reloader-factory.zip</code> are unfortunately broken in wasp-os 0.4, and very outdated in older releases. I do not recommend flashing these. Older InfiniTime versions have flaky BLE which makes upgrading from there very unreliable. Trying to create new zips containing any recent version of InfiniTime also fails, because it has grown too big to fit inside a zip together with the reloader and bootloader.<br />
<br />
Instead, I made my own containing just the [https://github.com/JF002/InfiniTime/releases/tag/0.14.1 InfiniTime 0.14.1] [https://github.com/JF002/pinetime-mcuboot-bootloader/blob/develop/README.md#recovery-firmware recovery firmware]. This allows you to flash any future release of InfiniTime without having to find a new reloader zip. Get the [https://github.com/Peetz0r/wasp-reloader/releases/tag/infinitime-0.14.1-recovery reloader zip here] and the [https://github.com/JF002/InfiniTime/releases latest Infinitime here].<br />
<br />
* Reboot the watch by holding the button until the pine cone arrow appears.<br />
* Flash the reloader zip: <br><code>reloader-infinitime-recovery-0.14.1.zip</code><br />
* After flashing, the reloader will run (blue smaller pine cone), then it'll boot the InfiniTime bootloader (large pine cone) will run.<br />
* Boot the watch into recovery mode by holding the button until the pine cone turns red. It'll boot again (large pine cone will turn green) and then the InfiniTime loo will appear.<br />
* You can now flash InfiniTime 1.1.0 (or any other version): <br><code>pinetime-mcuboot-app-dfu-1.1.0.zip</code><br />
* InfiniTime should now boot. Enjoy!<br />
<br />
<br />
[[Category:PineTime]][[Category:Guide]]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=7059PineTime2020-09-13T19:39:31Z<p>Danielt: /* Manuals */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [[Frequently asked questions about the PineTime| Frequently Asked Questions about the devkit]]<br />
* [[Lup Yuen Lee Q&A about PineTime| Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]]<br />
* [[Reprogramming the PineTime]]<br />
* [[PineTime devkit wiring]]<br />
<br />
== Current default OS ==<br />
<br />
The current default operating system on the PineTime is called [[InfiniTime]], first devkits shipped with a proprietary custom firmware. The project was started by JF002 and is shipped with the latest edition of PineTime. You can use various companion apps with the OS, for example Gadgetbridge.<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
<br />
or with OpenOCD<br />
- issue the command ''halt''<br />
- issue the command ''flash fillw 0x10001208 0xFFFFFF00 0x01''<br />
- issue the command ''reset''<br />
<br />
you can check if the debug port is enabled using the following code<br />
DWT->CYCCNT ? "NO":"YES"<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to your software.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del><br />
<br />
== Manuals ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
* [https://wasp-os.readthedocs.io/en/latest/ Wasp-os documentation (full manual with install instructions and an application writer's guide)]<br />
<br />
== Articles and blog posts == <br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
|<br />
{|<br />
|[[InfiniTime]] ([https://github.com/JF002/Pinetime JF002/Pinetime])<br />
|-<br />
|[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
|}<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|-<br />
|[https://github.com/endian-albin/pinetime-hypnos endian-albin/pinetime-hypnos]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
|<br />
{|<br />
|[https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
|-<br />
|[https://gitlab.com/caspermeijn/klok caspermeijn/klok]<br />
|}<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
|<br />
{|<br />
|[https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
|-<br />
|[https://github.com/geoffrey-vl/mbed-pinetime geoffrey.vl/mbed-pinetime]<br />
|}<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! wasp-os (MicroPython)<br />
| https://wasp-os.readthedocs.io/<br />
| https://github.com/daniel-thompson/wasp-os<br />
| [https://wasp-os.readthedocs.io/en/latest/install.html#pine64-pinetime-developer-edition PineTime install guide]<br />
<br />
|-<br />
! Rust + RTFM<br />
| https://rtfm.rs/<br />
| [https://github.com/rtfm-rs/cortex-m-rtfm rtfm-rs/cortex-m-rtfm]<br />
| https://github.com/dbrgn/pinetime-rtfm/<br />
<br />
|-<br />
! Bare Metal<br />
| <br />
|<br />
{|<br />
|https://github.com/xriss/timecake<br />
|-<br />
|https://github.com/Arc13/Pyrus<br />
|}<br />
|<br />
{|<br />
|[https://github.com/xriss/timecake xriss/timecake]<br />
|-<br />
|[https://github.com/Arc13/Pyrus Arc13/Pyrus]<br />
|}<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
! Useful drivers<br />
|<br />
| https://github.com/sethitow/mbed-pinetime<br />
| [https://github.com/sethitow/mbed-pinetime/tree/master/drivers https://github.com/sethitow/mbed-pinetime]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetime-os arteeh/pinetime-os]<br />
|-<br />
! Linux companion app<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetime-companion arteeh/pinetime-companion]<br />
|-<br />
! Android companion app<br />
| https://gadgetbridge.org/<br />
| https://codeberg.org/Freeyourgadget/Gadgetbridge<br />
| [https://github.com/JF002/Pinetime InfiniTime] [https://codeberg.org/Freeyourgadget/Gadgetbridge/commit/9b8f4d329e49cafdfe0497ed38a715faa9f844c6 initial support added]<br />
|-<br />
! Arduino<br />
| https://youtu.be/4aFDjymXjOw<br />
| https://github.com/atc1441/ATCwatch<br />
| https://github.com/atc1441/ATCwatch<br />
|-<br />
! OTA Update Flasher / DaFlasher<br />
| https://youtu.be/gUVEz-pxhgg<br />
| https://github.com/atc1441/DaFlasherFiles<br />
| https://github.com/atc1441/DaFlasherFiles<br />
|-<br />
|}<br />
<br />
=== Wishlist ===<br />
<br />
In order to keep track of features and changes to the hardware people would like to see, check out this article: [[PineTime hardware wishlist]]<br />
<br />
=== Compatibility with other projects ===<br />
<br />
Different firmware running using different bootloaders and Bluetooth stacks on the nRF52832 have different requirements on how they should be initialised and what should be placed where in the internal flash.<br />
<br />
To keep track of what, how and why things work like they do across the different projects, check out the [[PineTime SD MCUBoot|PineTime SoftDevice and MCUBoot compatibility]] article.<br />
<br />
=== Compatibility with companions apps ===<br />
<br />
There are many firmwares running on Pinetime that implement different BLE APIs (time synchronization, notifications,...). Companion apps must be able to differentiate between different firmwares and forks of the same firmware. See [[Firmware versioning for companion apps]].<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Chip Datasheets ===<br />
* NORDIC nRF52832 information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]<br />
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.1.pdf nRF52832 Product Specification v1.1]<br />
* ARMv7-M information:<br />
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]<br />
<br />
=== Component Datasheets ===<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://app.element.io/#/room/#pinetime:matrix.org Matrix Channel] (No login required to read)<br />
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]<br />
<br />
= PineTime equivalents and jailbreaking =<br />
<br />
This page contains a list of PineTime-like smartwatches that might be "jailbreakable" or a good source for ideas for the PineTime: [[PineTime Equivalents]]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=7058PineTime2020-09-13T19:37:45Z<p>Danielt: /* Manuals / Articles */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [[Frequently asked questions about the PineTime| Frequently Asked Questions about the devkit]]<br />
* [[Lup Yuen Lee Q&A about PineTime| Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]]<br />
* [[Reprogramming the PineTime]]<br />
* [[PineTime devkit wiring]]<br />
<br />
== Current default OS ==<br />
<br />
The current default operating system on the PineTime is called [[InfiniTime]], first devkits shipped with a proprietary custom firmware. The project was started by JF002 and is shipped with the latest edition of PineTime. You can use various companion apps with the OS, for example Gadgetbridge.<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
<br />
or with OpenOCD<br />
- issue the command ''halt''<br />
- issue the command ''flash fillw 0x10001208 0xFFFFFF00 0x01''<br />
- issue the command ''reset''<br />
<br />
you can check if the debug port is enabled using the following code<br />
DWT->CYCCNT ? "NO":"YES"<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to your software.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del><br />
<br />
== Manuals ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
== Articles and blog posts == <br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
|<br />
{|<br />
|[[InfiniTime]] ([https://github.com/JF002/Pinetime JF002/Pinetime])<br />
|-<br />
|[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
|}<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|-<br />
|[https://github.com/endian-albin/pinetime-hypnos endian-albin/pinetime-hypnos]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
|<br />
{|<br />
|[https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
|-<br />
|[https://gitlab.com/caspermeijn/klok caspermeijn/klok]<br />
|}<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
|<br />
{|<br />
|[https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
|-<br />
|[https://github.com/geoffrey-vl/mbed-pinetime geoffrey.vl/mbed-pinetime]<br />
|}<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! wasp-os (MicroPython)<br />
| https://wasp-os.readthedocs.io/<br />
| https://github.com/daniel-thompson/wasp-os<br />
| [https://wasp-os.readthedocs.io/en/latest/install.html#pine64-pinetime-developer-edition PineTime install guide]<br />
<br />
|-<br />
! Rust + RTFM<br />
| https://rtfm.rs/<br />
| [https://github.com/rtfm-rs/cortex-m-rtfm rtfm-rs/cortex-m-rtfm]<br />
| https://github.com/dbrgn/pinetime-rtfm/<br />
<br />
|-<br />
! Bare Metal<br />
| <br />
|<br />
{|<br />
|https://github.com/xriss/timecake<br />
|-<br />
|https://github.com/Arc13/Pyrus<br />
|}<br />
|<br />
{|<br />
|[https://github.com/xriss/timecake xriss/timecake]<br />
|-<br />
|[https://github.com/Arc13/Pyrus Arc13/Pyrus]<br />
|}<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
! Useful drivers<br />
|<br />
| https://github.com/sethitow/mbed-pinetime<br />
| [https://github.com/sethitow/mbed-pinetime/tree/master/drivers https://github.com/sethitow/mbed-pinetime]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetime-os arteeh/pinetime-os]<br />
|-<br />
! Linux companion app<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetime-companion arteeh/pinetime-companion]<br />
|-<br />
! Android companion app<br />
| https://gadgetbridge.org/<br />
| https://codeberg.org/Freeyourgadget/Gadgetbridge<br />
| [https://github.com/JF002/Pinetime InfiniTime] [https://codeberg.org/Freeyourgadget/Gadgetbridge/commit/9b8f4d329e49cafdfe0497ed38a715faa9f844c6 initial support added]<br />
|-<br />
! Arduino<br />
| https://youtu.be/4aFDjymXjOw<br />
| https://github.com/atc1441/ATCwatch<br />
| https://github.com/atc1441/ATCwatch<br />
|-<br />
! OTA Update Flasher / DaFlasher<br />
| https://youtu.be/gUVEz-pxhgg<br />
| https://github.com/atc1441/DaFlasherFiles<br />
| https://github.com/atc1441/DaFlasherFiles<br />
|-<br />
|}<br />
<br />
=== Wishlist ===<br />
<br />
In order to keep track of features and changes to the hardware people would like to see, check out this article: [[PineTime hardware wishlist]]<br />
<br />
=== Compatibility with other projects ===<br />
<br />
Different firmware running using different bootloaders and Bluetooth stacks on the nRF52832 have different requirements on how they should be initialised and what should be placed where in the internal flash.<br />
<br />
To keep track of what, how and why things work like they do across the different projects, check out the [[PineTime SD MCUBoot|PineTime SoftDevice and MCUBoot compatibility]] article.<br />
<br />
=== Compatibility with companions apps ===<br />
<br />
There are many firmwares running on Pinetime that implement different BLE APIs (time synchronization, notifications,...). Companion apps must be able to differentiate between different firmwares and forks of the same firmware. See [[Firmware versioning for companion apps]].<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Chip Datasheets ===<br />
* NORDIC nRF52832 information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]<br />
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.1.pdf nRF52832 Product Specification v1.1]<br />
* ARMv7-M information:<br />
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]<br />
<br />
=== Component Datasheets ===<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://app.element.io/#/room/#pinetime:matrix.org Matrix Channel] (No login required to read)<br />
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]<br />
<br />
= PineTime equivalents and jailbreaking =<br />
<br />
This page contains a list of PineTime-like smartwatches that might be "jailbreakable" or a good source for ideas for the PineTime: [[PineTime Equivalents]]</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=7057Reprogramming the PineTime2020-09-13T19:32:16Z<p>Danielt: /* SWD Pinout */</p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
'''Before you can use your debugger/programmer, you probably have to [[PineTime devkit wiring|wire up your pinetime]].'''<br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= SWD Pinout =<br />
<br />
The devkits have exposed SWD pins for flashing and debugging. A few developers have soldered to these pins but most just use friction to make contact with the programming cable. <br />
<br />
The pinout is: <br />
<br />
[[File:PineTime_SWD_location.jpg|400px]]<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done in two ways:<br />
<br />
Appending this to OpenOCD command line:<br />
<br />
-c 'nrf52.dap apreg 1 0x04' -c 'nrf52.dap apreg 1 0x04 0x01' -c 'nrf52.dap apreg 1 0x04'<br />
<br />
Or by using the telnet connection, just type in ''telnet localhost 4444'' and then you can issue commands to OpenOCD:<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
= External links and additional tutorials = <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=7056Reprogramming the PineTime2020-09-13T19:31:04Z<p>Danielt: </p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
'''Before you can use your debugger/programmer, you probably have to [[PineTime devkit wiring|wire up your pinetime]].'''<br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= SWD Pinout =<br />
<br />
The devkits have exposed SWD pins for flashing and debugging. A few developers have soldered to these pins but most just use friction to make contact with the programming cable. <br />
<br />
The pinout is: <br />
<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done in two ways:<br />
<br />
Appending this to OpenOCD command line:<br />
<br />
-c 'nrf52.dap apreg 1 0x04' -c 'nrf52.dap apreg 1 0x04 0x01' -c 'nrf52.dap apreg 1 0x04'<br />
<br />
Or by using the telnet connection, just type in ''telnet localhost 4444'' and then you can issue commands to OpenOCD:<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
= External links and additional tutorials = <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=7055Reprogramming the PineTime2020-09-13T19:30:48Z<p>Danielt: </p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
'''Before you can use your debugger/programmer, you probably have to [[PineTime devkit wiring|wire up your pinetime]].'''<br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
== SWD Pinout ==<br />
<br />
The devkits have exposed SWD pins for flashing and debugging. A few developers have soldered to these pins but most just use friction to make contact with the programming cable. <br />
<br />
The pinout is: <br />
<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done in two ways:<br />
<br />
Appending this to OpenOCD command line:<br />
<br />
-c 'nrf52.dap apreg 1 0x04' -c 'nrf52.dap apreg 1 0x04 0x01' -c 'nrf52.dap apreg 1 0x04'<br />
<br />
Or by using the telnet connection, just type in ''telnet localhost 4444'' and then you can issue commands to OpenOCD:<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
= External links and additional tutorials = <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_SD_MCUBoot&diff=6529PineTime SD MCUBoot2020-08-11T08:15:50Z<p>Danielt: /* External resources about custom MBR */</p>
<hr />
<div>== The Problem ==<br />
<br />
- PineTime ships with the MCUBoot bootloader which boots to the [[InfiniTime]] Firmware<br />
<br />
- This assumes that the firmware ([[InfiniTime]], Mynewt, Zephyr, ...) has its own Bluetooth LE (BLE) stack and can handle firmware updates (DFU)<br />
<br />
- But some firmware (wasp-os, ATCwatch) require Nordic SoftDevice to be installed to support the BLE and DFU functions<br />
<br />
- [[InfiniTime]] Firmware does not support flashing of SoftDevice as firmware update, because SoftDevice is usually flashed at address 0x1000 (plus a 4k MBR at 0 to switch between the bootloader and the softdevice), which is used by the MCUBoot Bootloader<br />
== How do we allow SoftDevice-based firmware to be flashed to PineTime via DFU? ==<br />
<br />
=== Dual Bootloader Modes ===<br />
<br />
- PineTime will support 2 Bootloader Modes: [https://github.com/JuulLabs-OSS/mcuboot/wiki MCUBoot] and SoftDevice. Default is MCUBoot Mode.<br />
<br />
- The two bootloaders will not coexist, they will be mutually exclusive. This allows a different flash ROM map for each bootloader.<br />
<br />
To switch from MCUBoot Mode to SoftDevice Mode:<br />
<br />
- We will use DFU to flash a SoftDevice Loader Firmware, which will boot and replace MCUBoot by SoftDevice<br />
<br />
- Thereafter, when PineTime boots, it will start SoftDevice and will be ready to accept SoftDevice-based firmware for DFU: wasp-os, ATCWatch<br />
<br />
To switch from SoftDevice Mode to MCUBoot Mode:<br />
<br />
- When we need to switch back to MCUBoot-based firmware (InfiniTime, Mynewt, Zephyr, ...), we will run an MCUBoot Loader (based on https://github.com/daniel-thompson/wasp-reloader<br />
) to replace SoftDevice by MCUBoot plus a Minimal DFU Firmware that accepts DFU commands<br />
<br />
- After rebooting, MCUBoot starts the Minimal DFU Firmware, which will accept MCUBoot-based firmware for flashing<br />
<br />
- The MCUBoot-based firmware replaces the Minimal DFU Firmware<br />
<br />
==== Switching modes with Companion App ====<br />
<br />
- The PineTime Companion App (e.g. Gadgetbridge) will switch modes automatically depending on the firmware to be flashed. So PineTime Owners will never have to switch modes themselves.<br />
<br />
- For SoftDevice-based firmware, the Companion App will also know which SoftDevice version is needed by the firmware, and load the right SoftDevice version.<br />
<br />
=== Custom MBR ===<br />
<br />
It's possible to customise (SoftDevice's) MBR so that it can coexist with MCUBoot.<br />
<br />
'''Pros:'''<br />
<br />
* Seamless switching between the two different boot modes. Both MCUBoot and SD can be used.<br />
<br />
'''Cons:'''<br />
<br />
* Technically more complex - documentation isn't the best, SoftDevice's future support for custom MBR might be unknown<br />
<br />
Should be explored further.<br />
<br />
==== External resources about custom MBR ====<br />
<br />
* https://devzone.nordicsemi.com/f/nordic-q-a/27599/boot-sequence-for-nrf52832<br />
* https://aykevl.nl/2018/01/mbr-softdevice-internals<br />
* https://forum.pine64.org/showthread.php?tid=9779&pid=65203#pid65203<br />
<br />
==== wasp-reloader ====<br />
<br />
wasp-reloader is a simple bare-metal C program that, in a fairly brutal fashion, can rewrite critical parts of the internal flash. It has fairly robust checksumming to avoid flashing problems and verifies that what it written is what is supposed to be written. Having said that more checks (no self-overwrite, battery level) would be nice. When complete it stops updating the watchdog in order to provoke get a clean reset. As a standalone app it can be loaded into the secondary slot using Infinitime DFU upgrade.<br />
<br />
Currently it has linker scripts for SD132 V6.1.1 and can flash any payload smaller than SD132.<br />
<br />
To be used to install SoftDevice from mcuboot it would need linker scripts for mcuboot (to ensure the reloader sits high enough in flash to avoid a self-overwrite). To install mcuboot we need an Intel HEX file of the mcuboot payload *and* InfiniTime (we have to write it in one shot to keep BLE updates working after switching bootloaders). This may need custom linker scripts depending on how big the Infinitime binaries are.</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_SD_MCUBoot&diff=6528PineTime SD MCUBoot2020-08-11T08:14:41Z<p>Danielt: </p>
<hr />
<div>== The Problem ==<br />
<br />
- PineTime ships with the MCUBoot bootloader which boots to the [[InfiniTime]] Firmware<br />
<br />
- This assumes that the firmware ([[InfiniTime]], Mynewt, Zephyr, ...) has its own Bluetooth LE (BLE) stack and can handle firmware updates (DFU)<br />
<br />
- But some firmware (wasp-os, ATCwatch) require Nordic SoftDevice to be installed to support the BLE and DFU functions<br />
<br />
- [[InfiniTime]] Firmware does not support flashing of SoftDevice as firmware update, because SoftDevice is usually flashed at address 0x1000 (plus a 4k MBR at 0 to switch between the bootloader and the softdevice), which is used by the MCUBoot Bootloader<br />
== How do we allow SoftDevice-based firmware to be flashed to PineTime via DFU? ==<br />
<br />
=== Dual Bootloader Modes ===<br />
<br />
- PineTime will support 2 Bootloader Modes: [https://github.com/JuulLabs-OSS/mcuboot/wiki MCUBoot] and SoftDevice. Default is MCUBoot Mode.<br />
<br />
- The two bootloaders will not coexist, they will be mutually exclusive. This allows a different flash ROM map for each bootloader.<br />
<br />
To switch from MCUBoot Mode to SoftDevice Mode:<br />
<br />
- We will use DFU to flash a SoftDevice Loader Firmware, which will boot and replace MCUBoot by SoftDevice<br />
<br />
- Thereafter, when PineTime boots, it will start SoftDevice and will be ready to accept SoftDevice-based firmware for DFU: wasp-os, ATCWatch<br />
<br />
To switch from SoftDevice Mode to MCUBoot Mode:<br />
<br />
- When we need to switch back to MCUBoot-based firmware (InfiniTime, Mynewt, Zephyr, ...), we will run an MCUBoot Loader (based on https://github.com/daniel-thompson/wasp-reloader<br />
) to replace SoftDevice by MCUBoot plus a Minimal DFU Firmware that accepts DFU commands<br />
<br />
- After rebooting, MCUBoot starts the Minimal DFU Firmware, which will accept MCUBoot-based firmware for flashing<br />
<br />
- The MCUBoot-based firmware replaces the Minimal DFU Firmware<br />
<br />
==== Switching modes with Companion App ====<br />
<br />
- The PineTime Companion App (e.g. Gadgetbridge) will switch modes automatically depending on the firmware to be flashed. So PineTime Owners will never have to switch modes themselves.<br />
<br />
- For SoftDevice-based firmware, the Companion App will also know which SoftDevice version is needed by the firmware, and load the right SoftDevice version.<br />
<br />
=== Custom MBR ===<br />
<br />
It's possible to customise (SoftDevice's) MBR so that it can coexist with MCUBoot.<br />
<br />
'''Pros:'''<br />
<br />
* Seamless switching between the two different boot modes. Both MCUBoot and SD can be used.<br />
<br />
'''Cons:'''<br />
<br />
* Technically more complex - documentation isn't the best, SoftDevice's future support for custom MBR might be unknown<br />
<br />
Should be explored further.<br />
<br />
==== External resources about custom MBR ====<br />
<br />
* https://devzone.nordicsemi.com/f/nordic-q-a/27599/boot-sequence-for-nrf52832<br />
* https://forum.pine64.org/showthread.php?tid=9779&pid=65203#pid65203<br />
<br />
==== wasp-reloader ====<br />
<br />
wasp-reloader is a simple bare-metal C program that, in a fairly brutal fashion, can rewrite critical parts of the internal flash. It has fairly robust checksumming to avoid flashing problems and verifies that what it written is what is supposed to be written. Having said that more checks (no self-overwrite, battery level) would be nice. When complete it stops updating the watchdog in order to provoke get a clean reset. As a standalone app it can be loaded into the secondary slot using Infinitime DFU upgrade.<br />
<br />
Currently it has linker scripts for SD132 V6.1.1 and can flash any payload smaller than SD132.<br />
<br />
To be used to install SoftDevice from mcuboot it would need linker scripts for mcuboot (to ensure the reloader sits high enough in flash to avoid a self-overwrite). To install mcuboot we need an Intel HEX file of the mcuboot payload *and* InfiniTime (we have to write it in one shot to keep BLE updates working after switching bootloaders). This may need custom linker scripts depending on how big the Infinitime binaries are.</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_SD_MCUBoot&diff=6527PineTime SD MCUBoot2020-08-11T08:13:49Z<p>Danielt: </p>
<hr />
<div>== The Problem ==<br />
<br />
- PineTime ships with the MCUBoot bootloader which boots to the [[InfiniTime]] Firmware<br />
<br />
- This assumes that the firmware ([[InfiniTime]], Mynewt, Zephyr, ...) has its own Bluetooth LE (BLE) stack and can handle firmware updates (DFU)<br />
<br />
- But some firmware (wasp-os, ATCwatch) require Nordic SoftDevice to be installed to support the BLE and DFU functions<br />
<br />
- [[InfiniTime]] Firmware does not support flashing of SoftDevice as firmware update, because SoftDevice is usually flashed at address 0x1000, which is used by the MCUBoot Bootloader<br />
<br />
== How do we allow SoftDevice-based firmware to be flashed to PineTime via DFU? ==<br />
<br />
=== Dual Bootloader Modes ===<br />
<br />
- PineTime will support 2 Bootloader Modes: [https://github.com/JuulLabs-OSS/mcuboot/wiki MCUBoot] and SoftDevice. Default is MCUBoot Mode.<br />
<br />
- The two bootloaders will not coexist, they will be mutually exclusive. This allows a different flash ROM map for each bootloader.<br />
<br />
To switch from MCUBoot Mode to SoftDevice Mode:<br />
<br />
- We will use DFU to flash a SoftDevice Loader Firmware, which will boot and replace MCUBoot by SoftDevice<br />
<br />
- Thereafter, when PineTime boots, it will start SoftDevice and will be ready to accept SoftDevice-based firmware for DFU: wasp-os, ATCWatch<br />
<br />
To switch from SoftDevice Mode to MCUBoot Mode:<br />
<br />
- When we need to switch back to MCUBoot-based firmware (InfiniTime, Mynewt, Zephyr, ...), we will run an MCUBoot Loader (based on https://github.com/daniel-thompson/wasp-reloader<br />
) to replace SoftDevice by MCUBoot plus a Minimal DFU Firmware that accepts DFU commands<br />
<br />
- After rebooting, MCUBoot starts the Minimal DFU Firmware, which will accept MCUBoot-based firmware for flashing<br />
<br />
- The MCUBoot-based firmware replaces the Minimal DFU Firmware<br />
<br />
==== Switching modes with Companion App ====<br />
<br />
- The PineTime Companion App (e.g. Gadgetbridge) will switch modes automatically depending on the firmware to be flashed. So PineTime Owners will never have to switch modes themselves.<br />
<br />
- For SoftDevice-based firmware, the Companion App will also know which SoftDevice version is needed by the firmware, and load the right SoftDevice version.<br />
<br />
=== Custom MBR ===<br />
<br />
It's possible to customise (SoftDevice's) MBR so that it can coexist with MCUBoot.<br />
<br />
'''Pros:'''<br />
<br />
* Seamless switching between the two different boot modes. Both MCUBoot and SD can be used.<br />
<br />
'''Cons:'''<br />
<br />
* Technically more complex - documentation isn't the best, SoftDevice's future support for custom MBR might be unknown<br />
<br />
Should be explored further.<br />
<br />
==== External resources about custom MBR ====<br />
<br />
* https://devzone.nordicsemi.com/f/nordic-q-a/27599/boot-sequence-for-nrf52832<br />
* https://forum.pine64.org/showthread.php?tid=9779&pid=65203#pid65203<br />
<br />
==== wasp-reloader ====<br />
<br />
wasp-reloader is a simple bare-metal C program that, in a fairly brutal fashion, can rewrite critical parts of the internal flash. It has fairly robust checksumming to avoid flashing problems and verifies that what it written is what is supposed to be written. Having said that more checks (no self-overwrite, battery level) would be nice. When complete it stops updating the watchdog in order to provoke get a clean reset. As a standalone app it can be loaded into the secondary slot using Infinitime DFU upgrade.<br />
<br />
Currently it has linker scripts for SD132 V6.1.1 and can flash any payload smaller than SD132.<br />
<br />
To be used to install SoftDevice from mcuboot it would need linker scripts for mcuboot (to ensure the reloader sits high enough in flash to avoid a self-overwrite). To install mcuboot we need an Intel HEX file of the mcuboot payload *and* InfiniTime (we have to write it in one shot to keep BLE updates working after switching bootloaders). This may need custom linker scripts depending on how big the Infinitime binaries are.</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_SD_MCUBoot&diff=6498PineTime SD MCUBoot2020-08-10T16:55:16Z<p>Danielt: </p>
<hr />
<div>The Problem:<br />
<br />
- PineTime ships with the MCUBoot Bootloader which boots to the InfiniTime Firmware<br />
<br />
- This assumes that the firmware (InfiniTime, Mynewt, Zephyr, ...) has its own Bluetooth LE (BLE) stack and can handle firmware updates (DFU)<br />
<br />
- But some firmware (wasp-os, ATCwatch) require Nordic SoftDevice to be installed to support the BLE and DFU functions<br />
<br />
- InfiniTime Firmware does not support flashing of SoftDevice as firmware update, because SoftDevice needs to be flashed at address 0x1000, which is currently used by the MCUBoot Bootloader<br />
<br />
- How do we allow SoftDevice-based firmware to be flashed to PineTime via DFU?<br />
<br />
Preferred Solution:<br />
<br />
- We will use DFU to flash a SoftDevice Loader Firmware, which will boot and replace MCUBoot by SoftDevice<br />
<br />
- Thereafter, when PineTime boots, it will start SoftDevice and will be ready to accept SoftDevice-based firmware for DFU: wasp-os, ATCWatch<br />
<br />
- When we need to switch back to MCUBoot-based firmware (InfiniTime, Mynewt, Zephyr, ...), we will run an MCUBoot Loader to replace SoftDevice by MCUBoot plus a Minimal DFU Firmware that accepts DFU commands<br />
<br />
- After rebooting, MCUBoot starts the Minimal DFU Firmware, which will accept MCUBoot-based firmware for flashing<br />
<br />
- The MCUBoot-based firmware replaces the Minimal DFU Firmware<br />
<br />
- SoftDevice Loader, https://github.com/daniel-thompson/wasp-reloader.<br />
<br />
Alternative Solution:<br />
<br />
- Custom MBR: https://forum.pine64.org/showthread.php?tid=9779&pid=65203#pid65203<br />
<br />
wasp-reloader<br />
-------------<br />
<br />
wasp-reloader is a simple bare-metal C program that, in a fairly brutal fashion, can rewrite critical parts of the internal flash. It has fairly robust checksumming to avoid flashing problems and verifies that what it written is what is supposed to be written. Having said that more checks (no self-overwrite, battery level) would be nice. When complete it stops updating the watchdog in order to provoke get a clean reset. As a standalone app it can be loaded into the secondary slot using Infinitime DFU upgrade.<br />
<br />
Currently it has linker scripts for SD132 V6.1.1 and can flash any payload smaller than SD132.<br />
<br />
To be used to install SoftDevice from mcuboot it would need linker scripts for mcuboot (to ensure the reloader sits high enough in flash to avoid a self-overwrite). To install mcuboot we need an Intel HEX file of the mcuboot payload *and* InfiniTime (we have to write it in one shot to keep BLE updates working after switching bootloaders). This may need custom linker scripts depending on how big the Infinitime binaries are.</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime_SD_MCUBoot&diff=6497PineTime SD MCUBoot2020-08-10T16:49:45Z<p>Danielt: </p>
<hr />
<div>The Problem:<br />
<br />
- PineTime ships with the MCUBoot Bootloader which boots to the InfiniTime Firmware<br />
<br />
- This assumes that the firmware (InfiniTime, Mynewt, Zephyr, ...) has its own Bluetooth LE (BLE) stack and can handle firmware updates (DFU)<br />
<br />
- But some firmware (wasp-os, ATCwatch) require Nordic SoftDevice to be installed to support the BLE and DFU functions<br />
<br />
- InfiniTime Firmware does not support flashing of SoftDevice as firmware update, because SoftDevice needs to be flashed at address 0x0, which is used by the MCUBoot Bootloader<br />
<br />
- How do we allow SoftDevice-based firmware to be flashed to PineTime via DFU?<br />
<br />
Preferred Solution:<br />
<br />
- We will use DFU to flash a SoftDevice Loader Firmware, which will boot and replace MCUBoot by SoftDevice<br />
<br />
- Thereafter, when PineTime boots, it will start SoftDevice and will be ready to accept SoftDevice-based firmware for DFU: wasp-os, ATCWatch<br />
<br />
- When we need to switch back to MCUBoot-based firmware (InfiniTime, Mynewt, Zephyr, ...), we will run an MCUBoot Loader to replace SoftDevice by MCUBoot plus a Minimal DFU Firmware that accepts DFU commands<br />
<br />
- After rebooting, MCUBoot starts the Minimal DFU Firmware, which will accept MCUBoot-based firmware for flashing<br />
<br />
- The MCUBoot-based firmware replaces the Minimal DFU Firmware<br />
<br />
- SoftDevice Loader, https://github.com/daniel-thompson/wasp-reloader.<br />
<br />
Alternative Solution:<br />
<br />
- Custom MBR: https://forum.pine64.org/showthread.php?tid=9779&pid=65203#pid65203<br />
<br />
wasp-reloader<br />
-------------<br />
<br />
wasp-reloader is a simple bare-metal C program that, in a fairly brutal fashion, can rewrite critical parts of the internal flash. It has fairly robust checksumming to avoid flashing problems and verifies that what it written is what is supposed to be written. Having said that more checks (no self-overwrite, battery level) would be nice. When complete it stops updating the watchdog in order to provoke get a clean reset. As a standalone app it can be loaded into the secondary slot using Infinitime DFU upgrade.<br />
<br />
Currently it has linker scripts for SD132 V6.1.1 and can flash any payload smaller than SD132.<br />
<br />
To be used to install SoftDevice from mcuboot it would need linker scripts for mcuboot (to ensure the reloader sits high enough in flash to avoid a self-overwrite). To install mcuboot we need an Intel HEX file of the mcuboot payload *and* InfiniTime (we have to write it in one shot to keep BLE updates working after switching bootloaders). This may need custom linker scripts depending on how big the Infinitime binaries are.</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=6356PineTime2020-07-30T14:22:46Z<p>Danielt: </p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging.<br />
<br />
Only a few devs have soldered to these pins, most just use friction to make contact with the programming cable.<br />
<br />
The pinout is: <br />
<br />
<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
<br />
or with OpenOCD<br />
- issue the command ''halt''<br />
- issue the command ''flash fillw 0x10001208 0xFFFFFF00 0x01''<br />
- issue the command ''reset''<br />
<br />
you can check if the debug port is enabled using the following code<br />
DWT->CYCCNT ? "NO":"YES"<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to your software.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del><br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
|<br />
{|<br />
|[https://github.com/JF002/Pinetime JF002/Pinetime]<br />
|-<br />
|[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
|}<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|-<br />
|[https://github.com/endian-albin/pinetime-hypnos endian-albin/pinetime-hypnos]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
|<br />
{|<br />
|[https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
|-<br />
|[https://github.com/geoffrey-vl/mbed-pinetime geoffrey.vl/mbed-pinetime]<br />
|}<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! wasp-os (MicroPython)<br />
| https://wasp-os.readthedocs.io/<br />
| https://github.com/daniel-thompson/wasp-os<br />
| [https://wasp-os.readthedocs.io/en/latest/install.html#pine64-pinetime-developer-edition PineTime install guide]<br />
<br />
|-<br />
! Rust + RTFM<br />
| https://rtfm.rs/<br />
| [https://github.com/rtfm-rs/cortex-m-rtfm rtfm-rs/cortex-m-rtfm]<br />
| https://github.com/dbrgn/pinetime-rtfm/<br />
<br />
|-<br />
! Bare Metal<br />
| <br />
|<br />
{|<br />
|https://github.com/xriss/timecake<br />
|-<br />
|https://github.com/Arc13/Pyrus<br />
|}<br />
|<br />
{|<br />
|[https://github.com/xriss/timecake xriss/timecake]<br />
|-<br />
|[https://github.com/Arc13/Pyrus Arc13/Pyrus]<br />
|}<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
! Useful drivers<br />
|<br />
| https://github.com/sethitow/mbed-pinetime<br />
| [https://github.com/sethitow/mbed-pinetime/tree/master/drivers https://github.com/sethitow/mbed-pinetime]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
|-<br />
! Arduino<br />
| https://youtu.be/4aFDjymXjOw<br />
| https://github.com/atc1441/ATCwatch<br />
| https://github.com/atc1441/ATCwatch<br />
|-<br />
! OTA Update Flasher / DaFlasher<br />
| https://youtu.be/gUVEz-pxhgg<br />
| https://github.com/atc1441/DaFlasherFiles<br />
| https://github.com/atc1441/DaFlasherFiles<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Chip Datasheets ===<br />
* NORDIC nRF52832 information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]<br />
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.1.pdf nRF52832 Product Specification v1.1]<br />
* ARMv7-M information:<br />
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]<br />
<br />
=== Component Datasheets ===<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC Server: irc.pine64.org Channel: PineTime<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=6355PineTime2020-07-30T14:19:58Z<p>Danielt: </p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging.<br />
<br />
Only a few devs have soldered to these pins, most just use friction to make contact with the programming cable.<br />
<br />
The pinout is: <br />
<br />
<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
<br />
or with OpenOCD<br />
- issue the command ''halt''<br />
- issue the command ''flash fillw 0x10001208 0xFFFFFF00 0x01''<br />
- issue the command ''reset''<br />
<br />
you can check if the debug port is enabled using the following code<br />
DWT->CYCCNT ? "NO":"YES"<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to your software.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del><br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
|<br />
{|<br />
|[https://github.com/JF002/Pinetime JF002/Pinetime]<br />
|-<br />
|[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
|}<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|-<br />
|[https://github.com/endian-albin/pinetime-hypnos endian-albin/pinetime-hypnos]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
|<br />
{|<br />
|[https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
|-<br />
|[https://github.com/geoffrey-vl/mbed-pinetime geoffrey.vl/mbed-pinetime]<br />
|}<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! wasp-os (MicroPython)<br />
| https://wasp-os.readthedocs.io/<br />
| https://github.com/daniel-thompson/wasp-os<br />
| [https://wasp-os.readthedocs.io/en/latest/install.html#pine64-pinetime-developer-edition]<br />
<br />
|-<br />
! Rust + RTFM<br />
| https://rtfm.rs/<br />
| [https://github.com/rtfm-rs/cortex-m-rtfm rtfm-rs/cortex-m-rtfm]<br />
| https://github.com/dbrgn/pinetime-rtfm/<br />
<br />
|-<br />
! Bare Metal<br />
| <br />
|<br />
{|<br />
|https://github.com/xriss/timecake<br />
|-<br />
|https://github.com/Arc13/Pyrus<br />
|}<br />
|<br />
{|<br />
|[https://github.com/xriss/timecake xriss/timecake]<br />
|-<br />
|[https://github.com/Arc13/Pyrus Arc13/Pyrus]<br />
|}<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
! Useful drivers<br />
|<br />
| https://github.com/sethitow/mbed-pinetime<br />
| [https://github.com/sethitow/mbed-pinetime/tree/master/drivers https://github.com/sethitow/mbed-pinetime]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
|-<br />
! Arduino<br />
| https://youtu.be/4aFDjymXjOw<br />
| https://github.com/atc1441/ATCwatch<br />
| https://github.com/atc1441/ATCwatch<br />
|-<br />
! OTA Update Flasher / DaFlasher<br />
| https://youtu.be/gUVEz-pxhgg<br />
| https://github.com/atc1441/DaFlasherFiles<br />
| https://github.com/atc1441/DaFlasherFiles<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Chip Datasheets ===<br />
* NORDIC nRF52832 information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]<br />
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.1.pdf nRF52832 Product Specification v1.1]<br />
* ARMv7-M information:<br />
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]<br />
<br />
=== Component Datasheets ===<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC Server: irc.pine64.org Channel: PineTime<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=6354PineTime2020-07-30T14:17:58Z<p>Danielt: </p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging.<br />
<br />
Only a few devs have soldered to these pins, most just use friction to make contact with the programming cable.<br />
<br />
The pinout is: <br />
<br />
<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
<br />
or with OpenOCD<br />
- issue the command ''halt''<br />
- issue the command ''flash fillw 0x10001208 0xFFFFFF00 0x01''<br />
- issue the command ''reset''<br />
<br />
you can check if the debug port is enabled using the following code<br />
DWT->CYCCNT ? "NO":"YES"<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to your software.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x03 = SLEEP (reset the touchpanel using the reset pin before using this register : pin_low, delay 5ms, pin_high, delay 50ms then write 3 to register 0xA5)<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' <del>Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!</del><br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
|<br />
{|<br />
|[https://github.com/JF002/Pinetime JF002/Pinetime]<br />
|-<br />
|[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
|}<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|-<br />
|[https://github.com/endian-albin/pinetime-hypnos endian-albin/pinetime-hypnos]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
|<br />
{|<br />
|[https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
|-<br />
|[https://github.com/geoffrey-vl/mbed-pinetime geoffrey.vl/mbed-pinetime]<br />
|}<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! wasp-os (MicroPython)<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
<br />
|-<br />
! Rust + RTFM<br />
| https://rtfm.rs/<br />
| [https://github.com/rtfm-rs/cortex-m-rtfm rtfm-rs/cortex-m-rtfm]<br />
| https://github.com/dbrgn/pinetime-rtfm/<br />
<br />
|-<br />
! Bare Metal<br />
| <br />
|<br />
{|<br />
|https://github.com/xriss/timecake<br />
|-<br />
|https://github.com/Arc13/Pyrus<br />
|}<br />
|<br />
{|<br />
|[https://github.com/xriss/timecake xriss/timecake]<br />
|-<br />
|[https://github.com/Arc13/Pyrus Arc13/Pyrus]<br />
|}<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
! Useful drivers<br />
|<br />
| https://github.com/sethitow/mbed-pinetime<br />
| [https://github.com/sethitow/mbed-pinetime/tree/master/drivers https://github.com/sethitow/mbed-pinetime]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
|-<br />
! Arduino<br />
| https://youtu.be/4aFDjymXjOw<br />
| https://github.com/atc1441/ATCwatch<br />
| https://github.com/atc1441/ATCwatch<br />
|-<br />
! OTA Update Flasher / DaFlasher<br />
| https://youtu.be/gUVEz-pxhgg<br />
| https://github.com/atc1441/DaFlasherFiles<br />
| https://github.com/atc1441/DaFlasherFiles<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Chip Datasheets ===<br />
* NORDIC nRF52832 information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]<br />
** [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.1.pdf nRF52832 Product Specification v1.1]<br />
* ARMv7-M information:<br />
** [https://static.docs.arm.com/ddi0403/eb/DDI0403E_B_armv7m_arm.pdf ARMv7-M Architecture Reference Manual]<br />
<br />
=== Component Datasheets ===<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 3-axes ultra-low power accelerometer datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC Server: irc.pine64.org Channel: PineTime<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5947Reprogramming the PineTime2020-06-17T10:48:30Z<p>Danielt: Remove empty first level topic</p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done from the telnet connection, just use ''telnet localhost 4444''.<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
= External links and additional tutorials = <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5946Reprogramming the PineTime2020-06-17T10:47:49Z<p>Danielt: Fix bad indenting (gives better ToC)</p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= Methods of flashing new software =<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done from the telnet connection, just use ''telnet localhost 4444''.<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
= External links and additional tutorials = <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5931Reprogramming the PineTime2020-06-15T11:12:51Z<p>Danielt: /* nrfjprog */</p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogrammed, however the kit does not include an hardware programmer/debugger. <br />
<br />
There is a bewildering variety of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= Methods of flashing new software =<br />
<br />
= nrfjprog (for Segger JLink) =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
=== Hookup ===<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pinetime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
=== Unlocking the FLASH ===<br />
<br />
Unlocking the device and erase the memory. <br />
<br />
'''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
=== Uploading new software ===<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
These examples allow you to use telnet to issue futher commands to the devkit. Using them you can connect to ''127.0.0.1'' (''localhost'') port ''4444'' using telnet and invoke OpenOCD commands. GDB should also be available on port ''3333''.<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== Raspberry Pi ===<br />
<br />
openocd \<br />
-c 'interface bcm2835spi' \<br />
-c 'bcm2835spi_speed 31200' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
=== STLink ===<br />
<br />
''Complete this subsection if you have gotten it to work''<br />
<br />
== Unlocking the device ==<br />
<br />
If you need to disable access port protection then you can do this using the following commands below.<br />
<br />
This can be done from the telnet connection, just use ''telnet localhost 4444''.<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
(If the ''nrf52.dap'' command cannot be found, try just ''dap'' instead.)<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an appropriate adapter).<br />
<br />
openocd \<br />
-c 'source [find interface/cmsis-dap.cfg]' \<br />
-c 'transport select swd' \<br />
-c 'source [find target/nrf52.cfg]' \<br />
-c 'init' \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c 'reset' \<br />
-c 'exit'<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
=== Using the BMP to flash the PineTime ===<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
<br />
Then, proceed with debugging as normal.<br />
<br />
<br />
== External links and additional tutorials == <br />
<br />
* https://github.com/jlukanc1/pinetime-boot-flasher<br />
* https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html<br />
* https://blog.dbrgn.ch/2020/5/16/nrf52-unprotect-flash-jlink-openocd/<br />
* https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590<br />
* https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5547Reprogramming the PineTime2020-05-06T21:04:15Z<p>Danielt: </p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogramed but the kit does not include an hardware programmer. There are a bewildering variaty of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Unlocking the device ==<br />
<br />
Once you have connected to the device then the OoenOCD command console is accessable via a network socket. If you need to disable access port protection then you con do this using the following commands below.<br />
<br />
Note: ''Unlocking the device to remove access port protection will erase the contents of flash.''<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5546Reprogramming the PineTime2020-05-06T20:47:30Z<p>Danielt: /* Introduction */</p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogramed but the kit does not include an hardware programmer. There are a bewildering variaty of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
After that command you can connect to localhost and execute unlock commands. Full wipe after this is required to do further flashing.<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5545Reprogramming the PineTime2020-05-06T20:47:17Z<p>Danielt: </p>
<hr />
<div>= Introduction =<br />
<br />
The PineTime Dev Kit comes with the back not glued down to allow it to be easily reprogramed but the kit does not include an hardware programmer. There are a bewildering variaty of different hardware programmers available but whatever programmer you have there are only a few tasks you will have to learn about:<br />
<br />
* Unlock the device<br />
* Upload new software<br />
* Run a debugger<br />
<br />
Unlocking the device is a one-time action that is needed to enable to debug port and provide full access to the device. Unlocking the device will erase all existing software from the internal flash.<br />
<br />
= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
After that command you can connect to localhost and execute unlock commands. Full wipe after this is required to do further flashing.<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5544Reprogramming the PineTime2020-05-06T20:29:26Z<p>Danielt: </p>
<hr />
<div>= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
After that command you can connect to localhost and execute unlock commands. Full wipe after this is required to do further flashing.<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
=== JLink ===<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5540Reprogramming the PineTime2020-05-06T18:26:24Z<p>Danielt: /* Black Magic Probe (and clones) */</p>
<hr />
<div>= Black Magic Probe =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
After that command you can connect to localhost and execute unlock commands. Full wipe after this is required to do further flashing.<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
== JLink ==<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=Reprogramming_the_PineTime&diff=5539Reprogramming the PineTime2020-05-06T18:26:02Z<p>Danielt: Re-organise by software in order to bring the existing OpenOCD material closer together.</p>
<hr />
<div>= Black Magic Probe (and clones) =<br />
<br />
BlackMagic Probe is an JTAG/SWD adapter with open-source firmware, allowing for it to be ported to a multitude of different boards. One of it's defining features is lack of need for intermediate software such as OpenOCD - one would just need to connect to the GDB server running on the chip and proceed with debugging. For more information, refer to [https://github.com/blacksphere/blackmagic/wiki wiki].<br />
<br />
== Adapters ==<br />
<br />
=== Native adapters ===<br />
<br />
The native adapters are the official Black Magic family of debug adapters, including the original Black Magic Probe and the Black Magic Probe Mini. By buying the official hardware you are supporting the continued development of the Black Magic Probe software.<br />
<br />
Providing your native adapter is running up-to-date firmware then it can be used to program your PineTime.<br />
<br />
=== STM32 (Blue Pill) ===<br />
<br />
It is possible to flash a popular development board based on STM32F103C8T6 microcontroller, known as Blue Pill, to make a BlackMagic Probe device. For example, one may follow instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os). Also, it is possible to use SWD pins on the board to flash other devices, instead using arbitrary pins on the board itself. See [https://buger.dread.cz/black-magic-probe-bmp-on-bluepill-stm32f103c8-minimum-system-development-board.html this link] for more detals.<br />
<br />
=== Other hardware ===<br />
<br />
The Black Magic Probe firmware can be run on a variety of host devices. See [https://github.com/blacksphere/blackmagic/wiki/Debugger-Hardware BMP Debugger Hardware] for more information.<br />
<br />
== Uploading new software ==<br />
<br />
Refer to the BMP [https://github.com/blacksphere/blackmagic/wiki/Useful-GDB-commands wiki] for the full description of commands.<br />
Overall, the process on Linux is like following. (/dev/ttyBmpGdb is a symlink created by the udev rule). It's useful to create a gdb script file (or .gdbinit) with following commands:<br />
<br />
target extended-remote /dev/ttyBmpGdb<br />
monitor swdp_scan<br />
attach 1<br />
file %firmware file%<br />
<br />
Then one may use '''load''' command to flash the firmware, '''compare-sections''' to verify the upload, or '''monitor erase_mass''' to erase the firmware. <br />
Then, proceed with debugging as normal.<br />
<br />
= nrfjprog =<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
== Hookup ==<br />
<br />
Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
== Unlocking the FLASH ==<br />
<br />
Unlocking the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole <br />
flash memory of the MCU!''' :<br />
<br />
nrfjprog -f NRF52 --recover<br />
<br />
== Uploading new software ==<br />
<br />
1. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
2. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
3. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
<br />
= OpenOCD =<br />
<br />
== Adapters ==<br />
<br />
=== CMSIS-DAP ===<br />
<br />
Copied from [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html this article]. <br />
<br />
Issue this command to initialize a connection to the devkit:<br />
<br />
openocd -d2 -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]'<br />
<br />
After that command you can connect to localhost and execute unlock commands. Full wipe after this is required to do further flashing.<br />
<br />
telnet localhost 4444<br />
Trying 127.0.0.1...<br />
Connected to localhost.<br />
Escape character is '^]'.<br />
Open On-Chip Debugger<br />
> nrf52.dap apreg 1 0x04<br />
0x00000000<br />
> nrf52.dap apreg 1 0x04 0x01<br />
> nrf52.dap apreg 1 0x04<br />
0x00000001<br />
<br />
== JLink ==<br />
<br />
Start OpenOCD:<br />
<br />
openocd \<br />
-c 'interface jlink; transport select swd; source [find target/nrf52.cfg]' \<br />
-c 'init'<br />
<br />
Now you can connect to `127.0.0.1` (`localhost`) port `4444` using telnet to invoke OpenOCD commands. GDB should be available on port `3333`.<br />
<br />
=== Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== STLink ===<br />
<br />
TODO<br />
<br />
== Uploading new software ==<br />
<br />
Just issue this command, replace ''code.hex'' with your own (and cmsis-dap.cfg with an approprate adapter).<br />
<br />
openocd -c 'source [find interface/cmsis-dap.cfg]; transport select swd; source [find target/nrf52.cfg]' \<br />
-c init \<br />
-c 'nrf5 mass_erase' \<br />
-c 'program code.hex verify' \<br />
-c reset \<br />
-c exit</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4973PineTime2020-02-09T08:56:26Z<p>Danielt: /* Datasheets and Schematics */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH in the schematic diagram is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4972PineTime2020-02-09T08:56:01Z<p>Danielt: /* Datasheets and Schematics */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
Note: The part number for the SPI FLASH is not correct, the PineTime features a larger external FLASH device, see below.<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4971PineTime2020-02-09T08:55:17Z<p>Danielt: /* Component Datasheets */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a] (note that the part number for the SPI FLASH is not correct, the PineTime features a larger external FLASH device)<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash])<br />
** IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4970PineTime2020-02-09T08:52:40Z<p>Danielt: /* Component Datasheets */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a] (note that the part number for the SPI FLASH is not correct, the PineTime features a larger external FLASH device)<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [https://www.elnec.com/en/device/XTX/XT25F32B+%28QuadSPI%29+%5BSOP8-200%5D/ XTX XT25F32B 32Mb(4MB) SPI NOR Flash] (data sheets for this part are hard to find but it acts similar to other QuadSPI SPI NOR Flash such as [https://www.macronix.com/Lists/Datasheet/Attachments/7426/MX25L3233F,%203V,%2032Mb,%20v1.6.pdf Macronix 32Mb(4MB) SPI NOR Flash], RDID for the XT25F32B is 0x0b 0x4016)<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4969PineTime2020-02-09T08:42:51Z<p>Danielt: /* Schematics */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
'''References''':<br />
<br />
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a] (note that the part number for the SPI FLASH is not correct, the PineTime features a larger external FLASH device)<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [https://wiki.pine64.org/images/c/cc/Bst-bma400-ds000.pdf BOSCH BMA400 datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4888PineTime2020-02-04T09:38:41Z<p>Danielt: /* Frequently asked questions */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
'''Read these first!'''<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Frequently asked questions about the devkit]<br />
* [https://wiki.pine64.org/index.php/Reprogramming_the_PineTime Programming the PineTime]<br />
* [https://wiki.pine64.org/index.php/Lup_Yuen_Lee_Q%26A_about_PineTime Q&A about Rust and MyNewt for PineTime by Lup Yuen Lee]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
=== Battery measurement ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== How to write battery friendly software? === <br />
<br />
The key to save battery is to enable only what you need when you need it. NRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:<br />
<br />
* Disable / shutdown / put in sleep mode '''all devices around the MCU''' (display controller, touch controller, external memory,...). <br />
* Disable all '''peripheral inside the MCU''' when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.<br />
* Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling ''WFE'' (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the ''tickless mode'' : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.<br />
* Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.<br />
* Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and '''is not automatically disabled''', even if you disconnect the debugger. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:<br />
- using ''nrfjprog --reset''<br />
- using JLinkExe : issue the command ''writeDP 1 0''<br />
* Read [https://infocenter.nordicsemi.com/pdf/nRF52832_Rev_2_Errata_v1.1.pdf the errata sheet of the MCU] and apply workarounds if they apply to you soft.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: Slide down,<br />
<br />
0x02: Slide up,<br />
<br />
0x03: Slide left,<br />
<br />
0x04: Slide right,<br />
<br />
0x05: Single click,<br />
<br />
0x0B: Double click,<br />
<br />
0x0C: Long press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
|<br />
{|<br />
|[https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
|- <br />
|[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
|-<br />
|[https://github.com/Dejvino/pinetime-hermes-firmware Dejvino/pinetime-hermes-firmware]<br />
|}<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
<br />
|-<br />
! UI concepts and drawings<br />
| <br />
| <br />
| [https://gitlab.com/arteeh/pinetimeos arteeh/pinetimeos]<br />
<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4780PineTime2020-01-24T08:59:35Z<p>Danielt: /* Development efforts */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Click here to see frequently asked questions about the dev kit]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
=== Battery ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: on a slippery,<br />
<br />
0x02: decline,<br />
<br />
0x03: Left slip,<br />
<br />
0x04: Right slide,<br />
<br />
0x05: Click,<br />
<br />
0x0B: Double-click,<br />
<br />
0x0C: Press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
<br />
== Programming firmware ==<br />
<br />
=== Using JLink programmer and nrfjprog tools ===<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
1. Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
2. Unlock the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjporg -f NRF52 --recover<br />
<br />
3. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
4. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
5. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
=== Using OpenOCD and a Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== Using STM32 bluepill as blackmagic probe ===<br />
<br />
Instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os)<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
| [https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
|}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4779PineTime2020-01-24T08:58:24Z<p>Danielt: /* Development efforts */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Click here to see frequently asked questions about the dev kit]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
=== Battery ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: on a slippery,<br />
<br />
0x02: decline,<br />
<br />
0x03: Left slip,<br />
<br />
0x04: Right slide,<br />
<br />
0x05: Click,<br />
<br />
0x0B: Double-click,<br />
<br />
0x0C: Press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
<br />
== Programming firmware ==<br />
<br />
=== Using JLink programmer and nrfjprog tools ===<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
1. Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
2. Unlock the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjporg -f NRF52 --recover<br />
<br />
3. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
4. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
5. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
=== Using OpenOCD and a Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== Using STM32 bluepill as blackmagic probe ===<br />
<br />
Instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os)<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
| [https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-<br />
}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4778PineTime2020-01-24T08:57:34Z<p>Danielt: </p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Click here to see frequently asked questions about the dev kit]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
=== Battery ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: on a slippery,<br />
<br />
0x02: decline,<br />
<br />
0x03: Left slip,<br />
<br />
0x04: Right slide,<br />
<br />
0x05: Click,<br />
<br />
0x0B: Double-click,<br />
<br />
0x0C: Press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
<br />
== Programming firmware ==<br />
<br />
=== Using JLink programmer and nrfjprog tools ===<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
1. Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
2. Unlock the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjporg -f NRF52 --recover<br />
<br />
3. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
4. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
5. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
=== Using OpenOCD and a Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== Using STM32 bluepill as blackmagic probe ===<br />
<br />
Instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os)<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
| [https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-bootloader daniel-thompson/wasp-bootloader]<br />
|-}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=PineTime&diff=4777PineTime2020-01-24T08:56:49Z<p>Danielt: /* Development efforts */</p>
<hr />
<div>== Frequently asked questions ==<br />
<br />
* [https://wiki.pine64.org/index.php/Frequently_asked_questions_about_the_PineTime Click here to see frequently asked questions about the dev kit]<br />
<br />
== Specifications ==<br />
'''Dimensions:''' 37.5 x 40 x 11mm <br><br />
'''Weight:''' 38 grams <br><br />
'''IP Rating:''' IP67 (waterproof to 1 meter) <br><br />
'''Display:'''<br />
: '''Size:''' 1.3 inches (33mm) diagonal<br />
: '''Type:''' IPS capacitive touchscreen, RGB 65K colors<br />
: '''Display Controller:''' ST7789<br />
: '''Resolution:''' 240x240 pixels <br><br />
'''System on Chip:''' Nordic Semiconductor nRF52832 <br><br />
'''Flash:''' 512KB with additional 4MB SPI NOR <br><br />
'''RAM:''' 64KB <br><br />
'''Bluetooth:''' 5.0 (including Bluetooth Low Energy) <br><br />
'''Sensors:''' Accelerometer, Heart rate sensor <br><br />
'''Feedback:''' Vibration motor <br><br />
'''Battery:''' 170-180mAh LiPo<br />
<br />
== SWD Pinout ==<br />
The devkits have exposed SWD pins for flashing and debugging. The pinout is:<br />
[[File:PineTime_SWD_location.jpg]]<br />
<br />
== Driving the peripherals ==<br />
<br />
=== Display ===<br />
<br />
Note: The factory-default software on the PineTime does not auto-detect the display being disconnected when it has already booted. That can cause garbled output, to fix it just restart the PineTime.<br />
<br />
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:<br />
<br />
{| class="wikitable"<br />
|-<br />
! PineTime pin<br />
! ST7789 pin<br />
|-<br />
| LCD_SCK (P0.02)<br />
| SPI clock<br />
|-<br />
| LCD_SDI (P0.03)<br />
| SPI MOSI<br />
|-<br />
| LCD_RS (P0.18)<br />
| Clock/data pin (CD)<br />
|-<br />
| LCD_CS (P0.25)<br />
| Chip select<br />
|-<br />
| LCD_RESET (P0.26)<br />
| Display reset<br />
|-<br />
| LCD_BACKLIGHT_{LOW,MID,HIGH}<br />
| Backlight (active low)<br />
|}<br />
<br />
Notes:<br />
<br />
* Chip select must be held low while driving the display. It must be high when using other SPI devices on the same bus (such as external flash storage) so that the display controller won't respond to the wrong commands.<br />
* SPI must be used in mode 3. Mode 0 (the default) won't work.<br />
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.<br />
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.<br />
<br />
=== Battery ===<br />
<br />
Reading whether the PineTime has power attached is easy: simply read the charge indication pin (P0.12). When it is high it is running on battery, when it is low it is charging.<br />
<br />
Reading the battery voltage is a bit harder. For that you can use the battery voltage pin on P0.31 (AIN7). The returned value is 12 bits, which means it is 0..4095. You can get the measured voltage with the following formula, assuming a reference voltage of 3.3V (this is configurable in the ADC):<br />
<br />
adcVoltage = adcValue / (4095 / 3.3)<br />
<br />
The measured voltage is actually half of the actual battery voltage, because the ADC is connected between a voltage divider where both resistors are 1MΩ. This can be corrected by multiplying the value:<br />
<br />
batteryVoltage = adcValue * 2 / (4095 / 3.3)<br />
<br />
It's often better to avoid floating point values on embedded systems and in this case there is no reason to use float at all, we can just represent the value in millivolts. Therefore the formula can be simplified to:<br />
<br />
batteryVoltage = adcValue * 2000 / (4095 / 3.3)<br />
batteryVoltage = adcValue * 2000 / 1241<br />
<br />
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.<br />
<br />
=== Button ===<br />
<br />
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.<br />
<br />
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.<br />
<br />
=== Touch panel ===<br />
<br />
The touch panel is controlled by a Hynitron CST816S chips. Unfortunately, there is not much information about this chip on the internet apart from the datasheet below and a [https://github.com/lupyuen/hynitron_i2c_cst0xxse/ reference driver]. This is enough to implement a basic driver, but crucial information needed to implement advanced functionalities are missing (I²C protocol and registers, timings, power modes,...).<br />
<br />
==== Pins ====<br />
<br />
* P0.10 : Reset<br />
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)<br />
* P0.06 : I²C SDA<br />
* P0.07 : I²C SCL<br />
<br />
==== I²C ====<br />
<br />
* Device address : 0x15<br />
* Frequency : from 10Khz to 400Khz<br />
<br />
'''NOTE : ''' The controller go to sleep when no event is detected. In sleep mode, the controller does not communicate on the I²C bus (it appears disconnected). So, for the communication to work, you need to tap on the screen so that the chip wakes-up.<br />
<br />
==== Touch events ====<br />
<br />
Touch informations are available in the 63 first registers of the controller. Remember : the device is in sleep mode when no touch event is detected. It means that you can read the register only when the touch controller detected an event. You can use the ''Interrupt'' pin to detect such event in the software. <br />
<br />
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : <br />
<br />
{| class="wikitable"<br />
! Byte<br />
! Bit7<br />
! Bit6<br />
! Bit5<br />
! Bit4<br />
! Bit3<br />
! Bit2<br />
! Bit1<br />
! Bit0<br />
|-<br />
|0<br />
|colspan="8"|?<br />
|-<br />
|1<br />
|colspan="8"|GestureID : (Gesture code ,<br />
<br />
0x00: no gesture,<br />
<br />
0x01: on a slippery,<br />
<br />
0x02: decline,<br />
<br />
0x03: Left slip,<br />
<br />
0x04: Right slide,<br />
<br />
0x05: Click,<br />
<br />
0x0B: Double-click,<br />
<br />
0x0C: Press) <br />
|-<br />
|2<br />
|colspan="4"|? <br />
|colspan="4"|Number of touch points <br />
|-<br />
|3<br />
|colspan="2"|Event (0 = Down, 1 = Up, 2 = Contact)<br />
|colspan="2"|?<br />
|colspan="4"|X (MSB) coordinate<br />
|-<br />
|4<br />
|colspan="8"|X (LSB) coordinate<br />
|-<br />
|5<br />
|colspan="2"|?<br />
|colspan="2"|Touch ID<br />
|colspan="4"|Y (MSB) coordinate<br />
|-<br />
|6<br />
|colspan="8"|Y (LSB) coordinate<br />
|-<br />
|7<br />
|colspan="8"|Pressure (?)<br />
|-<br />
|8<br />
|colspan="8"|Miscellaneous (?)<br />
|}<br />
<br />
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).<br />
<br />
'''NOTES'''<br />
<br />
* The touch controller seems to report only 1 touch point<br />
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.<br />
<br />
==== Registers ====<br />
<br />
The reference driver specifies some registers and value, but there is no information about them: <br />
<br />
{| class="wikitable"<br />
<br />
!Register<br />
!Address<br />
!Description<br />
|-<br />
|HYN_REG_INT_CNT<br />
|0x8F<br />
|<br />
|-<br />
|HYN_REG_FLOW_WORK_CNT<br />
|0x91<br />
|<br />
|-<br />
|HYN_REG_WORKMODE <br />
|0x00<br />
|0 = WORK, 0x40 = FACTORY<br />
|-<br />
|HYN_REG_CHIP_ID<br />
|0xA3<br />
|<br />
|-<br />
|HYN_REG_CHIP_ID2<br />
|0x9F<br />
|-<br />
|HYN_REG_POWER_MODE<br />
|0xA5<br />
|0x05 = SLEEP<br />
|-<br />
|HYN_REG_FW_VER<br />
|0xA6<br />
|<br />
|-<br />
|HYN_REG_VENDOR_ID<br />
|0xA8<br />
|<br />
|-<br />
|HYN_REG_LCD_BUSY_NUM<br />
|0xAB<br />
|<br />
|-<br />
|HYN_REG_FACE_DEC_MODE_EN<br />
|0xB0<br />
|<br />
|-<br />
|HYN_REG_GLOVE_MODE_EN<br />
|0xC0<br />
|<br />
|-<br />
|HYN_REG_COVER_MODE_EN<br />
|0xC1<br />
|<br />
|-<br />
|HYN_REG_CHARGER_MODE_EN<br />
|0x8B<br />
|<br />
|-<br />
|HYN_REG_GESTURE_EN<br />
|0xD0<br />
|<br />
|-<br />
|HYN_REG_GESTURE_OUTPUT_ADDRESS<br />
|0xD3<br />
|<br />
|-<br />
|HYN_REG_ESD_SATURATE 0xED<br />
|0xED<br />
|<br />
|}<br />
<br />
'''WARNING : ''' Writing the SLEEP command (write 0x05 in HYN_REG_POWER_MODE) seems to freeze the controller (it returns only static values) until the battery is totally drained and the whole system reset. Analysis and debugging is more than welcome!<br />
<br />
<br />
== Programming firmware ==<br />
<br />
=== Using JLink programmer and nrfjprog tools ===<br />
<br />
The following steps have been tested with the Segger JLink embedded in the [https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52-DK NRF52-DK development board].<br />
<br />
1. Connect the Pinetime SWD pins to the debugger (P20 on NRF52-DK)<br />
<br />
{| class="wikitable"<br />
!Pintime<br />
!JLink<br />
|-<br />
|GND<br />
|GND<br />
|-<br />
|SWDCLK<br />
|SWDCLK<br />
|-<br />
|SWDIO<br />
|SWDIO<br />
|-<br />
|VCC (3.3V)<br />
|VTG (target detect)<br />
|}<br />
<br />
2. Unlock the device and erase the memory. '''You need to execute this step only once, to remove the read protection on the memory. Note that it will erase the whole flash memory of the MCU!''' :<br />
<br />
nrfjporg -f NRF52 --recover<br />
<br />
3. Program the BLE softdevice (if needed by the firmware). Replace PATH_TO_NRF_SDK by the path where you unzipped the [https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK NRF52 SDK] :<br />
<br />
nrfjprog -f NRF52 --program /PATH_TO_NRF_SDK/components/softdevice/s132/hex/s132_nrf52_6.1.1_softdevice.hex --sectorerase<br />
<br />
4. Program the firmware (replace firmware.hex by the actual filename of the firmware):<br />
<br />
nrfjprog -f NRF52 --program firmware.hex --sectorerase<br />
<br />
5. Reset and run the new firmware:<br />
<br />
nrfjprog -f NRF52 --reset<br />
<br />
=== Using OpenOCD and a Raspberry Pi ===<br />
<br />
Instructions in [https://medium.com/@ly.lee/build-and-flash-rust-mynewt-firmware-for-pinetime-smart-watch-5e14259c55 Medium post], subsequently [https://medium.com/@ly.lee/openocd-on-raspberry-pi-better-with-swd-on-spi-7dea9caeb590 updated] with a more reliable method under development, so may be a bit of a moving target.<br />
<br />
=== Using STM32 bluepill as blackmagic probe ===<br />
<br />
Instructions in [https://forum.pine64.org/showthread.php?tid=8816&pid=57095#pid57095 forum post] or [https://gist.github.com/darnel/dac1370d057e176386ca4026418abc2b gist] (mac os)<br />
<br />
== Manual / Articles ==<br />
<br />
* [https://github.com/najnesnaj/pinetime-zephyr Beginner manual explained how you to programs and install zephyr on PineTime Dev Kit, big thanks to najnesnaj :-)]<br />
<br />
* [https://medium.com/swlh/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot-81b74161c159 Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]<br />
<br />
* [https://medium.com/@ly.lee/building-a-rust-driver-for-pinetimes-touch-controller-cbc1a5d5d3e9 Building a Rust Driver for PineTime’s Touch Controller]<br />
<br />
* [https://medium.com/@ly.lee/porting-druid-rust-widgets-to-pinetime-smart-watch-7e1d5a5d977a Porting (druid) Rust Widgets to PineTime Smart Watch]<br />
<br />
* [https://medium.com/@ly.lee/optimising-pinetimes-display-driver-with-rust-and-mynewt-3ba269ea2f5c Optimising PineTime’s Display Driver with Rust and Mynewt]<br />
<br />
* [https://www.zephyrproject.org/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]<br />
<br />
* [https://blog.aegrel.ee/absniffer-cmsis-dap-sniffer.html Removing the lock and installing another firmware on the nRF52832 using CMSIS-DAP dongle on Linux]<br />
<br />
* [https://github.com/JF002/nrf52-baseproject/wiki/Build,-program-and-debug-NRF52-project-with-JLink,-CMake-and-CLion Build, program and debug NRF52 project with JLink, CMake and CLion]<br />
<br />
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]<br />
<br />
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]<br />
<br />
== Development efforts ==<br />
<br />
{| class="wikitable"<br />
!<br />
! Project Homepage<br />
! Project Source<br />
! PineTime Implementations<br />
<br />
|-<br />
! FreeRTOS<br />
|https://www.freertos.org<br />
| https://sourceforge.net/projects/freertos/<br />
| [https://github.com/JF002/Pinetime JF002/Pinetime]<br />
[https://github.com/kaythe/pinetime-os kaythe/pinetime-os]<br />
<br />
|-<br />
! Zephyr<br />
| https://www.zephyrproject.org<br />
| https://github.com/zephyrproject-rtos/zephyr<br />
| [https://github.com/najnesnaj/pinetime-zephyr najnesnaj/pinetime-zephyr]<br />
[https://github.com/SuperPrower/pinetime_zephyr_sample_fw SuperPrower/pinetime_zephyr_sample_fw]<br />
<br />
|-<br />
! mynewt<br />
| https://mynewt.apache.org/about/<br />
| https://github.com/apache/mynewt-core<br />
| [https://github.com/lupyuen/pinetime-rust-mynewt lupyuen/pinetime-rust-mynewt]<br />
<br />
|-<br />
! MbedOS<br />
| https://os.mbed.com<br />
| https://github.com/ARMmbed/mbed-os<br />
| [https://github.com/sethitow/awesome-pinetime sethitow/mbed-pinetime]<br />
<br />
|-<br />
! RIOT<br />
| http://riot-os.org/<br />
| https://github.com/RIOT-OS/RIOT/<br />
| [https://github.com/bosmoment/PineTime-apps bosmoment/PineTime-apps]<br />
<br />
|-<br />
! TinyGo<br />
| https://tinygo.org<br />
| https://github.com/tinygo-org/tinygo<br />
| [https://github.com/aykevl/go-smartwatch aykevl/go-smartwatch]<br />
<br />
|-<br />
! MicroPython<br />
| https://micropython.org/<br />
| https://github.com/micropython/micropython<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-os]<br />
|-<br />
! AdaFruit bootloader<br />
|<br />
| https://github.com/adafruit/Adafruit_nRF52_Bootloader<br />
| [https://github.com/daniel-thompson/wasp-os daniel-thompson/wasp-bootloader]<br />
|-}<br />
<br />
== Datasheets and Schematics ==<br />
<br />
=== Schematics ===<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]<br />
* [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]<br />
<br />
=== Component Datasheets ===<br />
* NORDIC SoC information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]<br />
* PMU (Power Management Unit) information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]<br />
* SPI Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3" 240x240 IPS LCD Panel Specification for PineTime]<br />
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6" Sitronix LCD Driver/Controller Datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6" Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]<br />
*** [https://wiki.pine64.org/images/5/51/CST816S%E6%95%B0%E6%8D%AE%E6%89%8B%E5%86%8CV1.1.en.pdf English Translation]<br />
* Sensor:<br />
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]<br />
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]<br />
<br />
= Community =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]<br />
* [https://riot.im/app/#/room/#pinetime64:matrix.org Matrix Channel] (No login required to read)<br />
* IRC: Server us.pine64.xyz. Type /list to see all channels<br />
* [https://t.me/pinetime Telegram group]<br />
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Debian_Installer&diff=4713Pinebook Pro Debian Installer2020-01-21T11:27:04Z<p>Danielt: /* Current issues */</p>
<hr />
<div>== Information ==<br />
<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please use [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].<br />
<br />
== Features ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Feature<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Install to micro SD card<br />
| Works<br />
| Automatically expands to use all available space<br />
|-<br />
| Install to eMMC<br />
| Works<br />
| Automatically adapts for 64GB and 128GB models<br />
|-<br />
| Full disk encryption<br />
| Works<br />
| Run installer with `CRYPT=yes`. Requires kernel support and this support is missing in the original factory kernel so it it not possible to install a LUKS filesystem from the factory distro. You can make a temporary unencrypted install with this installer and then use the temporary OS to perform a full encypted install.<br />
|-<br />
| Wifi<br />
| Works<br />
|<br />
|}<br />
<br />
== Current issues ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Issue<br />
! style="text-align: center;" | Category<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Workaround<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Firefox 'Illegal instruction'<br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948708<br />
|<br />
| Use a different browser while the issue is fixed or use armhf version<br />
| You can use the firefox-esr 68.4.1esr-1~deb10u1 from Debian Buster, it works perfect (needs to be pinned, also needs a lib). Other browsers such as Epiphany (also has issues, white screen often, mouse movement re-displays under mouse), Konqueror and Falkon also have issues, don't work (dbind)<br />
<br />
To use the armhf version:<br />
<br />
<pre><br />
$ sudo apt remove firefox-esr<br />
$ sudo dpkg --add-architecture armhf<br />
$ sudo apt update<br />
$ sudo apt install firefox-esr:armhf<br />
</pre><br />
|-<br />
| <pre>cdn-dp fec00000.dp: Direct firmware load for rockchip/dptx.bin failed with error -2</pre><br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054<br />
| If having FDE, it fails to load at boot as the firmware is not included in initramfs<br />
| Include the dptx.bin firmware in the initramfs (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054#5)<br />
| See https://forum.pine64.org/showthread.php?tid=8487&pid=57202#pid57202<br />
|-<br />
| Bluetooth doesn't work<br />
bluetooth hci1: Direct firmware load for brcm/BCM4345C5.hcd failed with error -2<br />
|<br />
|<br />
| It seems some firmware is missing. See https://forum.pine64.org/showthread.php?tid=8731&pid=57525#pid57525<br />
|<br />
|-<br />
| Suspend doesn't work properly, when lid is closed, the laptops gets hot and dramatically dry the battery<br />
|<br />
|<br />
| Install is preconfigured to use suspend-to-idle instead. This offers some power savings compared to normal running but suspend should only be used for short periods.<br />
|<br />
|-<br />
| VLC crashes <br />
|<br />
|<br />
| Use a different player, like mpv<br />
|<br />
|}</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Debian_Installer&diff=4712Pinebook Pro Debian Installer2020-01-21T11:25:34Z<p>Danielt: </p>
<hr />
<div>== Information ==<br />
<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please use [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].<br />
<br />
== Features ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Feature<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Install to micro SD card<br />
| Works<br />
| Automatically expands to use all available space<br />
|-<br />
| Install to eMMC<br />
| Works<br />
| Automatically adapts for 64GB and 128GB models<br />
|-<br />
| Full disk encryption<br />
| Works<br />
| Run installer with `CRYPT=yes`. Requires kernel support and this support is missing in the original factory kernel so it it not possible to install a LUKS filesystem from the factory distro. You can make a temporary unencrypted install with this installer and then use the temporary OS to perform a full encypted install.<br />
|-<br />
| Wifi<br />
| Works<br />
|<br />
|}<br />
<br />
== Current issues ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Issue<br />
! style="text-align: center;" | Category<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Workaround<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Firefox 'Illegal instruction'<br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948708<br />
|<br />
| Use a different browser while the issue is fixed or use armhf version<br />
| You can use the firefox-esr 68.4.1esr-1~deb10u1 from Debian Buster, it works perfect (needs to be pinned, also needs a lib). Other browsers such as Epiphany (also has issues, white screen often, mouse movement re-displays under mouse), Konqueror and Falkon also have issues, don't work (dbind)<br />
<br />
To use the armhf version:<br />
<br />
<pre><br />
$ sudo apt remove firefox-esr<br />
$ sudo dpkg --add-architecture armhf<br />
$ sudo apt update<br />
$ sudo apt install firefox-esr:armhf<br />
</pre><br />
|-<br />
| <pre>cdn-dp fec00000.dp: Direct firmware load for rockchip/dptx.bin failed with error -2</pre><br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054<br />
| If having FDE, it fails to load at boot as the firmware is not included in initramfs<br />
| Include the dptx.bin firmware in the initramfs (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054#5)<br />
| See https://forum.pine64.org/showthread.php?tid=8487&pid=57202#pid57202<br />
|-<br />
| Bluetooth doesn't work<br />
bluetooth hci1: Direct firmware load for brcm/BCM4345C5.hcd failed with error -2<br />
|<br />
|<br />
| It seems some firmware is missing. See https://forum.pine64.org/showthread.php?tid=8731&pid=57525#pid57525<br />
|<br />
|-<br />
| Suspend doesn't work properly, when lid is closed, the laptops gets hot and dramatically dry the battery<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| VLC crashes <br />
|<br />
|<br />
| Use a different player, like mpv<br />
|<br />
|}</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Debian_Installer&diff=4711Pinebook Pro Debian Installer2020-01-21T11:24:42Z<p>Danielt: /* Features */</p>
<hr />
<div>== Information ==<br />
<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please use [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].<br />
<br />
== Features ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Feature<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Install to micro SD card<br />
| Works<br />
| Automatically expands to use all available space | <br />
|-<br />
| Install to eMMC<br />
| Works<br />
| Automatically adapts for 64GB and 128GB models | <br />
|-<br />
| Full disk encryption<br />
| Works<br />
| Run installer with `CRYPT=yes`. Requires kernel support and this support is missing in the original factory kernel so it it not possible to install a LUKS filesystem from the factory distro. You can make a temporary unencrypted install with this installer and then use the temporary OS to perform a full encypted install.<br />
|-<br />
| Wifi<br />
| Works<br />
| style="text-align: center;" | <br />
|}<br />
<br />
== Current issues ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Issue<br />
! style="text-align: center;" | Category<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Workaround<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Firefox 'Illegal instruction'<br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948708<br />
|<br />
| Use a different browser while the issue is fixed or use armhf version<br />
| You can use the firefox-esr 68.4.1esr-1~deb10u1 from Debian Buster, it works perfect (needs to be pinned, also needs a lib). Other browsers such as Epiphany (also has issues, white screen often, mouse movement re-displays under mouse), Konqueror and Falkon also have issues, don't work (dbind)<br />
<br />
To use the armhf version:<br />
<br />
<pre><br />
$ sudo apt remove firefox-esr<br />
$ sudo dpkg --add-architecture armhf<br />
$ sudo apt update<br />
$ sudo apt install firefox-esr:armhf<br />
</pre><br />
|-<br />
| <pre>cdn-dp fec00000.dp: Direct firmware load for rockchip/dptx.bin failed with error -2</pre><br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054<br />
| If having FDE, it fails to load at boot as the firmware is not included in initramfs<br />
| Include the dptx.bin firmware in the initramfs (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054#5)<br />
| See https://forum.pine64.org/showthread.php?tid=8487&pid=57202#pid57202<br />
|-<br />
| Bluetooth doesn't work<br />
bluetooth hci1: Direct firmware load for brcm/BCM4345C5.hcd failed with error -2<br />
|<br />
|<br />
| It seems some firmware is missing. See https://forum.pine64.org/showthread.php?tid=8731&pid=57525#pid57525<br />
|<br />
|-<br />
| Suspend doesn't work properly, when lid is closed, the laptops gets hot and dramatically dry the battery<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| VLC crashes <br />
|<br />
|<br />
| Use a different player, like mpv<br />
|<br />
|}</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Debian_Installer&diff=4710Pinebook Pro Debian Installer2020-01-21T11:23:50Z<p>Danielt: </p>
<hr />
<div>== Information ==<br />
<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please use [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].<br />
<br />
== Features ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Feature<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Install to micro SD card<br />
| Works<br />
| style="text-align: center;" | <br />
|-<br />
| Install to eMMC<br />
| Works<br />
| style="text-align: center;" | <br />
|-<br />
| Full disk encryption<br />
| Works<br />
| Run installer with `CRYPT=yes`. Requires kernel support and this support is missing in the original factory kernel so it it not possible to install a LUKS filesystem from the factory distro. You can make a temporary unencrypted install with this installer and then use the temporary OS to perform a full encypted install.<br />
|-<br />
| Wifi<br />
| Works<br />
| style="text-align: center;" | <br />
|}<br />
<br />
== Current issues ==<br />
<br />
{| class="wikitable"<br />
! style="text-align: center;" | Issue<br />
! style="text-align: center;" | Category<br />
! style="text-align: center;" | Status<br />
! style="text-align: center;" | Workaround<br />
! style="text-align: center;" | Notes<br />
|-<br />
| Firefox 'Illegal instruction'<br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=948708<br />
|<br />
| Use a different browser while the issue is fixed or use armhf version<br />
| You can use the firefox-esr 68.4.1esr-1~deb10u1 from Debian Buster, it works perfect (needs to be pinned, also needs a lib). Other browsers such as Epiphany (also has issues, white screen often, mouse movement re-displays under mouse), Konqueror and Falkon also have issues, don't work (dbind)<br />
<br />
To use the armhf version:<br />
<br />
<pre><br />
$ sudo apt remove firefox-esr<br />
$ sudo dpkg --add-architecture armhf<br />
$ sudo apt update<br />
$ sudo apt install firefox-esr:armhf<br />
</pre><br />
|-<br />
| <pre>cdn-dp fec00000.dp: Direct firmware load for rockchip/dptx.bin failed with error -2</pre><br />
| Debian issue https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054<br />
| If having FDE, it fails to load at boot as the firmware is not included in initramfs<br />
| Include the dptx.bin firmware in the initramfs (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=857054#5)<br />
| See https://forum.pine64.org/showthread.php?tid=8487&pid=57202#pid57202<br />
|-<br />
| Bluetooth doesn't work<br />
bluetooth hci1: Direct firmware load for brcm/BCM4345C5.hcd failed with error -2<br />
|<br />
|<br />
| It seems some firmware is missing. See https://forum.pine64.org/showthread.php?tid=8731&pid=57525#pid57525<br />
|<br />
|-<br />
| Suspend doesn't work properly, when lid is closed, the laptops gets hot and dramatically dry the battery<br />
|<br />
|<br />
|<br />
|<br />
|-<br />
| VLC crashes <br />
|<br />
|<br />
| Use a different player, like mpv<br />
|<br />
|}</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Software_Releases&diff=4279Pinebook Pro Software Releases2019-12-18T10:13:15Z<p>Danielt: /* Debian Installer */</p>
<hr />
<div>= Linux Image Releases =<br />
== Debian Desktop ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Desktop Community Build Image [microSD to eMMC] by mrfixit2001 ===<br />
* This is the default OS comes with Pinebook Pro<br />
* Included Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB microSD card / 16GB eMMC module and above):<br />
** [https://github.com/mrfixit2001/debian_desktop/releases/download/191123/pinebookpro-debian-desktop-mrfixit-191123.img.xz Direct download release build 191123 from mrfixit2001's github]<br />
*** MD5 (img file): BF67F3A0229769A7472D418AD45F8AB0<br />
*** File Size: 1.19GB<br />
* Login with<br />
** username: rock<br />
** password: rock<br />
<br />
== Bionic LXDE ==<br />
http://files.pine64.org/sw/pine64_installer/json/lxde.png<br />
<br />
=== Bionic LXDE Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* Included LXDE Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-lxde-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): B74E8366615DAE89AEB5CC878F2B316B<br />
** size: 763MB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Bionic Mate ==<br />
http://files.pine64.org/sw/pine64_installer/json/mate.png<br />
<br />
=== Bionic Mate Community Build Image [microSD Boot] by ayufan ===<br />
* Included Mate Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-mate-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): 5F60494B9248570FAF5853860A26B489<br />
** size: 1.06GB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Chromium ==<br />
http://files.pine64.org/sw/pine64_installer/json/chromium.jpg<br />
<br />
=== Chromium Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* DD image (for 8GB micoSD card/16GB eMMC module and above)<br />
** [https://github.com/ayufan-rock64/chromiumos-build/releases/download/R77-12371.7.104.g78f88d6/chromiumos-rockpro64-R77-12371.7.104.g78f88d6.img.xz Direct download R77 build from ayufan's github]<br />
** MD5 (XZ file): 7B747B6D2B041C5C0C6434DDB524DB66<br />
** size: 387MB<br />
<br />
= Android Image Releases =<br />
== Android 7.1 microSD ==<br />
http://files.pine64.org/sw/pine64_installer/json/android_7.png<br />
<br />
=== Stock Android for DD method [micro SD Boot] [20190918] ===<br />
* Production floor testing image <br />
* DD image to microSD card and boot. <br />
* Highly recommend using [https://etcher.io/ Etcher] or [https://github.com/pine64dev/PINE64-Installer/blob/master/README.md#download PINE64 Installer]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
* DD image for 8GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-8GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 207BCBFFF59C1AB29F8ADC63D426EACB<br />
*** File Size: 562MB<br />
* DD image for 16GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-16GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): B1FC25A2F896F5C6B4B85EA6D1E75CDA<br />
*** File Size: 571MB<br />
* DD image for 32GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-32GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): A07E2C2A2798A77375268E423A30048A<br />
*** File Size: 589MB<br />
* DD image for 64GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): D7626BD50443A88AEB9254C88C575284<br />
*** File Size: 627MB<br />
<br />
=== Stock for RK Flash tool [SD Boot] [20190427] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/SDDiskTool_v1.57.zip Rockchip SD Firmware Tool ver 1.57] to flash in, please remember to select "SD boot" option.<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190918_stock_android_7.1_sdboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DBA2109C393F514132EC8D5FB6E8EBE2<br />
** File Size: 555MB<br />
<br />
== Android 7.1 eMMC ==<br />
=== Stock Android for DD method [eMMC Boot] [20190807] ===<br />
* Production floor testing image <br />
* Please allows some time (around 5 minutes) for the initialization process on 1st boot<br />
* DD image for 64GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 314583B550AFF0F424D9997D237D7046<br />
*** File Size: 634MB<br />
* DD image for 128GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-128GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 16942B8F9EEE79B81FADDB09AF7E2E80<br />
*** File Size: 700MB<br />
<br />
=== Stock for RK Flash tool [eMMC Boot] [20190807] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/AndroidTool_Release_v2.63.zip Rockchip Android tool ver 2.63] to flash in<br />
* The OTG port located at USB type-C connector, needs USB type A to type C cable.<br />
* [http://wiki.pine64.org/index.php/NOOB#Flashing_to_eMMC_using_Rockchip_Tools_.28Rock64_Only.29 Guide to flashing eMMC using Rockchip Tools]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190807_stock_android_7.1_emmcboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DC4C330787E57FC05F9D7D740F741620<br />
** File Size: 555MB<br />
<br />
= Linux Installer Releases =<br />
== Debian Installer ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Installer for Pinebook Pro ===<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please use [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Software_Releases&diff=4278Pinebook Pro Software Releases2019-12-18T09:37:56Z<p>Danielt: /* Debian Installer */</p>
<hr />
<div>= Linux Image Releases =<br />
== Debian Desktop ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Desktop Community Build Image [microSD to eMMC] by mrfixit2001 ===<br />
* This is the default OS comes with Pinebook Pro<br />
* Included Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB microSD card / 16GB eMMC module and above):<br />
** [https://github.com/mrfixit2001/debian_desktop/releases/download/191123/pinebookpro-debian-desktop-mrfixit-191123.img.xz Direct download release build 191123 from mrfixit2001's github]<br />
*** MD5 (img file): BF67F3A0229769A7472D418AD45F8AB0<br />
*** File Size: 1.19GB<br />
* Login with<br />
** username: rock<br />
** password: rock<br />
<br />
== Bionic LXDE ==<br />
http://files.pine64.org/sw/pine64_installer/json/lxde.png<br />
<br />
=== Bionic LXDE Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* Included LXDE Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-lxde-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): B74E8366615DAE89AEB5CC878F2B316B<br />
** size: 763MB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Bionic Mate ==<br />
http://files.pine64.org/sw/pine64_installer/json/mate.png<br />
<br />
=== Bionic Mate Community Build Image [microSD Boot] by ayufan ===<br />
* Included Mate Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-mate-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): 5F60494B9248570FAF5853860A26B489<br />
** size: 1.06GB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Chromium ==<br />
http://files.pine64.org/sw/pine64_installer/json/chromium.jpg<br />
<br />
=== Chromium Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* DD image (for 8GB micoSD card/16GB eMMC module and above)<br />
** [https://github.com/ayufan-rock64/chromiumos-build/releases/download/R77-12371.7.104.g78f88d6/chromiumos-rockpro64-R77-12371.7.104.g78f88d6.img.xz Direct download R77 build from ayufan's github]<br />
** MD5 (XZ file): 7B747B6D2B041C5C0C6434DDB524DB66<br />
** size: 387MB<br />
<br />
= Android Image Releases =<br />
== Android 7.1 microSD ==<br />
http://files.pine64.org/sw/pine64_installer/json/android_7.png<br />
<br />
=== Stock Android for DD method [micro SD Boot] [20190918] ===<br />
* Production floor testing image <br />
* DD image to microSD card and boot. <br />
* Highly recommend using [https://etcher.io/ Etcher] or [https://github.com/pine64dev/PINE64-Installer/blob/master/README.md#download PINE64 Installer]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
* DD image for 8GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-8GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 207BCBFFF59C1AB29F8ADC63D426EACB<br />
*** File Size: 562MB<br />
* DD image for 16GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-16GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): B1FC25A2F896F5C6B4B85EA6D1E75CDA<br />
*** File Size: 571MB<br />
* DD image for 32GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-32GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): A07E2C2A2798A77375268E423A30048A<br />
*** File Size: 589MB<br />
* DD image for 64GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): D7626BD50443A88AEB9254C88C575284<br />
*** File Size: 627MB<br />
<br />
=== Stock for RK Flash tool [SD Boot] [20190427] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/SDDiskTool_v1.57.zip Rockchip SD Firmware Tool ver 1.57] to flash in, please remember to select "SD boot" option.<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190918_stock_android_7.1_sdboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DBA2109C393F514132EC8D5FB6E8EBE2<br />
** File Size: 555MB<br />
<br />
== Android 7.1 eMMC ==<br />
=== Stock Android for DD method [eMMC Boot] [20190807] ===<br />
* Production floor testing image <br />
* Please allows some time (around 5 minutes) for the initialization process on 1st boot<br />
* DD image for 64GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 314583B550AFF0F424D9997D237D7046<br />
*** File Size: 634MB<br />
* DD image for 128GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-128GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 16942B8F9EEE79B81FADDB09AF7E2E80<br />
*** File Size: 700MB<br />
<br />
=== Stock for RK Flash tool [eMMC Boot] [20190807] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/AndroidTool_Release_v2.63.zip Rockchip Android tool ver 2.63] to flash in<br />
* The OTG port located at USB type-C connector, needs USB type A to type C cable.<br />
* [http://wiki.pine64.org/index.php/NOOB#Flashing_to_eMMC_using_Rockchip_Tools_.28Rock64_Only.29 Guide to flashing eMMC using Rockchip Tools]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190807_stock_android_7.1_emmcboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DC4C330787E57FC05F9D7D740F741620<br />
** File Size: 555MB<br />
<br />
= Linux Installer Releases =<br />
== Debian Installer ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Installer for Pinebook Pro ===<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/<br />
* Pull requests welcome but for discussion and support please [https://forum.pine64.org/showthread.php?tid=8487 the forum topic].</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro&diff=4272Pinebook Pro2019-12-17T16:15:28Z<p>Danielt: </p>
<hr />
<div>= User Guide =<br />
== Introducing PineBook Pro == <br />
[[File:PBP.jpg|400px|thumb|right|Pinebook Pro running stock Debian with MATE]]<br />
<br />
The Pinebook Pro is a Linux and *BSD ARM laptop from [https://www.pine64.org/ PINE64]<br />
<br />
It is built to be a compelling alternative to mid-ranged Chromebooks that people convert into Linux laptops. It features an IPS 1080p 14″ LCD panel, a premium magnesium alloy shell, high capacity eMMC storage, a 10,000 mAh capacity battery, and the modularity that only an open source project can deliver. <br />
<br />
Key features include: the RK3399 SOC; USB-C for data, video-out and power-in (3A 5V); privacy switches for the microphone, BT/WiFi module, and camera; and expandable storage via NVMe (PCIe 4x) with an optional adapter. <br />
<br />
The Pinebook Pro is equipped with 4GB LPDDR4 system memory, high capacity eMMC flash storage, and 128Mb SPI boot Flash. The I/O includes: 1x micro SD card reader (bootable), 1x USB 2.0, 1x USB 3.0, 1x USB type C Host with DP 1.2 and power-in, PCIe 4x for an NVMe SSD drive (requires an optional adapter), and UART (via the headphone jack by setting an internal switch). <br />
<br />
The keyboard and trackpad both use the USB 2.0 protocol. The LCD panel uses eDP MiPi display protocol.<br />
<br />
Many different Operating Systems (OS) are freely available from the open source community and partner projects. These include various flavors of Linux (Ubuntu, Debian, Manjaro, etc.) and *BSD. <br />
<br />
== Software and OS Image Downloads ==<br />
=== [[Pinebook Pro_Software_Release|Pinebook Pro]] ===<br />
Under [[Pinebook Pro Software Release|'Pinebook Pro Software and OS Image Download Section']] you will find a complete list of currently supported Operating System images that work with the Pinebook as well as other related software. <br />
<br />
The list includes OS images and descriptions of:<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Debian_Desktop}} http://files.pine64.org/sw/pine64_installer/json/debian.png] [[PinebookPro_Software_Release#Debian Desktop|'''Debian Desktop (microSD and eMMC Boot)''']]<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Bionic_LXDE}} http://files.pine64.org/sw/pine64_installer/json/lxde.png] [[PinebookPro_Software_Release#Bionic LXDE|'''Bionic LXDE (microSD and eMMC Boot)''']]<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Bionic_Mate}} http://files.pine64.org/sw/pine64_installer/json/mate.png] [[PinebookPro_Software_Release#Bionic Mate|'''Bionic Mate (microSD and eMMC Boot)''']]<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Chromium}} http://files.pine64.org/sw/pine64_installer/json/chromium.jpg] [[PinebookPro_Software_Release#Chromium|'''Chromium (microSD and eMMC Boot)''']]<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Android_7.1_microSD}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_microSD|'''Android 7.1 (microSD Boot)''']] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [{{fullurl:PinebookPro_Software_Release#Android_7.1_eMMC}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_eMMC|'''Android 7.1 (eMMC)''']]<br />
<br />
[{{fullurl:PinebookPro_Software_Release#Debian_Installer_for_Pinebook_Pro}} http://files.pine64.org/sw/pine64_installer/json/debian.png] [[PinebookPro_Software_Release#Debian_Installer_for_Pinebook_Pro|'''Debian Installer for Pinebook Pro''']]<br />
<br />
=== Quick Links to OS Images Build Sources===<br />
'''Some of the provided OS images are still in <span style="color:#FF0000">beta or nightly build</span> and only fit for testing purposes. These images ought to be avoided for normal usage - use them at <span style="color:#FF0000">your own risk</span>'''<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ ayufan's Linux build repo]<br />
* [https://github.com/ayufan-rock64/chromiumos-build/releases ayufan's Chromium OS build repo]<br />
* [https://github.com/mrfixit2001/debian_desktop/releases mrfixit2001's Linux debian desktop build repo]<br />
<br />
== Keyboard ==<br />
The Pinebook Pro is available in two keyboard configurations: ISO and ANSI. Both the keyboard and trackpad in the Pinebook Pro use the USB 2.0 protocol and show up as such in xinput. The keyboard features function (Fn) keys in the F-key row, which include display brightness controls, sound volume, trackpad lock, and other functionality. There is also a custom PINE64 logo key that functions as Menu/Super key. It has also a secondary functionality for setting the privacy switches. <br />
<br />
The keyboard firmware binary can be flashed from userspace using the provided open source utility. <br />
<br />
Documentation for the keyboard can be found in [[#Datasheets for Components and Peripherals|Datasheets for Components and Peripherals]]. <br />
<br />
=== Typing special characters ===<br />
The UK ISO Layout does not have dedicated keys for characters like the German umlauts (Ä,Ö,Ü, etc). Certain characters can still be generated by means of either key combinations or key sequences. <br />
{| class="wikitable"<br />
!Character<br />
!Key combination/sequence<br />
|-<br />
|Ä, Ö, Ü, ä, ö, ü<br />
|[[Wikipedia:AltGr_key|[AltGr]]]+'[' followed by [A], [O], [U], [a], [o] or [u]<br />
|-<br />
|µ<br />
|[AltGr]+[m]<br />
|-<br />
|Ø, ø<br />
|[AltGr]+[O], [AltGr]+[o]<br />
|-<br />
|@<br />
|[AltGr]+[q] (as on the German layout)<br />
|-<br />
|ß<br />
|[AltGr]+[s]<br />
|-<br />
|§<br />
|[AltGr]+[S]<br />
|-<br />
|°<br />
|[AltGr]+[)]<br />
|}<br />
<br />
=== Privacy Switches ===<br />
There are three privacy switches mapped to the F10, F11 and F12 keys on the Pinebook Pro keyboard. They de/activate the following:<br />
<br />
{| class="wikitable"<br />
|+ Privacy switch function and description<br />
! Combination<br />
! Effect<br />
! Description<br />
|-<br />
! scope=row | PINE64 logo key+F10<br />
| Microphone Privacy switch || CAPs lock LED blinks. 2 blinks = enabled, 3 blinks = disabled<br />
|-<br />
! scope=row | PINE64 logo key+F11<br />
| WiFi Privacy switch || NUM lock LED blinks. 2 blinks = enabled, 3 blinks = disabled. '''Re-enabling requires reboot''' (or a [//forum.pine64.org/showthread.php?tid=8313&pid=52645#pid52645 command line hack to bind/unbind]).<br />
|-<br />
! scope=row | PINE64 logo key+F12<br />
| Camera privacy switch || CAPs lock and NUM lock LEDs blink together. 2 blinks = enabled, 3 blinks = disabled<br />
|}<br />
<br />
'''(Press the PINE64 logo key plus Fn (10/11/12) for 3 seconds)'''<br />
<br />
The keyboard uses special firmware that operates separately of the operating system. It detects if either the F10, F11 or F12 key, and the Pine key were pressed for 3 seconds. This disables the peripherals as listed above by cutting off their power. Which has the same result as cutting off the power to each peripheral with a physical switch. This implementation is very secure since the firmware that determines whether a peripheral gets power is not a part of the Pinebook Pro’s operating system. So the power state value for each peripheral cannot be overridden or accessed from the operating system. The power state setting for each peripheral is stored across reboots.<br />
<br />
== Trackpad ==<br />
The trackpad is large, smooth (metallic to-the-touch), and has two actuating buttons. It is the only component of the Pinebook Pro held in place with strong adhesive tape. It supports multi-touch functionality. <br />
Documentation for the trackpad can be found in [[#Datasheets for Components and Peripherals|Datasheets for Components and Peripherals]].<br />
The trackpad firmware binary can be flashed from userspace using the provided open source utility (https://github.com/ayufan-rock64/pinebook-pro-keyboard-updater).<br />
<br />
'''Everyone with a Pinebook Pro produced in 2019 should update their keyboard and trackpad firmware.''' <br />
<br />
Before you start:<br />
<br />
Please refer to original documentation for details.<br />
<br />
Your Pinebook Pro should be either fully charged or, preferably, running of mains. This utility will be writing chips on the keyboard and trackpad, so a loss of power during any stage of the update can result in irrecoverable damage to your trackpad or keyboard.<br />
<br />
The scripts ought to work on all OSs available for the Pinebook Pro. Some OSs may, however, require installation of relevant dependencies.<br />
<br />
What you will need:<br />
<br />
*Your Pinebook Pro fully charged or running off of mains power<br />
*Connection to WiFi<br />
*An external USB mouse or access to the Pinebebook Pro via ssh <br />
<br />
From the terminal command line: <br />
<br />
<pre><br />
git clone https://github.com/ayufan-rock64/pinebook-pro-keyboard-updater<br />
cd pinebook-pro-keyboard-updater<br />
sudo apt-get install build-essential libusb-1.0-0-dev xxd<br />
make<br />
</pre><br />
<br />
Step 1<br />
<pre><br />
cd pinebook-pro-keyboard-updater<br />
sudo ./updater step-1<br />
sudo reboot<br />
</pre><br />
<br />
Step 2 (after reboot)<br />
<pre><br />
cd pinebook-pro-keyboard-updater<br />
sudo ./updater step-2<br />
sudo reboot<br />
</pre><br />
<br />
== Power Supply ==<br />
* Input Power: 5V DC @ 3A<br />
* Mechanical: 3.5mm OD / 1.35mm ID, Barrel jack<br />
* USB-C 15W PD quickcharge<br />
* Only use one power input at a time, barrel jack OR USB-C<br />
<br />
== LEDs ==<br />
In total there are four LEDs on the Pinebook Pro, three of which are placed in the top left side of the keyboard, and one near the barrel-port: <br />
<br />
:1. The red LED next to the barrel-port indicates charging. It will illuminate when mains power is supplied to the Pinebook Pro from either the standard power supply unit or a USB-C smartphone charger.<br />
<br />
:2. The power indicator LED on the Pinebook Pro supports three different colours: green, amber and red. It is also capable of flashing/blinking to indicate activity. In the default Debian with MATE build, green LED means power and red means suspend (amber is unused). <br />
<br />
:3. The Num lock, green LED.<br />
<br />
:4. The Caps lock, green LED.<br />
<br />
(The Num and Caps lock LEDs have a secondary function. When the privacy switches get activated they blink to confirm that switch has been activated.)<br />
<br />
== Webcam ==<br />
* 1080p resolution<br />
* Some people test with the application Cheese<br />
WIP<br />
<br />
== Microphones ==<br />
Some Pinebook Pro chassis have 2 microphone labeled holes. Only the right hole is populated with a microphone.<br />
<br />
== Bluetooth and WiFi ==<br />
WIP<br />
<br />
== LCD Panel ==<br />
* 1080p resolution<br />
WIP<br />
<br />
== Using the UART ==<br />
[[File:PBPUART.jpeg|400px|thumb|right|Headphone Jack UART wiring reference]]<br />
<br />
UART output is enabled by flipping the UART switch to the ON position (item 9). To do so you need to remove the Pinebook Pro's bottom cover - please follow [https://wiki.pine64.org/index.php/Pinebook_Pro_Main_Page#Accessing_the_Internals_-_Disassembly_and_Reassembly proper disassembly and reassembly protocol]. The OFF position is towards the touchpad, the ON position is towards the display hinges.<br />
<br />
With the UART switch in the ON position, console is relayed via the audiojack and the laptop's sound is turned OFF. Please ensure that you are using a 3.3v interface (such as the CH340, FTDI-232R, or PL2303, which are sold in both 3.3v and 5v variants) to avoid damage to the CPU. <br />
<br />
Insert the USB plug of the cable into an open USB port on the machine which will monitor. Run the following in a terminal:<br />
<br />
<code><br />
$ lsusb<br />
</code><br />
<br />
you should find a line similar to this:<br />
<br />
<code><br />
Bus 001 Device 058: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter<br />
</code><br />
<br />
You may have to clean the USB contacts of the Serial cable to get a good connection if you do not find that line.<br />
<br />
The audio jack of the Serial cable should be fully inserted into the Pinebook Pro audio port.<br />
<br />
Serial output should now be accessible using screen, picocom or minicom (and others).<br />
Examples:<br />
<br />
<code><br />
screen /dev/ttyUSB0 1500000<br />
<br />
picocom /dev/ttyUSB0 -b 1500000<br />
<br />
minicom -D /dev/ttyUSB0 -b 1500000</code><br />
<br />
Current versions of U-Boot do not use the UART for console output. The console function is activated by the Linux kernel. Thus, if you use a non-Pinebook Pro Linux distro and want the UART as a console, you have to manually enable it.<br />
<br />
== Using the optional NVMe adapter ==<br />
The optional NVMe adapter allows the use of M.2 cards that support the NVMe standard, (but not SATA standard).<br />
<br />
=== Installing the adapter ===<br />
The v2.1 SSD adapter that shipped with the initial Pinebook Pro batches had significant issues. A repair kit will be shipped to address those issues.<br />
<br />
(If necessary, they can be modified to work. There is [https://forum.pine64.org/showthread.php?tid=8322&pid=52700#pid52700 an unofficial tutorial on the forums] describing these modifications.)<br />
<br />
=== Using as data drive ===<br />
As long as the kernel in use has both the PCIe and NVMe drivers, you should be able to use a NVMe drive as a data drive. It can automatically mount when booting from either the eMMC or an SD card. This applies to both Linux and FreeBSD, using the normal partitioning and file system creation tools. Android and Chromium OS require testing.<br />
<br />
=== Using as OS root drive ===<br />
It is not possible to boot directly off an NVMe drive. The SoC does not include the NVMe boot code, so the NVMe is not in the SoC's boot order.<br />
<br />
However, it is possible to initially boot off an eMMC or SD card, then transfer to a root file system on the NVMe. Currently, it is necessary to have the U-Boot code on an eMMC or SD card. (A forum member [https://forum.pine64.org/showthread.php?tid=8439 posted here] about using a modified version of U-Boot with NVMe drivers, that uses <code>/boot</code> and <code>/</code> off the NVMe drive. So this may change in the future.)<br />
<br />
Please see [[Pinebook_Pro#Bootable Storage|Bootable Storage]].<br />
<br />
== Caring for the PineBook Pro ==<br />
=== Bypass Cables ===<br />
The mainboard features two (disconnected by default) bypass cables that are only to be used with the battery disconnected. The female (10) male (6) ends of the bypass cables can be connected to provide power to the mainboard if you need to run the laptop without a battery. Please refer to this [http://files.pine64.org/doc/PinebookPro/PinebookPro_Engineering_Notice.pdf engineering notice]. <br />
<br />
WARNING: Do not connect the bypass cables with the battery connected. Using the bypass cables with the battery connected can permanently damage the computer.<br />
<br />
=== [[Pinebook_Service_Step_by_Step_Guides|Pinebook Service Step-by-Step Guides]] ===<br />
<span style="color:#FF0000">Placeholder for Pinebook Pro specific guides</span><br />
<br />
Under [[Pinebook_Service_Step_by_Step_Guides|'Service Guides for Pinebook']] you can find instructions guides concerning disassembly of:<br />
<br />
'''Note: The installation process on Pinebook Pro similar to 14" Pinebook'''<br />
<br />
'''Note: The installation process is the reverse order of removal guide'''<br />
<br />
* 14″ Pinebook Lithium Battery Pack Removal Guide<br />
* 14″ Pinebook LCD Panel Screen Removal Guide<br />
* 14″ Pinebook eMMC Module Removal Guide<br />
<br />
== FAQ ==<br />
What cool software works out of the box? [[Pinebook Pro OTB Experience]]<br />
<br />
= Troubleshooting guide =<br />
Tips, tricks and other information for troubleshooting your Pinebook Pro<br />
=== New from the factory - Pinebook Pro won't boot / power on ===<br />
* Some Pinebook Pros came from the factory with the eMMC switch in the disabled position. It should be switched towards the back / hinge to enable the eMMC.<br><br />
* The eMMC may have come loose during shipment. [https://wiki.pine64.org/index.php/Pinebook_Pro_Main_Page#Accessing_the_Internals_-_Disassembly_and_Reassembly Open] the back and verify that the eMMC is firmly seated.<br><br />
* You may want to try unplugging the SD card daughterboard ribbon cable and see if it powers on (remove the battery and peel off a bit of the tape before unplugging it to avoid damage). If it does, try reseating it on both sides. It might have come loose during shipping.<br />
* It's possible that your eMMC is empty from the factory. Simply create a bootable SD card and see if your Pinebook Pro boots. If so, you can then write an OS image to the eMMC.<br />
<br />
=== Pinebook Pro will not power on after toggling the eMMC enable/disable switch ===<br />
* This may happen if you meant to toggle the UART/Headphone switch (9) towards touchpad for headphone use and instead you toggled the eMMC enable/disable switch (24).<br />
* After reenabling eMMC by toggling switch (24) towards hinge, if Pinebook Pro does not turn on then press the RESET button (28). It is clearly marked 'reset' on the PCB board.<br />
<br />
=== Pinebook Pro will not power on after removing and replacing EMI shielding ===<br />
* Closely inspect that the shielding is firmly seated in the clips on all sides. You can be seated in the clips on one axis, and have missed on an another axis.<br />
<br />
=== Pinebook Pro won't boot when using UART console cable ===<br />
* If you're using the UART cable sold on the Pine Store, you may want to see if it boots after you disconnect it. Some users report that custom-made cables based on FTDI UART adapters do not cause this issue.<br />
* Make sure your USB to serial UART device is 3.3v. Many are 5v and some even +-12v. Pinebook Pro's only support 3.3v and may act eratically when using higher voltage. Further, higher voltage could permananetly damage the Pinebook Pro's SoC.<br />
<br />
=== Keys not registering / missing keys when typing ===<br />
This issue occurs when your thumb or edge of the palm makes contact with left or right tip of the trackpad when you type. This is due to the palm rejection firmware being too forceful. Instead of only disabling the trackpad, so your cursor does not move all over the screen, it disables both the trackpad and the keyboard.<br />
<br />
Using Fn+F7 to disable the touchpad will keep it from also disabling the keyboard.<br />
<br />
A [[Pinebook_Pro#Trackpad|firmware update]] has been released to address this.<br />
<br />
=== WiFi issues ===<br />
* First, check the privacy switches to make sure your WiFi is enabled. They are persistant. See [[Pinebook_Pro_Main_Page#Privacy_Switches|Privacy Switches]]<br />
* Next, you may have to modify the <code>/etc/NetworkManager/NetworkManager.conf</code> as root user, and replace <code>managed=false</code> with <code>managed=true</code>. Then reboot.<br />
* For connections that drop and resume too often, it might be due to WiFi power management from earlier OS releases. Later OS releases either removed WiFi power management, or default to full power. (Power management can be turned off via command line with <code>iw dev wlan0 set power_save off</code> or <code>iwconfig wlan0 power off</code>, although it is not persistent through re-boot.)<br />
* If WiFi is un-usable or often crashes when using an alternate OS, then it might because its WiFi firmware is not appropriate for the WiFi chip in the Pinebook Pro. Try the latest firmware patch from [https://gitlab.manjaro.org/tsys/pinebook-firmware/tree/master/brcm https://gitlab.manjaro.org/tsys/pinebook-firmware/tree/master/brcm]<br />
<br />
=== Bluetooth issues ===<br />
* When connecting a Bluetooth device, such as a Bluetooth mouse, it does not automatically re-connect on re-boot. In the Bluetooth connection GUI, there is a yellow star for re-connect on boot. Use that button to enable a persistent connection. It can be changed back later.<br />
* Bluetooth-attached speakers or headset require the <b>pulseaudio-module-bluetooth</b> package. If not already installed, it can be installed with a package manager or with:<br><br />
<pre>sudo apt-get install pulseaudio-module-bluetooth</pre><br />
<br />
=== Sound issues ===<br />
* Many reports of no sound are due to the OS, incorrect settings, or other software problems (eg. PulseAudio). So first test to see if it is a software or hardware problem, by trying another OS via SD card. (For example, if Debian is installed on the eMMC, try Ubuntu on SD.) <br />
* If you cannot get sound from the headphone jack, but can get sound from the speakers, then the headphone / UART console switch may be set to the UART mode. You can open the back and check the position of the switch. If set to UART mode, switch it to headphone mode. See the parts layout for the location and correct position of the switch.<br />
* When using the USB C alternate DisplayPort mode, it is possible that the audio has been re-directed through this path. If your monitor has speakers, then see if they work.<br />
* See this [https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/blob/master/asound.state /var/lib/alsa/asound.state] for some Alsa tweaks<br />
<br />
=== USB docks & USB C alternate mode video ===<br />
The Pinebook Pro uses the RK3399 SoC (System on a Chip). It supports a video pass through mode on the USB C port using DisplayPort alternate mode. This DisplayPort output comes from the same GPU used to display the built-in LCD. <br />
<br />
Here are some selection criteria for successfully using the USB C alternate mode for video:<br />
* The device must use USB C alternate mode DisplayPort. Not USB C alternate mode HDMI, or other.<br />
* The device can have a HDMI, DVI, or VGA connector, if it uses an active translater.<br />
* If USB 3 is also desired from a USB dock, the maximum resolution, frame rate and pixel depth is reduced to half the bandwidth. For example, 4K @ 30hz instead of 60hz.<br />
* USB docks that also use USB C alternate mode DisplayPort will always have USB 2 available, (480Mbps, half-duplex).<br />
<br />
=== Key Mapping ===<br />
* See this [https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/blob/master/10-usb-kbd.hwdb /etc/udev/hwdb.d/10-usb-kbd.hwdb] for some key mapping tweaks<br />
<br />
<br />
=== Accessory Hardware Compatibility ===<br />
* [[PBP_HW_Compatibiity|PineBookPro Hardware Compatibility]]<br />
<br />
= Technical Reference =<br />
== Accessing the Internals - Disassembly and Reassembly == <br />
[[File:Standoffs.png|400px|thumb|right|Pinebook Screw stand-offs correct placement and location]]<br />
<br />
'''WARNING:''' Do not open the laptop by lifting the lid while the Pinebook Pro bottom cover is removed - this can cause structural damage to the hinges and/or other plastic components of the chassis such as the IO port cut-outs.<br />
<br />
'''WARNING:''' When removing the back cover plate, use care if sliding fingertips between back cover plate and palm rest assembly. The back cover plate edges are sharp.<br />
<br />
When disassembling the laptop make sure that it is powered off and folded closed. To remove the bottom cover of the Pinebook Pro, first remove the ten (10) Phillips head screws that hold the bottom section of the laptop in place. Remove the cover from the back where the hinges are situated by lifting it up and away from the rest of the chassis.<br />
<br />
During reassembly, make sure that the back-screw standoffs are in place and seated correctly. To reassemble the Pinebook Pro, slide the bottom section into place so it meets the front lip of the keyboard section. Secure the front section (where the trackpad is located) in place using the short screws in the front left and right corners. Then proceed to pop in the bottom panel into place. Secure the bottom section (where hinges are located) by screwing in the left and right corners. Then screw in the remaining screws and run your finger though the rim on the chassis to make sure its fitted correctly. Note that the front uses the remaining 2 short screws.<br />
<br />
NOTE: The screws are small and should only be finger tight. Too much force will strip the threads. If after installing screws the back cover plate has not seated properly on one side, open the display and hold the base on either side of the keyboard and gently flex the base with both hands in opposing directions. Once the side pops further in, then recheck the screws on that side. If it does not pop back in, just let it be.<br />
<br />
== Pinebook Pro Internal Layout ==<br />
=== Main chips ===<br />
* RK3399 system-on-chip (1)<br />
* LPDDR4 SDRAM (21)<br />
* SPI NOR flash memory (29)<br />
* eMMC flash memory (26)<br />
* WiFi/BT module (27)<br />
<br />
=== Mainboard Switches and Buttons ===<br />
There are two switches on the main board: disabling the eMMC (24), and enabling UART (9) via headphone jack. <br />
<br />
The Reset and Recovery buttons (28): the reset button performs an immediate reset of the laptop. The Recovery button is used to place the device in maskrom mode; this mode allows flashing eMMC using Rockchip tools (e.g. rkflashtools). <br />
<br />
[[File:PBPL_S.jpg]]<br />
<br />
=== Key Internal Parts ===<br />
{| class="wikitable"<br />
|+ Numbered parts classification and description<br />
! Number<br />
! Type<br />
! Descriptor<br />
|-<br />
! scope=row | 1<br />
| Component || RK3399 System-On-Chip<br />
|-<br />
! scope=row | 2<br />
| Socket || PCIe 4X socket for optional NVMe adapter<br />
|-<br />
! scope=row | 3<br />
| Socket || Speakers socket<br />
|-<br />
! scope=row | 4<br />
| Socket || Trackpad socket<br />
|-<br />
! scope=row | 5<br />
| Component || Left speaker <br />
|-<br />
! scope=row | 6<br />
| Connector || Male power bridge connector <br />
|-<br />
! scope=row | 7<br />
| Socket || Keyboard Socket<br />
|-<br />
! scope=row | 8<br />
| Component || Optional NVMe SSD adapter<br />
|-<br />
! scope=row | 9<br />
| Switch || UART/Audio switch - outputs UART via headphone jack<br />
|-<br />
! scope=row | 10<br />
| Socket || Female power bridge socket<br />
|-<br />
! scope=row | 11<br />
| Socket || Battery socket<br />
|-<br />
! scope=row | 12<br />
| Component || Trackpad<br />
|-<br />
! scope=row | 13<br />
| Component || Battery<br />
|-<br />
! scope=row | 14<br />
| Component || Right speaker<br />
|-<br />
! scope=row | 15<br />
| Socket || MicroSD card slot<br />
|-<br />
! scope=row | 16<br />
| Socket || Headphone / UART jack<br />
|-<br />
! scope=row | 17<br />
| Socket || USB 2.0 Type A<br />
|-<br />
! scope=row | 18<br />
| Socket || Daughterboard-to-mainboard ribbon cable socket<br />
|-<br />
! scope=row | 19<br />
| Cable || Daughterboard-to-mainboard ribbon cable<br />
|-<br />
! scope=row | 20<br />
| Component || microphone<br />
|-<br />
! scope=row | 21<br />
| Component || LPDDR4 RAM<br />
|-<br />
! scope=row | 22<br />
| Socket || Mainboard-to-daughterboard ribbon cable socket<br />
|-<br />
! scope=row | 23<br />
| Socket || Microphone socket<br />
|-<br />
! scope=row | 24<br />
| Switch || Switch to hardware disable eMMC<br />
|-<br />
! scope=row | 25<br />
| Antenna || BT/WiFI antenna<br />
|-<br />
! scope=row | 26<br />
| Component || eMMC flash memory module <br />
|-<br />
! scope=row | 27<br />
| Component ||BT/WiFi module chip<br />
|-<br />
! scope=row | 28<br />
| Buttons || Reset and recovery buttons<br />
|-<br />
! scope=row | 29<br />
| Component || SPI flash storage<br />
|-<br />
! scope=row | 30<br />
| Socket || eDP LCD socket<br />
|-<br />
! scope=row | 31<br />
| Socket || Power in barrel socket<br />
|-<br />
! scope=row | 32<br />
| Socket || USB 3.0 Type A<br />
|-<br />
! scope=row | 33<br />
| Socket || USB 3.0 Type C <br />
|}<br />
<br />
== Bootable Storage ==<br />
The Pinebook Pro is capable of booting from eMMC, USB 2.0, USB 3.0, or an SD card. It cannot boot from USB-C. The boot order of the hard-coded ROM of its RK3399 SoC is: SPI NOR, eMMC, SD, USB OTG. <br />
<br />
At this time, the Pinebook Pro ships with a Debian + MATE build with [https://www.denx.de/wiki/U-Boot/ uboot] on the eMMC. Its boot order is: SD, then eMMC. Booting off USB storage is not currently available, but will be in the future.<br />
<br />
(An update has been pushed for the default Debian + MATE build that improves compatibility with booting other OSs from an SD card. In order to update, fully charge the battery, establish an internet connection, click the update icon in the toolbar, and then reboot your Pinebook Pro. Please see [https://forum.pine64.org/showthread.php?tid=7830 this log] for details.)<br />
<br />
Please note that PCIe, the interface used for NVMe SSD on the Pinebook Pro, is not bootable on the RK3399 and therefore is not a part of the boot hierarchy. It is possible to run the desired OS from NVMe by pointing extlinux on the eMMC to rootfs on the SSD. This requires uboot, the Kernel image, DTB, and extlinux.conf<br />
in a /boot partition on the eMMC.<br />
<br />
=== eMMC information ===<br />
The eMMC storage will show up as multiple block devices:<br />
*mmcblk1boot0 - eMMC standard boot0 partition, may be 4MB<br />
*mmcblk1boot1 - eMMC standard boot1 partition, may be 4MB<br />
*mmcblk1rpmb - eMMC standard secure data partition, may be 16MB<br />
*mmcblk1 - This block contains the user areas<br />
<br />
Only the last is usable as regular storage device in the Pinebook Pro.<br />
The device number of "1" shown above may vary, depending on kernel.<br />
<br />
=== Boot sequence details ===<br />
The RK3399's mask 32KB ROM boot code looks for the next stage of code at byte off-set 32768, (sector 64 if using 512 byte sectors). This is where U-Boot code would reside on any media that is bootable.<br />
<br />
== Pinebook Pro Dimensions ==<br />
* Dimensions: 329mm x 220mm x 12mm (WxDxH)<br />
* Weight: 1.26Kg<br />
<br />
== SoC and Memory Specification ==<br />
[[File:Rockchip_RK3399.png|right]]<br />
* Based on Rockchip RK3399<br />
<br />
=== CPU Architecture ===<br />
* big.LITTLE architecture: Dual Cortex-A72 + Quad Cortex-A53, 64-bit CPU<br />
** Full implementation of the ARM architecture v8-A instruction set (both AArch64 and AArch32)<br />
** ARM Neon Advanced SIMD (single instruction, multiple data) support for accelerated media and signal processing computation<br />
** ARMv8 Cryptography Extensions<br />
** VFPv4 floating point unit supporting single and double-precision operations<br />
** Hardware virtualization support<br />
** TrustZone technology support<br />
** Full CoreSight debug solution<br />
** One isolated voltage domain to support DVFS<br />
* Cortex-A72 (big cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a72 Dual-core Cortex-A72 up to 2.0GHz CPU]<br />
** Superscalar, variable-length, out-of-order pipeline<br />
** L1 cache 48KB Icache and 32KB Dcache for each A72 <br />
** L2 cache 1024KB for big cluster <br />
* Cortex-A53 (little cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a53 Quad-core Cortex-A53 up to 1.5GHz CPU]<br />
** In-order pipeline with symmetric dual-issue of most instructions <br />
** L1 cache 32KB Icache and 32KB Dcache for each A53<br />
** L2 cache 512KB for little cluster<br />
* Cortex-M0 (control processors):<br />
** [https://developer.arm.com/ip-products/processors/cortex-m/cortex-m0 Cortex-M0 CPU]<br />
** Two Cortex-M0 cooperate with the central processors<br />
** Architecture: Armv6-M<br />
** Thumb/Thumb2 instruction set<br />
** 32 bit only<br />
<br />
=== GPU Architecture ===<br />
* [https://developer.arm.com/products/graphics-and-multimedia/mali-gpus/mali-t860-and-mali-t880-gpus ARM Mali-T860MP4 Quad-core GPU]<br />
* The highest performance GPUs built on Arm Mali’s famous Midgard architecture, the Mali-T860 GPU is designed for complex graphics use cases and provide stunning visuals for UHD content.<br />
* Frequency 650MHz <br />
* Throughput 1300Mtri/s, 10.4Gpix/s <br />
* OpenGL® ES 1.1, 1.2, 2.0, 3.1, 3.2., Vulkan 1.0*., OpenCL™ 1.1, 1.2., DirectX® 11 FL11_1., RenderScript™.<br />
<br />
=== System Memory ===<br />
* RAM Memory:<br />
** LPDDR4<br />
** Dual memory channels on the CPU, each 32 bits wide<br />
** Quad memory channels on the RAM chip, each 16 bits wide, 2 bonded together for each CPU channel<br />
** 4GB as a single 366 pin mobile RAM chip<br />
* Storage Memory: <br />
** 64GB eMMC module, can be upgraded to a 128GB eMMC module. (The initial PINE64 community build version shipped with a 128GB eMMC.)<br />
** eMMC version 5.1, HS400, 8 bit on RK3399 side<br />
<br />
=== Battery ===<br />
* Lithium Polymer Battery (10,000 mAH)<br />
<br />
=== Display ===<br />
* 14.1" 1920x1080 IPS LCD panel<br />
<br />
=== Video out ===<br />
* USB-C Alt mode DP<br />
* Up to 3840x2160 p60, dependant on adapter, (2 lanes verses 4 lanes)<br />
<br />
=== Audio ===<br />
* 3.5mm stereo earphone/microphone plug<br />
* Build in stereo speakers<br />
<br />
=== Network ===<br />
* WiFi:<br />
** 802.11 b/g/n/ac<br />
** Dual band: 2.4Ghz & 5Ghz<br />
** Single antenna<br />
* Bluetooth 5.0<br />
<br />
=== Expansion Ports ===<br />
* MicroSD card:<br />
** Bootable<br />
** Supports SD, SDHC and SDXC cards, up to 512GB<br />
** Version SD3.0, (MMC 4.5), up to 50MB/s<br />
* USB ports:<br />
** 1 x USB 2.0 Type-A Host Port, bootable<br />
** 1 x USB 3.0 Type-A Host Port, 5Gbps, is not bootable<br />
** 1 x USB 3.0 Type-C OTG Port, 5Gbps, (includes laptop charging function), is not bootable<br />
* Headphone jack switchable to UART console mux circuit<br />
* Optional NVMe adapter:<br />
** PCIe 2.x, 5GT/s per lane<br />
** 4 PCIe lanes, can not be bifurcated, (however, can be used with 1 or 2 lane NVMe cards)<br />
** Maximum length for M.2 card is 80mm (M.2 2280)<br />
** Power: 2.5W continuous, 8.25W peak momentary<br />
** Does not support SATA M.2 cards<br />
** Does not support USB M.2 cards<br />
<br />
== Pinebook Pro Schematics and Certifications ==<br />
* Pinebook Pro Main Board Schematic And Silkscreen:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_mainboard_schematic.pdf Pinebook Pro Main Board ver 2.1 Schematic]<br />
** [https://wiki.pine64.org/images/3/30/Pinebookpro-v2.1-top-ref.pdf Pinebook Pro ver 2.1 Top Layer Silkscreen]<br />
** [https://wiki.pine64.org/images/b/b7/Pinebookpro-v2.1-bottom-ref.pdf Pinebook Pro ver 2.1 Bottom Layer Silkscreen]<br />
* Pinebook Pro Daughter Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_daughterboard_schematic.pdf Pinebook Pro Daughter Board ver 2.1 Schematic]<br />
* Optional Pinebook Pro NVMe Adapter Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_NVMe-adapter_schematic.pdf Pinebook Pro NVMe Adapter Board ver 2.1 Schematic]<br />
* Serial Console Earphone Jack Pinout:<br />
** [http://files.pine64.org/doc/pinebook/guide/Pinebook_Earphone_Serial_Console_Developer_Guide.pdf Pinkbook Serial Console Earphone Jack Pinout]<br />
* Pinebook Pro Case:<br />
** [https://send.firefox.com/download/b34c14f3e0a3d66d/#15Cx1vBaGKmJr57y85U2qQ AutoCAD DWG File]<br />
* Pinebook Pro Certifications:<br />
** Not Yet Available<br />
<br />
== Datasheets for Components and Peripherals ==<br />
* Rockchip RK3399 SoC information:<br />
** [http://www.rock-chips.com/a/en/products/RK33_Series/2016/0419/758.html Rockchip RK3399 SoC Brief]<br />
** [http://opensource.rock-chips.com/images/2/28/Rockchip_RK3399_Datasheet_V1.8-20180529.pdf Rockchip RK3399 Datasheet V1.8]<br />
** [http://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf Rockchip RK3399 Technical Reference Manual part 1]<br />
** [http://files.pine64.org/doc/datasheet/rockpro64/RK808%20datasheet%20V0.8.pdf Rockchip RK808 Datasheet V0.8]<br />
* LPDDR4 (366 Balls) SDRAM:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/micron%20SM512M64Z01MD4BNK-053FT%20LPDDR4%20(366Ball).pdf Micron 366 balls Mobile LPDDR4 Datasheet]<br />
* eMMC information:<br />
** [http://files.pine64.org/doc/rock64/PINE64_eMMC_Module_20170719.pdf PINE64 eMMC module schematic]<br />
** [http://files.pine64.org/doc/rock64/usb%20emmc%20module%20adapter%20v2.pdf PINE64 USB adapter for eMMC module V2 schematic]<br />
** [http://files.pine64.org/doc/rock64/USB%20adapter%20for%20eMMC%20module%20PCB.tar PINE64 USB adapter for eMMC module PCB in JPEG]<br />
** [http://files.pine64.org/doc/datasheet/pine64/SDINADF4-16-128GB-H%20data%20sheet%20v1.13.pdf SanDisk eMMC Datasheet]<br />
* SPI NOR Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pine64/w25q128jv%20spi%20revc%2011162016.pdf WinBond 128Mb SPI Flash Datasheet]<br />
** [https://wiki.pine64.org/images/b/b9/Ds-00220-gd25q127c-rev1-df2f4.pdf GigaDevice 128Mb SPI Flash Datasheet (UPDATED)]<br />
* Wireless related info:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/AP6256%20datasheet_V1.7_12282018.pdf AMPAK AP6256 11AC Wi-Fi + Bluetooth5 Datasheet]<br />
* Audio Codec (ES8316)<br />
** [http://everest-semi.com/pdf/ES8316%20PB.pdf Everest ES8316 Audio Codec]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/NV140FHM-N49_Rev.P0_20160804_201710235838.pdf 14" 1920x1080 IPS LCD Panel datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/YX%20HK-9562%20HID%20I2C%20Specification.pdf Touchpad Specification for Pinebook Pro model]<br />
* Keyboard information:<br />
** [http://www.sinowealth.com/ftp/ph/SH68F83/SH68F83V2.0.pdf Sinowealth SH68F83 Datasheet]<br />
** US ANSI: XK-HS002 MB27716023<br />
* Full HD Camera sensor:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/HK-2145-263.pdf Full HD Camera module specification in Chinese]<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/GC2145%20CSP%20DataSheet%20release%20V1.0_20131201.pdf GalaxyCore GC2145 Full HD Camera Sensor Data Sheet]<br />
* Lithium Battery information:<br />
** [http://files.pine64.org/doc/datasheet/pinebook/40110175P%203.8V%2010000mAh规格书-14.pdf 10000mAH Lithium Battery Specification for 14" model]<br />
<br />
=Skinning and Case Customization=<br />
* Template files for creating custom skins. Each includes template layers for art placement, and CUT lines.<br />
**[https://drive.google.com/open?id=1UKFlC53DO0GJm3Hz1E_669n_HhI45e4n Case Lid Template]<br />
**[https://drive.google.com/open?id=1Q6bKGarMDhvWz3HdGvhL5qDhyHb546ve Case Bottom Template]<br />
**[https://drive.google.com/open?id=1ugI74ygNJ3EN5jXks5jKvdpEAoxIzHo4 Case Palmrest Template]<br />
<br />
= Other Resources =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=111 Pinebook Pro Forum]<br />
* [https://forum.pine64.org/forumdisplay.php?fid=98 ROCKPro64 Forum]<br />
* [[RockPro64 Guides]]<br />
* [http://www.pine64.xyz:9090/?channels=ROCK64 ROCK64/ROCKPro64 IRC Channel]<br />
* [https://github.com/rockchip-linux Rockchip Linux GitHub Repo]<br />
* [http://opensource.rock-chips.com/ Rockchip Open Source Wiki]</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Software_Releases&diff=4271Pinebook Pro Software Releases2019-12-17T16:14:51Z<p>Danielt: /* Debian Installer for Pinebook Pro */</p>
<hr />
<div>= Linux Image Releases =<br />
== Debian Desktop ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Desktop Community Build Image [microSD to eMMC] by mrfixit2001 ===<br />
* This is the default OS comes with Pinebook Pro<br />
* Included Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB microSD card / 16GB eMMC module and above):<br />
** [https://github.com/mrfixit2001/debian_desktop/releases/download/191123/pinebookpro-debian-desktop-mrfixit-191123.img.xz Direct download release build 191123 from mrfixit2001's github]<br />
*** MD5 (img file): BF67F3A0229769A7472D418AD45F8AB0<br />
*** File Size: 1.19GB<br />
* Login with<br />
** username: rock<br />
** password: rock<br />
<br />
== Bionic LXDE ==<br />
http://files.pine64.org/sw/pine64_installer/json/lxde.png<br />
<br />
=== Bionic LXDE Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* Included LXDE Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-lxde-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): B74E8366615DAE89AEB5CC878F2B316B<br />
** size: 763MB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Bionic Mate ==<br />
http://files.pine64.org/sw/pine64_installer/json/mate.png<br />
<br />
=== Bionic Mate Community Build Image [microSD Boot] by ayufan ===<br />
* Included Mate Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-mate-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): 5F60494B9248570FAF5853860A26B489<br />
** size: 1.06GB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Chromium ==<br />
http://files.pine64.org/sw/pine64_installer/json/chromium.jpg<br />
<br />
=== Chromium Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* DD image (for 8GB micoSD card/16GB eMMC module and above)<br />
** [https://github.com/ayufan-rock64/chromiumos-build/releases/download/R77-12371.7.104.g78f88d6/chromiumos-rockpro64-R77-12371.7.104.g78f88d6.img.xz Direct download R77 build from ayufan's github]<br />
** MD5 (XZ file): 7B747B6D2B041C5C0C6434DDB524DB66<br />
** size: 387MB<br />
<br />
= Android Image Releases =<br />
== Android 7.1 microSD ==<br />
http://files.pine64.org/sw/pine64_installer/json/android_7.png<br />
<br />
=== Stock Android for DD method [micro SD Boot] [20190918] ===<br />
* Production floor testing image <br />
* DD image to microSD card and boot. <br />
* Highly recommend using [https://etcher.io/ Etcher] or [https://github.com/pine64dev/PINE64-Installer/blob/master/README.md#download PINE64 Installer]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
* DD image for 8GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-8GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 207BCBFFF59C1AB29F8ADC63D426EACB<br />
*** File Size: 562MB<br />
* DD image for 16GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-16GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): B1FC25A2F896F5C6B4B85EA6D1E75CDA<br />
*** File Size: 571MB<br />
* DD image for 32GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-32GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): A07E2C2A2798A77375268E423A30048A<br />
*** File Size: 589MB<br />
* DD image for 64GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): D7626BD50443A88AEB9254C88C575284<br />
*** File Size: 627MB<br />
<br />
=== Stock for RK Flash tool [SD Boot] [20190427] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/SDDiskTool_v1.57.zip Rockchip SD Firmware Tool ver 1.57] to flash in, please remember to select "SD boot" option.<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190918_stock_android_7.1_sdboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DBA2109C393F514132EC8D5FB6E8EBE2<br />
** File Size: 555MB<br />
<br />
== Android 7.1 eMMC ==<br />
=== Stock Android for DD method [eMMC Boot] [20190807] ===<br />
* Production floor testing image <br />
* Please allows some time (around 5 minutes) for the initialization process on 1st boot<br />
* DD image for 64GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 314583B550AFF0F424D9997D237D7046<br />
*** File Size: 634MB<br />
* DD image for 128GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-128GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 16942B8F9EEE79B81FADDB09AF7E2E80<br />
*** File Size: 700MB<br />
<br />
=== Stock for RK Flash tool [eMMC Boot] [20190807] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/AndroidTool_Release_v2.63.zip Rockchip Android tool ver 2.63] to flash in<br />
* The OTG port located at USB type-C connector, needs USB type A to type C cable.<br />
* [http://wiki.pine64.org/index.php/NOOB#Flashing_to_eMMC_using_Rockchip_Tools_.28Rock64_Only.29 Guide to flashing eMMC using Rockchip Tools]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190807_stock_android_7.1_emmcboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DC4C330787E57FC05F9D7D740F741620<br />
** File Size: 555MB<br />
<br />
= Linux Installer Releases =<br />
== Debian Installer ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Installer for Pinebook Pro ===<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro_Software_Releases&diff=4270Pinebook Pro Software Releases2019-12-17T16:01:59Z<p>Danielt: Add https://github.com/daniel-thompson/pinebook-pro-debian-installer/</p>
<hr />
<div>= Linux Image Releases =<br />
== Debian Desktop ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Debian Desktop Community Build Image [microSD to eMMC] by mrfixit2001 ===<br />
* This is the default OS comes with Pinebook Pro<br />
* Included Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB microSD card / 16GB eMMC module and above):<br />
** [https://github.com/mrfixit2001/debian_desktop/releases/download/191123/pinebookpro-debian-desktop-mrfixit-191123.img.xz Direct download release build 191123 from mrfixit2001's github]<br />
*** MD5 (img file): BF67F3A0229769A7472D418AD45F8AB0<br />
*** File Size: 1.19GB<br />
* Login with<br />
** username: rock<br />
** password: rock<br />
<br />
== Bionic LXDE ==<br />
http://files.pine64.org/sw/pine64_installer/json/lxde.png<br />
<br />
=== Bionic LXDE Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* Included LXDE Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-lxde-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): B74E8366615DAE89AEB5CC878F2B316B<br />
** size: 763MB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Bionic Mate ==<br />
http://files.pine64.org/sw/pine64_installer/json/mate.png<br />
<br />
=== Bionic Mate Community Build Image [microSD Boot] by ayufan ===<br />
* Included Mate Desktop, Firefox Browser, and LibreOffice Suite<br />
* DD image (for 8GB micoSD card /16GB eMMC module and above):<br />
** [https://github.com/ayufan-rock64/linux-build/releases/download/0.9.14/bionic-mate-pinebookpro-0.9.14-1159-armhf.img.xz Direct download release build 0.9.14 from ayufan's github]<br />
** MD5 (XZ file): 5F60494B9248570FAF5853860A26B489<br />
** size: 1.06GB<br />
* Login with<br />
** username: rock64<br />
** password: rock64<br />
<br />
== Chromium ==<br />
http://files.pine64.org/sw/pine64_installer/json/chromium.jpg<br />
<br />
=== Chromium Community Build Image by ayufan [microSD and eMMC Boot] ===<br />
* DD image (for 8GB micoSD card/16GB eMMC module and above)<br />
** [https://github.com/ayufan-rock64/chromiumos-build/releases/download/R77-12371.7.104.g78f88d6/chromiumos-rockpro64-R77-12371.7.104.g78f88d6.img.xz Direct download R77 build from ayufan's github]<br />
** MD5 (XZ file): 7B747B6D2B041C5C0C6434DDB524DB66<br />
** size: 387MB<br />
<br />
= Android Image Releases =<br />
== Android 7.1 microSD ==<br />
http://files.pine64.org/sw/pine64_installer/json/android_7.png<br />
<br />
=== Stock Android for DD method [micro SD Boot] [20190918] ===<br />
* Production floor testing image <br />
* DD image to microSD card and boot. <br />
* Highly recommend using [https://etcher.io/ Etcher] or [https://github.com/pine64dev/PINE64-Installer/blob/master/README.md#download PINE64 Installer]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
* DD image for 8GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-8GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 207BCBFFF59C1AB29F8ADC63D426EACB<br />
*** File Size: 562MB<br />
* DD image for 16GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-16GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): B1FC25A2F896F5C6B4B85EA6D1E75CDA<br />
*** File Size: 571MB<br />
* DD image for 32GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-32GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): A07E2C2A2798A77375268E423A30048A<br />
*** File Size: 589MB<br />
* DD image for 64GB microSD card<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190918_stock_android_7.1_sdboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): D7626BD50443A88AEB9254C88C575284<br />
*** File Size: 627MB<br />
<br />
=== Stock for RK Flash tool [SD Boot] [20190427] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/SDDiskTool_v1.57.zip Rockchip SD Firmware Tool ver 1.57] to flash in, please remember to select "SD boot" option.<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190918_stock_android_7.1_sdboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DBA2109C393F514132EC8D5FB6E8EBE2<br />
** File Size: 555MB<br />
<br />
== Android 7.1 eMMC ==<br />
=== Stock Android for DD method [eMMC Boot] [20190807] ===<br />
* Production floor testing image <br />
* Please allows some time (around 5 minutes) for the initialization process on 1st boot<br />
* DD image for 64GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-64GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 314583B550AFF0F424D9997D237D7046<br />
*** File Size: 634MB<br />
* DD image for 128GB eMMC Module<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_dd_20190807_stock_android_7.1_emmcboot-128GB.img.gz Direct download from pine64.org]<br />
*** MD5 (GZip file): 16942B8F9EEE79B81FADDB09AF7E2E80<br />
*** File Size: 700MB<br />
<br />
=== Stock for RK Flash tool [eMMC Boot] [20190807] ===<br />
* Please unzip first and then using [http://files.pine64.org/os/ROCK64/android/AndroidTool_Release_v2.63.zip Rockchip Android tool ver 2.63] to flash in<br />
* The OTG port located at USB type-C connector, needs USB type A to type C cable.<br />
* [http://wiki.pine64.org/index.php/NOOB#Flashing_to_eMMC_using_Rockchip_Tools_.28Rock64_Only.29 Guide to flashing eMMC using Rockchip Tools]<br />
* Please allow 3-5 minutes boot up time on first time for initialization<br />
** [http://files.pine64.org/os/PinebookPro/Android/PinebookPro_20190807_stock_android_7.1_emmcboot.img.gz Direct download from pine64.org]<br />
** MD5 (GZip file): DC4C330787E57FC05F9D7D740F741620<br />
** File Size: 555MB<br />
<br />
= Linux Installer Releases =<br />
== Debian Installer for Pinebook Pro ==<br />
http://files.pine64.org/sw/pine64_installer/json/debian.png<br />
<br />
=== Unofficial Debian installer for Pinebook Pro ===<br />
* This is an image creator and Debian installer that runs from an existing Linux OS and installs Debian Bullseye<br />
** Installer can configure an encrypted rootfs and provides a choice of desktops, including the default Debian desktop based on Gnome 3<br />
** Strict adoption of upstream Debian packages (with exception of kernel and bootloaders) in order to provide a clean upgrade path as Bullseye matures<br />
* Download at: https://github.com/daniel-thompson/pinebook-pro-debian-installer/</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro&diff=3987Pinebook Pro2019-11-14T10:32:06Z<p>Danielt: /* Installing the adapter */</p>
<hr />
<div>= User Guide =<br />
<br />
== Introducing PineBook Pro == <br />
[[File:PBP.jpg|400px|thumb|right|Pinebook Pro running stock Debian with MATE]]<br />
<br />
The Pinebook Pro is a Linux and *BSD ARM laptop from [https://www.pine64.org/ PINE64]<br />
<br />
It is built to be a compelling alternative to mid-ranged Chromebooks that people convert into Linux laptops. It features an IPS 1080p 14″ LCD panel, a premium magnesium alloy shell, high capacity eMMC storage, a 10,000 mAh capacity battery, and the modularity that only an open source project can deliver. <br />
<br />
Key features include: the RK3399 SOC; USB-C for data, video-out and power-in (3A 5V); privacy switches for the microphone, BT/WiFi module, and camera; and expandable storage via NVMe (PCIe 4x) with an optional adapter. <br />
<br />
The Pinebook Pro is equipped with 4GB LPDDR4 system memory, high capacity eMMC flash storage, and 128Mb SPI boot Flash. The I/O includes: 1x micro SD card reader (bootable), 1x USB 2.0, 1x USB 3.0, 1x USB type C Host with DP 1.2 and power-in, PCIe 4x for an NVMe SSD drive (requires an optional adapter), and UART (via the headphone jack by setting an internal switch). <br />
<br />
The keyboard and trackpad both use the USB 2.0 protocol. The LCD panel uses eDP MiPi display protocol.<br />
<br />
Many different Operating Systems (OS) are freely available from the open source community and partner projects. These include various flavors of Linux (Ubuntu, Debian, Manjaro, etc.) and *BSD. <br />
<br />
<br />
== Software and OS Image Downloads ==<br />
=== [[Pinebook Pro_Software_Release|Pinebook Pro]] ===<br />
Under [[Pinebook Pro Software Release|'Pinebook Pro Software and OS Image Download Section']] you will find a complete list of currently supported Operating System images that work with the Pinebook as well as other related software. <br />
<br />
The list includes OS images and descriptions of:<br />
* [{{fullurl:PinebookPro_Software_Release#Debian_Desktop}} http://files.pine64.org/sw/pine64_installer/json/debian.png] [[PinebookPro_Software_Release#Debian Desktop|'''Debian Desktop (microSD and eMMC Boot)''']]<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_LXDE}} http://files.pine64.org/sw/pine64_installer/json/lxde.png] [[PinebookPro_Software_Release#Bionic LXDE|'''Bionic LXDE (microSD and eMMC Boot)''']]<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_Mate}} http://files.pine64.org/sw/pine64_installer/json/mate.png] [[PinebookPro_Software_Release#Bionic Mate|'''Bionic Mate (microSD and eMMC Boot)''']]<br />
* [{{fullurl:PinebookPro_Software_Release#Chromium}} http://files.pine64.org/sw/pine64_installer/json/chromium.jpg] [[PinebookPro_Software_Release#Chromium|'''Chromium (microSD and eMMC Boot)''']]<br />
* [{{fullurl:PinebookPro_Software_Release#Android_7.1_microSD}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_microSD|'''Android 7.1 (microSD Boot)''']] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [{{fullurl:PinebookPro_Software_Release#Android_7.1_eMMC}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_eMMC|'''Android 7.1 (eMMC)''']]<br />
<br />
----<br />
<br />
=== Quick Links to OS Images Build Sources===<br />
'''Some of the provided OS images are still in <span style="color:#FF0000">beta or nightly build</span> and only fit for testing purposes. These images ought to be avoided for normal usage - use them at <span style="color:#FF0000">your own risk</span>'''<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ ayufan's Linux build repo]<br />
* [https://github.com/ayufan-rock64/chromiumos-build/releases ayufan's Chromium OS build repo]<br />
* [https://github.com/mrfixit2001/debian_desktop/releases mrfixit2001's Linux debian desktop build repo]<br />
<br />
== Keyboard ==<br />
The Pinebook Pro is available in two keyboard configurations: ISO and ANSI. Both the keyboard and trackpad in the Pinebook Pro use the USB 2.0 protocol and show up as such in xinput. The keyboard features function (Fn) keys in the F-key row, which include display brightness controls, sound volume, trackpad lock, and other functionality. There is also a custom PINE64 logo key that functions as Menu/Super key. It has also a secondary functionality for setting the privacy switches. <br />
<br />
The keyboard firmware is open sourced can be flashed from userspace using the provided utility. <br />
<br />
Documentation for the keyboard can be found in Datasheets for Components and Peripherals. <br />
<br />
=== German umlaute and the like ===<br />
On the UK Layout you can type umlaute by pressing [AltGr]+["] followed by [A], [O], [U], [a], [o] or [u]. The key combination [AltGr]+[s] generates the letter 'ß'.<br />
<br />
=== Privacy Switches ===<br />
There are three privacy switches mapped to the F10, F11 and F12 keys on the Pinebook Pro keyboard. They de/activate the following:<br />
<br />
{| class="wikitable"<br />
|+ Privacy switch function and description<br />
! Combination<br />
! Effect<br />
! Description<br />
|-<br />
! scope=row | PINE64 logo key+F10<br />
| Microphone Privacy switch || CAPs lock LED blinks. 2 blinks = enabled, 3 blinks = disabled<br />
|-<br />
! scope=row | PINE64 logo key+F11<br />
| WiFi Privacy switch || NUM lock LED blinks. 2 blinks = enabled, 3 blinks = disabled. '''Re-enabling requires reboot''' (or a [//forum.pine64.org/showthread.php?tid=8313&pid=52645#pid52645 command line hack to bind/unbind]).<br />
|-<br />
! scope=row | PINE64 logo key+F12<br />
| Camera privacy switch || CAPs lock and NUM lock LEDs blink together. 2 blinks = enabled, 3 blinks = disabled<br />
|}<br />
<br />
'''(Press the PINE64 logo key plus Fn (10/11/12) for 3 seconds)'''<br />
<br />
The keyboard uses special firmware that operates separately of the operating system. It detects if either the F10, F11 or F12 key, and the Pine key were pressed for 3 seconds. This disables the peripherals as listed above by cutting off their power. Which has the same result as cutting off the power to each peripheral with a physical switch. This implementation is very secure since the firmware that determines whether a peripheral gets power is not a part of the Pinebook Pro’s operating system. So the power state value for each peripheral cannot be overridden or accessed from the operating system. The power state setting for each peripheral is stored across reboots.<br />
<br />
== Trackpad ==<br />
<br />
The trackpad is large, smooth (metallic to-the-touch), and has two actuating buttons. It is the only component of the Pinebook Pro held in place with strong adhesive tape. It supports multi-touch functionality. <br />
<br />
The trackpad firmware is open sourced and can be flashed from userspace using the provided utility (https://github.com/ayufan-rock64/pinebook-pro-keyboard-updater[https://github.com/ayufan-rock64/pinebook-pro-keyboard-updater]). However, the firmware shipped with the provided utility (as of 11/07/2019) can result in a bricked trackpad and thus should not be used until a revised version of said firmware has been published to the linked repo.<br />
<br />
Documentation trackpad can be found in Datasheets for Components and Peripherals.<br />
<br />
== Power Supply ==<br />
* Input Power: 5V DC @ 3A<br />
* Mechanical: 3.5mm OD / 1.35mm ID, Barrel jack<br />
* USB-C 15W PD quickcharge<br />
* Only use one power input at a time, barrel jack OR USB-C<br />
<br />
== LEDs ==<br />
In total there are four LEDs on the Pinebook Pro, three of which are placed in the top left side of the keyboard, and one near the barrel-port: <br />
<br />
:1. The red LED next to the barrel-port indicates charging. It will illuminate when mains power is supplied to the Pinebook Pro from either the standard power supply unit or a USB-C smartphone charger.<br />
<br />
:2. The power indicator LED on the Pinebook Pro supports three different colours: green, amber and red. It is also capable of flashing/blinking to indicate activity. In the default Debian with MATE build, green LED means power and red means suspend (amber is unused). <br />
<br />
:3. The Num lock, green LED.<br />
<br />
:4. The Caps lock, green LED.<br />
<br />
(The Num and Caps lock LEDs have a secondary function. When the privacy switches get activated they blink to confirm that switch has been activated.)<br />
<br />
== Webcam ==<br />
* 1080p resolution<br />
* Some people test with the application Cheese<br />
WIP<br />
<br />
== Microphones ==<br />
WIP<br />
<br />
== Bluetooth and WiFi ==<br />
WIP<br />
<br />
== LCD Panel ==<br />
* 1080p resolution<br />
WIP<br />
<br />
== Using UART ==<br />
[[File:PBPUART.jpeg|400px|thumb|right|Headphone Jack UART wiring reference]]<br />
<br />
UART output is enabled by flipping the UART switch to on position (item 9). To do so you need to remove the Pinebook Pro's bottom cover - please follow [https://wiki.pine64.org/index.php/Pinebook_Pro_Main_Page#Accessing_the_Internals_-_Disassembly_and_Reassembly proper disassembly and reassembly protocol]. The OFF position is towards the touchpad, the ON position is towards the display hinges.<br />
<br />
With the UART switch in the 'on' position, console is relayed via the audiojack and the laptop's sound is turned off. PINE64 store sells [https://store.pine64.org/?product=pinebook-serial-console a dedicated serial console] but you can make your own if you have a serial console USB 2.0 adapter and old/ broken headphones.<br />
<br />
Insert the USB plug of the cable into an open USB port on the machine which will monitor. Run the following in a terminal:<br />
<br />
<code><br />
$ lsusb<br />
</code><br />
<br />
you should find a line similar to this:<br />
<br />
<code><br />
Bus 001 Device 058: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter<br />
</code><br />
<br />
You may have to clean the USB contacts of the Serial cable to get a good connection if you do not find that line.<br />
<br />
The audio jack of the Serial cable should be fully inserted into the Pinebook Pro audio port.<br />
<br />
Serial output should now be accessible using screen, picocom or minicom (and others).<br />
Examples:<br />
<br />
<code><br />
screen /dev/ttyUSB0 1500000<br />
<br />
picocom /dev/ttyUSB0 -b 1500000<br />
<br />
minicom -D /dev/ttyUSB0 -b 1500000</code><br />
<br />
== Using the optional NVMe adapter ==<br />
The optional NVMe adapter allows the use of M.2 cards that support the NVMe standard, (but not SATA standard).<br />
<br />
=== Installing the adapter ===<br />
<br />
The v2.1 SSD adapter that is shipped with the initial Pinebook Pro batches has a couple of problems although with a little hacking they can still be used. There is [https://forum.pine64.org/showthread.php?tid=8322&pid=52700#pid52700 an unofficial tutorial on the forums] describing the mods.<br />
<br />
=== Using as data drive ===<br />
As long as the kernel in use has both the PCIe and NVMe drivers, you should be able to use a NVMe drive as a data drive. Even automounting at boot, (from eMMC or SD card). This applies to both Linux and FreeBSD, though Android or Chromium OS may need testing. Simply use the normal partitioning and file system creation tools.<br />
<br />
=== Using as OS root drive ===<br />
stub at present<br />
<br />
== Using the PineBook Pro ==<br />
<br />
=== Bypass Cables ===<br />
The mainboard features two (disconnected by default) bypass cables that are only to be used with the battery disconnected. The female (10) male (6) ends of the bypass cables can be connected to provide power to the mainboard if you need to run the laptop without a battery. Please refer to this [http://files.pine64.org/doc/PinebookPro/PinebookPro_Engineering_Notice.pdf engineering notice]. <br />
<br />
WARNING: Do not connect the bypass cables with the battery connected. Using the bypass cables with the battery connected can permanently damage the computer.<br />
<br />
=== [[Pinebook_Service_Step_by_Step_Guides|Pinebook Service Step-by-Step Guides]] ===<br />
<span style="color:#FF0000">Placeholder for Pinebook Pro specific guides</span><br />
<br />
Under [[Pinebook_Service_Step_by_Step_Guides|'Service Guides for Pinebook']] you can find instructions guides concerning disassembly of:<br />
<br />
'''Note: The installation process on Pinebook Pro similar to 14" Pinebook'''<br />
<br />
'''Note: The installation process is the reverse order of removal guide'''<br />
<br />
* 14″ Pinebook Lithium Battery Pack Removal Guide<br />
* 14″ Pinebook LCD Panel Screen Removal Guide<br />
* 14″ Pinebook eMMC Module Removal Guide<br />
<br />
= Technical Reference =<br />
<br />
== Accessing the Internals - Disassembly and Reassembly == <br />
[[File:Standoffs.png|400px|thumb|right|Pinebook Screw stand-offs correct placement and location]]<br />
<br />
<br />
'''WARNING:''' Do not open the laptop by lifting the lid while the Pinebook Pro bottom cover is removed - this can cause structural damage to the hinges and/or other plastic components of the chassis such as the IO port cut-outs.<br />
<br />
'''WARNING:''' When removing the back cover plate, use care if sliding fingertips between back cover plate and palm rest assembly. The back cover plate edges are sharp.<br />
<br />
When disassembling the laptop make sure that it is powered off and folded closed. To remove the bottom cover of the Pinebook Pro, first remove the ten (10) Phillips head screws that hold the bottom section of the laptop in place. Remove the cover from the back where the hinges are situated by lifting it up and away from the rest of the chassis.<br />
<br />
During reassembly, make sure that the back-screw standoffs are in place and seated correctly. To reassemble the Pinebook Pro, slide the bottom section into place so it meets the front lip of the keyboard section. Secure the front section (where the trackpad is located) in place using the short screws in the front left and right corners. Then proceed to pop in the bottom panel into place. Secure the bottom section (where hinges are located) by screwing in the left and right corners. Then screw in the remaining screws and run your finger though the rim on the chassis to make sure its fitted correctly. Note that the front uses the remaining 2 short screws.<br />
<br />
NOTE: The screws are small and should only be finger tight. Too much force will strip the threads. If after installing screws the back cover plate has not seated properly on one side, open the display and hold the base on either side of the keyboard and gently flex the base with both hands in opposing directions. Once the side pops further in, then recheck the screws on that side. If it does not pop back in, just let it be.<br />
<br />
== Pinebook Pro Internal Layout ==<br />
<br />
=== Main chips ===<br />
* RK3399 system-on-chip (1)<br />
* LPDDR4 SDRAM (21)<br />
* SPI NOR flash memory (29)<br />
* eMMC flash memory (26)<br />
* WiFi/BT module (27)<br />
<br />
=== Mainboard Switches and Buttons ===<br />
There are two switches on the main board: disabling the eMMC (24), and enabling UART (9) via headphone jack. <br />
<br />
The Reset and Recovery buttons (28): the reset button performs an immediate reset of the laptop. The Recovery button is used to place the device in maskrom mode; this mode allows flashing eMMC using Rockchip tools (e.g. rkflashtools). <br />
<br />
<br />
[[File:PBPL_S.jpg]]<br />
<br />
<br />
=== Key Internal Parts ===<br />
{| class="wikitable"<br />
|+ Numbered parts classification and description<br />
! Number<br />
! Type<br />
! Descriptor<br />
|-<br />
! scope=row | 1<br />
| Component || RK3399 System-On-Chip<br />
|-<br />
! scope=row | 2<br />
| Socket || PCIe 4X socket for optional NVMe adapter<br />
|-<br />
! scope=row | 3<br />
| Socket || Speakers socket<br />
|-<br />
! scope=row | 4<br />
| Socket || Trackpad socket<br />
|-<br />
! scope=row | 5<br />
| Component || Left speaker <br />
|-<br />
! scope=row | 6<br />
| Connector || Male power bridge connector <br />
|-<br />
! scope=row | 7<br />
| Socket || Keyboard Socket<br />
|-<br />
! scope=row | 8<br />
| Component || Optional NVMe SSD adapter<br />
|-<br />
! scope=row | 9<br />
| Switch || UART/Audio switch - outputs UART via headphone jack<br />
|-<br />
! scope=row | 10<br />
| Socket || Female power bridge socket<br />
|-<br />
! scope=row | 11<br />
| Socket || Battery socket<br />
|-<br />
! scope=row | 12<br />
| Component || Trackpad<br />
|-<br />
! scope=row | 13<br />
| Component || Battery<br />
|-<br />
! scope=row | 14<br />
| Component || Right speaker<br />
|-<br />
! scope=row | 15<br />
| Socket || Micro SD socket<br />
|-<br />
! scope=row | 16<br />
| Socket || Headphone / UART jack<br />
|-<br />
! scope=row | 17<br />
| Socket || USB 2.0<br />
|-<br />
! scope=row | 18<br />
| Socket || Daughterboard-to-mainboard ribbon cable socket<br />
|-<br />
! scope=row | 19<br />
| Cable || Daughterboard-to-mainboard ribbon cable<br />
|-<br />
! scope=row | 20<br />
| Component || microphone<br />
|-<br />
! scope=row | 21<br />
| Component || LPDDR4 RAM<br />
|-<br />
! scope=row | 22<br />
| Socket || Mainboard-to-daughterboard ribbon cable socket<br />
|-<br />
! scope=row | 23<br />
| Socket || Microphone socket<br />
|-<br />
! scope=row | 24<br />
| Switch || Switch to hardware disable eMMC<br />
|-<br />
! scope=row | 25<br />
| Antenna || BT/WiFI antenna<br />
|-<br />
! scope=row | 26<br />
| Component || eMMC flash memory module <br />
|-<br />
! scope=row | 27<br />
| Component ||BT/WiFi module chip<br />
|-<br />
! scope=row | 28<br />
| Buttons || Reset and recovery buttons<br />
|-<br />
! scope=row | 29<br />
| Component || SPI flash storage<br />
|-<br />
! scope=row | 30<br />
| Socket || eDP LCD socket<br />
|-<br />
! scope=row | 31<br />
| Socket || Power in barrel socket<br />
|-<br />
! scope=row | 32<br />
| Socket || USB 3.0 <br />
|-<br />
! scope=row | 33<br />
| Socket || USB type C <br />
|}<br />
<br />
== Bootable Storage ==<br />
<br />
The Pinebook Pro is capable of booting from eMMC, USB 2.0, USB 3.0, or an SD card. It cannot boot from USB-C. The boot order of the hard-coded ROM of its RK3399 SoC is: SPI NOR, eMMC, SD, USB OTG. <br />
<br />
At this time, the Pinebook Pro ships with a Debian + MATE build with [https://www.denx.de/wiki/U-Boot/ uboot] on the eMMC. Its boot order is: SD, then eMMC. Booting off USB storage is not currently available, but will be in the future.<br />
<br />
(An update has been pushed for the default Debian + MATE build that improves compatibility with booting other OSs from an SD card. In order to update, fully charge the battery, establish an internet connection, click the update icon in the toolbar, and then reboot your Pinebook Pro. Please see [https://forum.pine64.org/showthread.php?tid=7830 this log] for details.)<br />
<br />
Please note that PCIe, the interface used for NVMe SSD on the Pinebook Pro, is not bootable on the RK3399 and therefore is not a part of the boot hierarchy. It is possible to run the desired OS from NVMe by pointing extlinux on the eMMC to rootfs on the SSD. This requires uboot, the Kernel image, DTB, and extlinux.conf<br />
in a /boot partition on the eMMC.<br />
<br />
=== eMMC information ===<br />
<br />
The eMMC storage will show up as multiple block devices:<br />
*mmcblk1boot0 - eMMC standard boot0 partition, may be 4MB<br />
*mmcblk1boot1 - eMMC standard boot1 partition, may be 4MB<br />
*mmcblk1rpmb - eMMC standard secure data partition. may be 16MB<br />
*mmcblk1 - This block contains the user areas<br />
<br />
Only the last is usable as regular storage device in the Pinebook Pro.<br />
The device number of "1" shown above may vary, depending on kernel.<br />
<br />
=== Boot sequence details ===<br />
<br />
The RK3399's mask 32KB ROM boot code looks for the next stage of code at byte off-set 32768. This is where u-Boot code would reside on any media that is bootable.<br />
<br />
== Pinebook Pro Dimensions ==<br />
* Dimensions: 329mm x 220mm x 12mm (WxDxH)<br />
* Weight: 1.26Kg<br />
<br />
== SoC and Memory Specification ==<br />
[[File:Rockchip_RK3399.png|right]]<br />
* Based on Rockchip RK3399<br />
<br />
=== CPU Architecture ===<br />
* big.LITTLE architecture: Dual Cortex-A72 + Quad Cortex-A53, 64-bit CPU<br />
** Full implementation of the ARM architecture v8-A instruction set (both AArch64 and AArch32)<br />
** ARM Neon Advanced SIMD (single instruction, multiple data) support for accelerated media and signal processing computation<br />
** ARMv8 Cryptography Extensions<br />
** VFPv4 floating point unit supporting single and double-precision operations<br />
** Hardware virtualization support<br />
** TrustZone technology support<br />
** Full CoreSight debug solution<br />
** One isolated voltage domain to support DVFS<br />
* Cortex-A72 (big cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a72 Dual-core Cortex-A72 up to 2.0GHz CPU]<br />
** Superscalar, variable-length, out-of-order pipeline<br />
** L1 cache 48KB Icache and 32KB Dcache for each A72 <br />
** L2 cache 1024KB for big cluster <br />
* Cortex-A53 (little cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a53 Quad-core Cortex-A53 up to 1.5GHz CPU]<br />
** In-order pipeline with symmetric dual-issue of most instructions <br />
** L1 cache 32KB Icache and 32KB Dcache for each A53<br />
** L2 cache 512KB for little cluster<br />
* Cortex-M0 (control processors):<br />
** Two Cortex-M0 cooperate with the central processors<br />
** Thumb instruction set<br />
** 32 bit only<br />
<br />
=== GPU Architecture ===<br />
* [https://developer.arm.com/products/graphics-and-multimedia/mali-gpus/mali-t860-and-mali-t880-gpus ARM Mali-T860MP4 Quad-core GPU]<br />
* The highest performance GPUs built on Arm Mali’s famous Midgard architecture, the Mali-T860 GPU is designed for complex graphics use cases and provide stunning visuals for UHD content.<br />
* Frequency 650MHz <br />
* Throughput 1300Mtri/s, 10.4Gpix/s <br />
* OpenGL® ES 1.1, 1.2, 2.0, 3.1, 3.2., Vulkan 1.0*., OpenCL™ 1.1, 1.2., DirectX® 11 FL11_1., RenderScript™.<br />
<br />
=== System Memory ===<br />
* RAM Memory:<br />
** LPDDR4<br />
** Dual memory channels on the CPU, each 32 bits wide<br />
** Quad memory channels on the RAM chip, each 16 bits wide, 2 bonded together for each CPU channel<br />
** 4GB as a single 366 pin mobile RAM chip<br />
* Storage Memory: <br />
** 64GB eMMC module, can be upgraded to a 128GB eMMC module. (The initial PINE64 community build version shipped with a 128GB eMMC.)<br />
<br />
=== Battery ===<br />
* Lithium Polymer Battery (10,000 mAH)<br />
<br />
=== Display ===<br />
* 14.1" 1920x1080 IPS LCD panel<br />
<br />
=== Video out ===<br />
* USB-C Alt mode DP up to 3840x2160 p60<br />
<br />
=== Audio ===<br />
* 3.5mm stereo earphone/microphone plug<br />
* Build in stereo speakers<br />
<br />
=== Network ===<br />
* WiFi:<br />
** 802.11 b/g/n/ac<br />
** Dual band: 2.4Ghz & 5Ghz<br />
** Single antenna<br />
* Bluetooth 5.0<br />
<br />
=== Expansion Ports ===<br />
* MicroSD card:<br />
** Bootable<br />
** Supports SD, SDHC and SDXC cards, up to 256GB<br />
** Version SD3.0, up to 50MB/s<br />
* USB ports:<br />
** 1 x USB 2.0 Type-A Host Port, bootable<br />
** 1 x USB 3.0 Type-A Host Port, 5Gbps, is not bootable<br />
** 1 x USB 3.0 Type-C OTG Port, 5Gbps, (includes laptop charging function), is not bootable<br />
* Headphone jack switchable to UART console mux circuit<br />
* Optional NVMe adapter:<br />
** PCIe 2.x, 5GT/s per lane<br />
** 4 PCIe lanes, can not be bifurcated, (however, can be used with 1 or 2 lane NVMe cards)<br />
** Maximum length for M.2 card is 80mm (M.2 2280)<br />
** Power: 2.5W continuous, 8.25W peak momentary<br />
** Does not support SATA M.2 cards<br />
** Does not support USB M.2 cards<br />
<br />
== Pinebook Pro Schematics and Certifications ==<br />
* Pinebook Pro Main Board Schematic And Silkscreen:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_mainboard_schematic.pdf Pinebook Pro Main Board ver 2.1 Schematic]<br />
** [https://wiki.pine64.org/images/3/30/Pinebookpro-v2.1-top-ref.pdf Pinebook Pro ver 2.1 Top Layer Silkscreen]<br />
** [https://wiki.pine64.org/images/b/b7/Pinebookpro-v2.1-bottom-ref.pdf Pinebook Pro ver 2.1 Bottom Layer Silkscreen]<br />
* Pinebook Daughter Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_daughterboard_schematic.pdf Pinebook Pro Daughter Board ver 2.1 Schematic]<br />
* Pinebook Pro NVMe Adapter Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_NVMe-adapter_schematic.pdf Pinebook Pro NVMe Adapter Board ver 2.1 Schematic]<br />
* Serial Console Earphone Jack Pinout:<br />
** [http://files.pine64.org/doc/pinebook/guide/Pinebook_Earphone_Serial_Console_Developer_Guide.pdf Pinkbook Serial Console Earphone Jack Pinout]<br />
<br />
* Pinebook Pro Certifications:<br />
** Not Yet Available<br />
<br />
== Datasheets for Components and Peripherals ==<br />
* Rockchip RK3399 SoC information:<br />
** [http://www.rock-chips.com/a/en/products/RK33_Series/2016/0419/758.html Rockchip RK3399 SoC Brief]<br />
** [http://opensource.rock-chips.com/images/2/28/Rockchip_RK3399_Datasheet_V1.8-20180529.pdf Rockchip RK3399 Datasheet V1.8]<br />
** [http://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf Rockchip RK3399 Technical Reference Manual part 1]<br />
** [http://files.pine64.org/doc/datasheet/rockpro64/RK808%20datasheet%20V0.8.pdf Rockchip RK808 Datasheet V0.8]<br />
* LPDDR4 (366 Balls) SDRAM:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/micron%20SM512M64Z01MD4BNK-053FT%20LPDDR4%20(366Ball).pdf Micron 366 balls Mobile LPDDR4 Datasheet]<br />
* eMMC information:<br />
** [http://files.pine64.org/doc/rock64/PINE64_eMMC_Module_20170719.pdf PINE64 eMMC module schematic]<br />
** [http://files.pine64.org/doc/rock64/usb%20emmc%20module%20adapter%20v2.pdf PINE64 USB adapter for eMMC module V2 schematic]<br />
** [http://files.pine64.org/doc/rock64/USB%20adapter%20for%20eMMC%20module%20PCB.tar PINE64 USB adapter for eMMC module PCB in JPEG]<br />
** [http://files.pine64.org/doc/datasheet/pine64/SDINADF4-16-128GB-H%20data%20sheet%20v1.13.pdf SanDisk eMMC Datasheet]<br />
* SPI NOR Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pine64/w25q128jv%20spi%20revc%2011162016.pdf WinBond 128Mb SPI Flash Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pine64/GD25Q128C-Rev2.5.pdf GigaDevice 128Mb SPI Flash Datasheet]<br />
* Wireless related info:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/AP6256%20datasheet_V1.7_12282018.pdf AMPAK AP6256 11AC Wi-Fi + Bluetooth5 Datasheet]<br />
* Audio Codec (ES8316)<br />
** [http://everest-semi.com/pdf/ES8316%20PB.pdf Everest ES8316 Audio Codec]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/NV140FHM-N49_Rev.P0_20160804_201710235838.pdf 14" 1920x1080 IPS LCD Panel datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/YX%20HK-9562%20HID%20I2C%20Specification.pdf Touchpad Specification for Pinebook Pro model]<br />
* Keyboard information:<br />
** Not Yet Available<br />
* Full HD Camera sensor:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/HK-2145-263.pdf Full HD Camera module specification in Chinese]<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/GC2145%20CSP%20DataSheet%20release%20V1.0_20131201.pdf GalaxyCore GC2145 Full HD Camera Sensor Data Sheet]<br />
* Lithium Battery information:<br />
** [http://files.pine64.org/doc/datasheet/pinebook/40110175P%203.8V%2010000mAh规格书-14.pdf 10000mAH Lithium Battery Specification for 14" model]<br />
<br />
= Troubleshooting guide =<br />
Tips, tricks and other information for troubleshooting your Pinebook Pro<br />
=== New from the factory - Pinebook Pro won't boot / power on ===<br />
* Some Pinebook Pros came from the factory with the eMMC switch in the disabled position. It should be switched towards the back / hinge to enable the eMMC.<br><br />
* The eMMC may have come loose during shipment. [https://wiki.pine64.org/index.php/Pinebook_Pro_Main_Page#Accessing_the_Internals_-_Disassembly_and_Reassembly Open] the back and verify that the eMMC is firmly seated.<br><br />
* You may want to try unplugging the SD card daughterboard ribbon cable and see if it powers on (remove the battery and peel off a bit of the tape before unplugging it to avoid damage). If it does, try reseating it on both sides. It might have come loose during shipping.<br />
* It's possible that your eMMC is empty from the factory. Simply create a bootable SD card and see if your Pinebook Pro boots. If so, you can then write an OS image to the eMMC.<br />
<br />
=== Pinebook Pro won't boot when using UART console cable ===<br />
* If you're using the UART cable sold on the Pine Store, you may want to see if it boots after you disconnect it. Some users report that custom-made cables based on FTDI UART adapters do not cause this issue.<br />
<br />
=== Pinebook Pro will not power on after toggling the eMMC enable/disable switch ===<br />
* This may happen if you meant to toggle the UART/Headphone switch (9) towards touchpad for headphone use and instead you toggled the eMMC enable/disable switch (24).<br />
* After reenabling eMMC by toggling switch (24) towards hinge, if Pinebook Pro does not turn on then press the RESET button (28). It is clearly marked 'reset' on the PCB board.<br />
<br />
=== Keys not registering / missing keys when typing ===<br />
This issue occurs when your thumb or edge of the palm makes contact with left or right tip of the trackpad when you type. This is due to the palm rejection firmware being too forceful. Instead of only disabling the trackpad, so your cursor does not move all over the screen, it disables both the trackpad and the keyboard.<br />
<br />
Using Fn+F7 to disable the touchpad will keep it from also disabling the keyboard.<br />
<br />
[https://forum.pine64.org/showthread.php?tid=8030 A firmware update is planned] to address this.<br />
<br />
= Other Resources =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=111 Pinebook Pro Forum]<br />
* [https://forum.pine64.org/forumdisplay.php?fid=98 ROCKPro64 Forum]<br />
* [[RockPro64 Guides]]<br />
* [http://www.pine64.xyz:9090/?channels=ROCK64 ROCK64/ROCKPro64 IRC Channel]<br />
* [https://github.com/rockchip-linux Rockchip Linux GitHub Repo]<br />
* [http://opensource.rock-chips.com/ Rockchip Open Source Wiki]</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro&diff=3743Pinebook Pro2019-10-01T15:10:51Z<p>Danielt: Flash size in MB is useful for folks without h/ware experience.</p>
<hr />
<div>== Software and OS Image Downloads ==<br />
=== [[PinebookPro_Software_Release|Pinebook Pro]] ===<br />
<br />
Under [[PinebookPro_Software_Release|'Pinebook Pro Software and OS Image Download Section']] you will find a complete list of currently supported Operating System images that work with the Pinebook as well as other related software. <br />
The list includes OS images and descriptions of:<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Debian_Desktop}} http://files.pine64.org/sw/pine64_installer/json/debian.png] [[PinebookPro_Software_Release#Debian Desktop|'''Debian Desktop (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_LXDE}} http://files.pine64.org/sw/pine64_installer/json/lxde.png] [[PinebookPro_Software_Release#Bionic LXDE|'''Bionic LXDE (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_Mate}} http://files.pine64.org/sw/pine64_installer/json/mate.png] [[PinebookPro_Software_Release#Bionic Mate|'''Bionic Mate (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Chromium}} http://files.pine64.org/sw/pine64_installer/json/chromium.jpg] [[PinebookPro_Software_Release#Chromium|'''Chromium (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Android_7.1_microSD}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_microSD|'''Android 7.1 (microSD Boot)''']] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [{{fullurl:PinebookPro_Software_Release#Android_7.1_eMMC}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_eMMC|'''Android 7.1 (eMMC)''']]<br />
<br />
<br />
----<br />
<br />
<br />
=== Quick Links to OS Images Build Sources===<br />
'''Some of the provided OS images are still in <span style="color:#FF0000">beta or nightly build</span> and only fit for testing purposes. These images ought to be avoided for normal usage - use them at <span style="color:#FF0000">your own risk</span>'''<br />
<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ ayufan's Linux build repo]<br />
* [https://github.com/ayufan-rock64/chromiumos-build/releases ayufan's Chromium OS build repo]<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ mrfixit2001's Linux debian desktop build repo]<br />
* [https://sourceforge.net/projects/q4os/files/stable/ Q4OS]<br />
<br />
== [[Pinebook_Service_Step_by_Step_Guides|Pinebook Service Step-by-Step Guides]] ==<br />
Under [[Pinebook_Service_Step_by_Step_Guides|'Service Guides for Pinebook']] you can instructions guides concerning disassembly of:<br />
<br />
'''Note: The installation process on Pinebook Pro similar to 14" Pinebook'''<br />
<br />
'''Note: The installation process is the reverse order of removal guide'''<br />
<br />
* 14″ Pinebook Lithium Battery Pack Removal Guide<br />
* 14″ Pinebook LCD Panel Screen Removal Guide<br />
* 14″ Pinebook eMMC Module Removal Guide<br />
<br />
== Pinebook Pro Information ==<br />
* Dimensions: 329mm x 220mm x 12mm (WxDxH)<br />
* Weight: 1.26Kg <br />
* Input Power: DC 5V @ 3A 3.5mm OD/ 1.35mm ID Barrel jack or USB-C 15W PD quickcharge<br />
<br />
<br />
<br />
== SoC and Memory Specification ==<br />
* Based on Rockchip RK3399<br />
[[File:Rockchip_RK3399.png]]<br />
<br />
=== CPU Architecture ===<br />
* big.LITTLE architecture: Dual Cortex-A72 + Quad Cortex-A53, 64-bit CPU<br />
** Full implementation of the ARM architecture v8-A instruction set (both AArch64 and AArch32)<br />
** ARM Neon Advanced SIMD (single instruction, multiple data) support for accelerated media and signal processing computation<br />
** ARMv8 Cryptography Extensions<br />
** VFPv4 floating point unit supporting single and double-precision operations<br />
** Hardware virtualization support<br />
** TrustZone technology support<br />
** Full CoreSight debug solution<br />
** One isolated voltage domain to support DVFS<br />
* Cortex-A72 (big cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a72 Dual-core Cortex-A72 up to 2.0GHz CPU]<br />
** Superscalar, variable-length, out-of-order pipeline<br />
** L1 cache 48KB Icache and 32KB Dcache for each A72 <br />
** L2 cache 1024KB for big cluster <br />
* Cortex-A53 (little cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a53 Quad-core Cortex-A53 up to 1.5GHz CPU]<br />
** In-order pipeline with symmetric dual-issue of most instructions <br />
** L1 cache 32KB Icache and 32KB Dcache for each A53<br />
** L2 cache 512KB for little cluster<br />
<br />
=== GPU Architecture ===<br />
* [https://developer.arm.com/products/graphics-and-multimedia/mali-gpus/mali-t860-and-mali-t880-gpus ARM Mali-T860MP4 Quad-core GPU]<br />
* The highest performance GPUs built on Arm Mali’s famous Midgard architecture, the Mali-T860 GPU is designed for complex graphics use cases and provide stunning visuals for UHD content.<br />
* Frequency 650MHz <br />
* Throughput 1300Mtri/s, 10.4Gpix/s <br />
* OpenGL® ES 1.1, 1.2, 2.0, 3.1, 3.2., Vulkan 1.0*., OpenCL™ 1.1, 1.2., DirectX® 11 FL11_1., RenderScript™.<br />
<br />
=== System Memory ===<br />
* LPDDR4 RAM Memory Variants: Dual Channels 4GB.<br />
* Storage Memory: <br />
** 64GB eMMC module, can be upgrade to 128GB eMMC module. The initial PINE64 community build version comes with 128GB eMMC configuration<br />
** 128Mb (16MB) built-in SPI Flash memory<br />
<br />
=== Battery ===<br />
* Lithium Polymer Battery (10,000mAH)<br />
<br />
=== Display ===<br />
* 14.1" 1920x1080 IPS LCD panel<br />
<br />
=== Video ===<br />
* USB-C Alt model DP up to 3840x2160p60<br />
<br />
=== Audio ===<br />
* 3.5mm stereo earphone/microphone plug<br />
* Build in stereo speaker<br />
<br />
=== Network ===<br />
* WiFi 802.11 b/g/n/ac with Bluetooth 5.0<br />
<br />
=== Expansion Ports ===<br />
* microSD - bootable, support SDHC and SDXC, storage up to 256GB<br />
* USB - 1x USB2.0 Type-A Host Port, 1x USB3.0 Type-A Host Port, 1x USB3.0 Type-C OTG Port<br />
* optional NVMe adapter<br />
* earphone plug with UART console mux circuit<br />
<br />
<br />
<br />
== Pinebook Pro Schematics and Certifications ==<br />
* Pinebook Pro Main Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_mainboard_schematic.pdf Pinebook Pro Main Board ver 2.1 Schematic]<br />
* Pinebook Daughter Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_daughterboard_schematic.pdf Pinebook Pro Daughter Board ver 2.1 Schematic]<br />
* Pinebook Pro NVMe Adapter Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_NVMe-adapter_schematic.pdf Pinebook Pro NVMe Adapter Board ver 2.1 Schematic]<br />
* Serial Console Earphone Jack Pinout:<br />
** [http://files.pine64.org/doc/pinebook/guide/Pinebook_Earphone_Serial_Console_Developer_Guide.pdf Pinkbook Serial Console Earphone Jack Pinout]<br />
<br />
* Pinebook Pro Certifications:<br />
** Not Yet Available<br />
<br />
<br />
== Datasheets for Components and Peripherals ==<br />
* Rockchip RK3399 SoC information:<br />
** [http://www.rock-chips.com/a/en/products/RK33_Series/2016/0419/758.html Rockchip RK3399 SoC Brief]<br />
** [http://opensource.rock-chips.com/images/2/28/Rockchip_RK3399_Datasheet_V1.8-20180529.pdf Rockchip RK3399 Datasheet V1.8]<br />
** [http://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf Rockchip RK3399 Technical Reference Manual part 1]<br />
** [http://files.pine64.org/doc/datasheet/rockpro64/RK808%20datasheet%20V0.8.pdf Rockchip RK808 Datasheet V0.8]<br />
* LPDDR4 (366 Balls) SDRAM:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/micron%20SM512M64Z01MD4BNK-053FT%20LPDDR4%20(366Ball).pdf Micron 366 balls Mobile LPDDR4 Datasheet]<br />
* eMMC information:<br />
** [http://files.pine64.org/doc/rock64/PINE64_eMMC_Module_20170719.pdf PINE64 eMMC module schematic]<br />
** [http://files.pine64.org/doc/rock64/usb%20emmc%20module%20adapter%20v2.pdf PINE64 USB adapter for eMMC module V2 schematic]<br />
** [http://files.pine64.org/doc/rock64/USB%20adapter%20for%20eMMC%20module%20PCB.tar PINE64 USB adapter for eMMC module PCB in JPEG]<br />
** [http://files.pine64.org/doc/datasheet/pine64/SDINADF4-16-128GB-H%20data%20sheet%20v1.13.pdf SanDisk eMMC Datasheet]<br />
* SPI NOR Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pine64/w25q128jv%20spi%20revc%2011162016.pdf WinBond 128Mb SPI Flash Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pine64/GD25Q128C-Rev2.5.pdf GigaDevice 128Mb SPI Flash Datasheet]<br />
* Wireless related info:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/AP6256%20datasheet_V1.7_12282018.pdf AMPAK AP6256 11AC Wi-Fi + Bluetooth5 Datasheet]<br />
* Audio Codec (ES8316)<br />
** [http://everest-semi.com/pdf/ES8316%20PB.pdf Everest ES8316 Audio Codec]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/NV140FHM-N49_Rev.P0_20160804_201710235838.pdf 14" 1920x1080 IPS LCD Panel datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/YX%20HK-9562%20HID%20I2C%20Specification.pdf Touchpad Specification for Pinebook Pro model]<br />
* Full HD Camera sensor:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/HK-2145-263.pdf Full HD Camera module specification in Chinese]<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/GC2145%20CSP%20DataSheet%20release%20V1.0_20131201.pdf GalaxyCore GC2145 Full HD Camera Sensor Data Sheet]<br />
* Lithium Battery information:<br />
** [http://files.pine64.org/doc/datasheet/pinebook/40110175P%203.8V%2010000mAh规格书-14.pdf 10000mAH Lithium Battery Specification for 14" model]<br />
<br />
= Other Resources =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=98 ROCKPro64 Forum]<br />
* [[RockPro64 Guides]]<br />
* [http://www.pine64.xyz:9090/?channels=ROCK64 ROCK64/ROCKPro64 IRC Channel]<br />
* [https://github.com/rockchip-linux Rockchip Linux GitHub Repo]<br />
* [http://opensource.rock-chips.com/ Rockchip Open Source Wiki]</div>Danielthttps://wiki.pine64.org/index.php?title=Pinebook_Pro&diff=3742Pinebook Pro2019-10-01T15:06:32Z<p>Danielt: Make clear which attributes apply to both clusters and which are unique for each.</p>
<hr />
<div>== Software and OS Image Downloads ==<br />
=== [[PinebookPro_Software_Release|Pinebook Pro]] ===<br />
<br />
Under [[PinebookPro_Software_Release|'Pinebook Pro Software and OS Image Download Section']] you will find a complete list of currently supported Operating System images that work with the Pinebook as well as other related software. <br />
The list includes OS images and descriptions of:<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Debian_Desktop}} http://files.pine64.org/sw/pine64_installer/json/debian.png] [[PinebookPro_Software_Release#Debian Desktop|'''Debian Desktop (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_LXDE}} http://files.pine64.org/sw/pine64_installer/json/lxde.png] [[PinebookPro_Software_Release#Bionic LXDE|'''Bionic LXDE (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Bionic_Mate}} http://files.pine64.org/sw/pine64_installer/json/mate.png] [[PinebookPro_Software_Release#Bionic Mate|'''Bionic Mate (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Chromium}} http://files.pine64.org/sw/pine64_installer/json/chromium.jpg] [[PinebookPro_Software_Release#Chromium|'''Chromium (microSD and eMMC Boot)''']]<br />
<br />
<br />
* [{{fullurl:PinebookPro_Software_Release#Android_7.1_microSD}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_microSD|'''Android 7.1 (microSD Boot)''']] &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; [{{fullurl:PinebookPro_Software_Release#Android_7.1_eMMC}} http://files.pine64.org/sw/pine64_installer/json/android_7.png] [[PinebookPro_Software_Release#Android_7.1_eMMC|'''Android 7.1 (eMMC)''']]<br />
<br />
<br />
----<br />
<br />
<br />
=== Quick Links to OS Images Build Sources===<br />
'''Some of the provided OS images are still in <span style="color:#FF0000">beta or nightly build</span> and only fit for testing purposes. These images ought to be avoided for normal usage - use them at <span style="color:#FF0000">your own risk</span>'''<br />
<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ ayufan's Linux build repo]<br />
* [https://github.com/ayufan-rock64/chromiumos-build/releases ayufan's Chromium OS build repo]<br />
* [https://github.com/ayufan-rock64/linux-build/releases/ mrfixit2001's Linux debian desktop build repo]<br />
* [https://sourceforge.net/projects/q4os/files/stable/ Q4OS]<br />
<br />
== [[Pinebook_Service_Step_by_Step_Guides|Pinebook Service Step-by-Step Guides]] ==<br />
Under [[Pinebook_Service_Step_by_Step_Guides|'Service Guides for Pinebook']] you can instructions guides concerning disassembly of:<br />
<br />
'''Note: The installation process on Pinebook Pro similar to 14" Pinebook'''<br />
<br />
'''Note: The installation process is the reverse order of removal guide'''<br />
<br />
* 14″ Pinebook Lithium Battery Pack Removal Guide<br />
* 14″ Pinebook LCD Panel Screen Removal Guide<br />
* 14″ Pinebook eMMC Module Removal Guide<br />
<br />
== Pinebook Pro Information ==<br />
* Dimensions: 329mm x 220mm x 12mm (WxDxH)<br />
* Weight: 1.26Kg <br />
* Input Power: DC 5V @ 3A 3.5mm OD/ 1.35mm ID Barrel jack or USB-C 15W PD quickcharge<br />
<br />
<br />
<br />
== SoC and Memory Specification ==<br />
* Based on Rockchip RK3399<br />
[[File:Rockchip_RK3399.png]]<br />
<br />
=== CPU Architecture ===<br />
* big.LITTLE architecture: Dual Cortex-A72 + Quad Cortex-A53, 64-bit CPU<br />
** Full implementation of the ARM architecture v8-A instruction set (both AArch64 and AArch32)<br />
** ARM Neon Advanced SIMD (single instruction, multiple data) support for accelerated media and signal processing computation<br />
** ARMv8 Cryptography Extensions<br />
** VFPv4 floating point unit supporting single and double-precision operations<br />
** Hardware virtualization support<br />
** TrustZone technology support<br />
** Full CoreSight debug solution<br />
** One isolated voltage domain to support DVFS<br />
* Cortex-A72 (big cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a72 Dual-core Cortex-A72 up to 2.0GHz CPU]<br />
** Superscalar, variable-length, out-of-order pipeline<br />
** L1 cache 48KB Icache and 32KB Dcache for each A72 <br />
** L2 cache 1024KB for big cluster <br />
* Cortex-A53 (little cluster):<br />
** [https://developer.arm.com/products/processors/cortex-a/cortex-a53 Quad-core Cortex-A53 up to 1.5GHz CPU]<br />
** In-order pipeline with symmetric dual-issue of most instructions <br />
** L1 cache 32KB Icache and 32KB Dcache for each A53<br />
** L2 cache 512KB for little cluster<br />
<br />
=== GPU Architecture ===<br />
* [https://developer.arm.com/products/graphics-and-multimedia/mali-gpus/mali-t860-and-mali-t880-gpus ARM Mali-T860MP4 Quad-core GPU]<br />
* The highest performance GPUs built on Arm Mali’s famous Midgard architecture, the Mali-T860 GPU is designed for complex graphics use cases and provide stunning visuals for UHD content.<br />
* Frequency 650MHz <br />
* Throughput 1300Mtri/s, 10.4Gpix/s <br />
* OpenGL® ES 1.1, 1.2, 2.0, 3.1, 3.2., Vulkan 1.0*., OpenCL™ 1.1, 1.2., DirectX® 11 FL11_1., RenderScript™.<br />
<br />
=== System Memory ===<br />
* LPDDR4 RAM Memory Variants: Dual Channels 4GB.<br />
* Storage Memory: <br />
** 64GB eMMC module, can be upgrade to 128GB eMMC module. The initial PINE64 community build version comes with 128GB eMMC configuration<br />
**128Mb built-in SPI Flash memory <br />
<br />
=== Battery ===<br />
* Lithium Polymer Battery (10,000mAH)<br />
<br />
=== Display ===<br />
* 14.1" 1920x1080 IPS LCD panel<br />
<br />
=== Video ===<br />
* USB-C Alt model DP up to 3840x2160p60<br />
<br />
=== Audio ===<br />
* 3.5mm stereo earphone/microphone plug<br />
* Build in stereo speaker<br />
<br />
=== Network ===<br />
* WiFi 802.11 b/g/n/ac with Bluetooth 5.0<br />
<br />
=== Expansion Ports ===<br />
* microSD - bootable, support SDHC and SDXC, storage up to 256GB<br />
* USB - 1x USB2.0 Type-A Host Port, 1x USB3.0 Type-A Host Port, 1x USB3.0 Type-C OTG Port<br />
* optional NVMe adapter<br />
* earphone plug with UART console mux circuit<br />
<br />
<br />
<br />
== Pinebook Pro Schematics and Certifications ==<br />
* Pinebook Pro Main Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_mainboard_schematic.pdf Pinebook Pro Main Board ver 2.1 Schematic]<br />
* Pinebook Daughter Board Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_daughterboard_schematic.pdf Pinebook Pro Daughter Board ver 2.1 Schematic]<br />
* Pinebook Pro NVMe Adapter Schematic:<br />
** [http://files.pine64.org/doc/PinebookPro/pinebookpro_v2.1_NVMe-adapter_schematic.pdf Pinebook Pro NVMe Adapter Board ver 2.1 Schematic]<br />
* Serial Console Earphone Jack Pinout:<br />
** [http://files.pine64.org/doc/pinebook/guide/Pinebook_Earphone_Serial_Console_Developer_Guide.pdf Pinkbook Serial Console Earphone Jack Pinout]<br />
<br />
* Pinebook Pro Certifications:<br />
** Not Yet Available<br />
<br />
<br />
== Datasheets for Components and Peripherals ==<br />
* Rockchip RK3399 SoC information:<br />
** [http://www.rock-chips.com/a/en/products/RK33_Series/2016/0419/758.html Rockchip RK3399 SoC Brief]<br />
** [http://opensource.rock-chips.com/images/2/28/Rockchip_RK3399_Datasheet_V1.8-20180529.pdf Rockchip RK3399 Datasheet V1.8]<br />
** [http://opensource.rock-chips.com/images/e/ee/Rockchip_RK3399TRM_V1.4_Part1-20170408.pdf Rockchip RK3399 Technical Reference Manual part 1]<br />
** [http://files.pine64.org/doc/datasheet/rockpro64/RK808%20datasheet%20V0.8.pdf Rockchip RK808 Datasheet V0.8]<br />
* LPDDR4 (366 Balls) SDRAM:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/micron%20SM512M64Z01MD4BNK-053FT%20LPDDR4%20(366Ball).pdf Micron 366 balls Mobile LPDDR4 Datasheet]<br />
* eMMC information:<br />
** [http://files.pine64.org/doc/rock64/PINE64_eMMC_Module_20170719.pdf PINE64 eMMC module schematic]<br />
** [http://files.pine64.org/doc/rock64/usb%20emmc%20module%20adapter%20v2.pdf PINE64 USB adapter for eMMC module V2 schematic]<br />
** [http://files.pine64.org/doc/rock64/USB%20adapter%20for%20eMMC%20module%20PCB.tar PINE64 USB adapter for eMMC module PCB in JPEG]<br />
** [http://files.pine64.org/doc/datasheet/pine64/SDINADF4-16-128GB-H%20data%20sheet%20v1.13.pdf SanDisk eMMC Datasheet]<br />
* SPI NOR Flash information:<br />
** [http://files.pine64.org/doc/datasheet/pine64/w25q128jv%20spi%20revc%2011162016.pdf WinBond 128Mb SPI Flash Datasheet]<br />
** [http://files.pine64.org/doc/datasheet/pine64/GD25Q128C-Rev2.5.pdf GigaDevice 128Mb SPI Flash Datasheet]<br />
* Wireless related info:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/AP6256%20datasheet_V1.7_12282018.pdf AMPAK AP6256 11AC Wi-Fi + Bluetooth5 Datasheet]<br />
* Audio Codec (ES8316)<br />
** [http://everest-semi.com/pdf/ES8316%20PB.pdf Everest ES8316 Audio Codec]<br />
* LCD Panel:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/NV140FHM-N49_Rev.P0_20160804_201710235838.pdf 14" 1920x1080 IPS LCD Panel datasheet]<br />
* Touchpad information:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/YX%20HK-9562%20HID%20I2C%20Specification.pdf Touchpad Specification for Pinebook Pro model]<br />
* Full HD Camera sensor:<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/HK-2145-263.pdf Full HD Camera module specification in Chinese]<br />
** [http://files.pine64.org/doc/datasheet/PinebookPro/GC2145%20CSP%20DataSheet%20release%20V1.0_20131201.pdf GalaxyCore GC2145 Full HD Camera Sensor Data Sheet]<br />
* Lithium Battery information:<br />
** [http://files.pine64.org/doc/datasheet/pinebook/40110175P%203.8V%2010000mAh规格书-14.pdf 10000mAH Lithium Battery Specification for 14" model]<br />
<br />
= Other Resources =<br />
* [https://forum.pine64.org/forumdisplay.php?fid=98 ROCKPro64 Forum]<br />
* [[RockPro64 Guides]]<br />
* [http://www.pine64.xyz:9090/?channels=ROCK64 ROCK64/ROCKPro64 IRC Channel]<br />
* [https://github.com/rockchip-linux Rockchip Linux GitHub Repo]<br />
* [http://opensource.rock-chips.com/ Rockchip Open Source Wiki]</div>Danielt