<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ayke</id>
	<title>PINE64 - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.pine64.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Ayke"/>
	<link rel="alternate" type="text/html" href="https://wiki.pine64.org/wiki/Special:Contributions/Ayke"/>
	<updated>2026-04-17T17:25:15Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=20084</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=20084"/>
		<updated>2023-07-14T13:07:55Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ accelerometer measurements at various configurations&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.elara.ws/Elara6331/itd ITD] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The controller goes 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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus, has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 60µA, as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Put the heart rate sensor in sleep mode by setting the PDRIVER (0x0C) register to 0, see [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf#page=12 the HRS3300 datasheet for details].&lt;br /&gt;
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|UART left enabled&lt;br /&gt;
|1.25mA&lt;br /&gt;
|Some bootloaders might leave the UART enabled after they start the application, leading to high current consumption.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|Accelerometer&lt;br /&gt;
|0.15mA&lt;br /&gt;
|151µA in performance mode, 99µA with performance mode disabled but power saving disabled, 50µA while polling on a high interval (100Hz, average 4 samples), 14µA when running at the lowest possible setting that still counts steps (50Hz, no averaging).&lt;br /&gt;
|-&lt;br /&gt;
|HRS sensor is enabled&lt;br /&gt;
|0.1mA&lt;br /&gt;
|The HRS3300 sensor is enabled on power on. Write byte 0x00 to the PDRIVER register (0x0C) to set it in sleep mode.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI flash sleep mode&lt;br /&gt;
|0.014mA&lt;br /&gt;
|Sleep mode still consumes power. Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19543</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19543"/>
		<updated>2023-04-23T13:03:20Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ UART&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.elara.ws/Elara6331/itd ITD] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 60µA, as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Put the heart rate sensor in sleep mode by setting the PDRIVER (0x0C) register to 0, see [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf#page=12 the HRS3300 datasheet for details].&lt;br /&gt;
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|UART left enabled&lt;br /&gt;
|1.25mA&lt;br /&gt;
|Some bootloaders might leave the UART enabled after they start the application, leading to high current consumption.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|HRS sensor is enabled&lt;br /&gt;
|0.1mA&lt;br /&gt;
|The HRS3300 sensor is enabled on power on. Write byte 0x00 to the PDRIVER register (0x0C) to set it in sleep mode.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI flash sleep mode&lt;br /&gt;
|0.014mA&lt;br /&gt;
|Sleep mode still consumes power. Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19509</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19509"/>
		<updated>2023-04-20T22:32:10Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ HRS sensor is not sleeping on power on&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 60µA, as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Put the heart rate sensor in sleep mode by setting the PDRIVER (0x0C) register to 0, see [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf#page=12 the HRS3300 datasheet for details].&lt;br /&gt;
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|HRS sensor is enabled&lt;br /&gt;
|0.1mA&lt;br /&gt;
|The HRS3300 sensor is enabled on power on. Write byte 0x00 to the PDRIVER register (0x0C) to set it in sleep mode.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI flash sleep mode&lt;br /&gt;
|0.014mA&lt;br /&gt;
|Sleep mode still consumes power. Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19485</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19485"/>
		<updated>2023-04-19T15:24:14Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ rewording of SPI flash deep power down mode&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.17mA (163µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS high, then low, then writing the byte 0xb9 on the SPI bus, and then setting flash CS high again.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI flash sleep mode&lt;br /&gt;
|0.014mA&lt;br /&gt;
|Sleep mode still consumes power. Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19484</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19484"/>
		<updated>2023-04-19T12:29:05Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ SPI flash deep power down&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.17mA (163µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Put the SPI flash in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power-down mode] by setting flash CS low, writing the byte 0xb9 on the SPI bus, and setting flash CS high again. It seems necessary to set the flash CS high before setting it to low.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI flash sleep mode&lt;br /&gt;
|0.014mA&lt;br /&gt;
|Put it in [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf#page=38 deep power down mode] to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19482</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19482"/>
		<updated>2023-04-18T18:22:14Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ ADC&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.18mA (174µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power), roughly ordered from large to small:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|ADC left enabled&lt;br /&gt;
|1.3mA&lt;br /&gt;
|Stopping SAADC brings the current back to the baseline. It seems that it doesn't need to be disabled entirely.&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19480</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19480"/>
		<updated>2023-04-17T20:12:56Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ Extra notes on baseline power consumption&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.18mA (174µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
* Enable the DC/DC regulator. This doesn't affect the current consumption while sleeping, but almost halves the runtime current consumption.&lt;br /&gt;
* Use the low-frequency (32.768kHz) oscillator.&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19479</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19479"/>
		<updated>2023-04-17T16:31:22Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Reducing power consumption */ SPI, I2C&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.18mA (174µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this.&lt;br /&gt;
|-&lt;br /&gt;
|SPI, I2C&lt;br /&gt;
|(negligible)&lt;br /&gt;
|SPI and I2C appear to consume very little power when idle, around 1µA or less.&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19478</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19478"/>
		<updated>2023-04-17T15:55:50Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Hardware */ Some power consumption stats, plus hints how to avoid them&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
=== Reducing power consumption ===&lt;br /&gt;
&lt;br /&gt;
The PineTime appears to be able to sleep with a current consumption of [https://github.com/InfiniTimeOrg/InfiniTime/issues/53#issuecomment-783654321 only 66µA].&lt;br /&gt;
&lt;br /&gt;
To investigate current consumption, it's a good idea to disable everything possible to get the lowest current consumption possible, and then re-enable things one by one. Here is one way to get a baseline current consumption of 0.18mA (174µA according to my multimeter), as measured from the 3.3V pin with the battery disconnected:&lt;br /&gt;
&lt;br /&gt;
* Leave all pins in their default state, except for P0.05 (SPI CS) and P0.25 (LCD CS) which should be configured as an output and set to high.&lt;br /&gt;
* Sleep in a loop, using WFE or WFI (if you're using the Nordic SoftDevice, call &amp;lt;code&amp;gt;sd_app_evt_wait&amp;lt;/code&amp;gt; instead).&lt;br /&gt;
&lt;br /&gt;
Here are some current consumption statistics (current consumed in addition to the baseline power):&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
!Source&lt;br /&gt;
!Current&lt;br /&gt;
!Notes&lt;br /&gt;
|-&lt;br /&gt;
|SWD&lt;br /&gt;
|3.05mA&lt;br /&gt;
|Power cycle the chip after programming to avoid this, it can hide other inefficiencies.&lt;br /&gt;
|-&lt;br /&gt;
|LCD&lt;br /&gt;
|5.61mA&lt;br /&gt;
|Set the LCD to sleep mode when not used, using SLPIN.&lt;br /&gt;
|-&lt;br /&gt;
|Backlight high &lt;br /&gt;
|12.27mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight mid&lt;br /&gt;
|5.51mA&lt;br /&gt;
|-&lt;br /&gt;
|Backlight low&lt;br /&gt;
|1.83mA&lt;br /&gt;
|-&lt;br /&gt;
|Edge triggered pin interrupts&lt;br /&gt;
|0-0.47mA?&lt;br /&gt;
|It appears that under some configurations, edge triggered interrupts result in a large power drain. One way to avoid this is by using the pin sense mechanism.&lt;br /&gt;
|-&lt;br /&gt;
|BUTTON_OUT left high&lt;br /&gt;
|0.04mA&lt;br /&gt;
|See [[#Button|Button]] for how to avoid this&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19477</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=19477"/>
		<updated>2023-04-17T15:12:43Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Button */ reduce current consumption&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;[[File:Pinetime.png|400px|thumb|right|The PineTime]]&lt;br /&gt;
&lt;br /&gt;
The '''PineTime''' is a free and open source smartwatch capable of running custom-built open operating systems. Some of the notable features include a heart rate monitor, a week-long battery, and a capacitive touch IPS display that is legible in direct sunlight. It is a fully community driven side-project which anyone can contribute to, allowing you to keep control of your device.&lt;br /&gt;
&lt;br /&gt;
== Getting started ==&lt;br /&gt;
&lt;br /&gt;
'''Read these first!'''&lt;br /&gt;
&lt;br /&gt;
* [[Upgrade PineTime to InfiniTime 1.0.0|Upgrading your new PineTime to InfiniTime 1.0.0]]&lt;br /&gt;
* [[PineTime Devkit Wiring]]&lt;br /&gt;
* [[Reprogramming the PineTime|Reprogramming the PineTime (development kit)]]&lt;br /&gt;
* [[Switching your PineTime between InfiniTime and Wasp-os]]&lt;br /&gt;
&lt;br /&gt;
The frequently asked question can be found in the article [[PineTime FAQ]].&lt;br /&gt;
&lt;br /&gt;
== Default OS ==&lt;br /&gt;
&lt;br /&gt;
The current default operating system on the PineTime is called [[InfiniTime]], you can find more information about the firmware on its GitHub page. First devkits shipped with a proprietary custom firmware.&lt;br /&gt;
&lt;br /&gt;
You can find a list of available firmware and other software here: [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
== Companion Apps ==&lt;br /&gt;
&lt;br /&gt;
PineTime/InfiniTime needs a companion app to e.g. upload a firmware, get notifications from a phone, or just get the date/time.   &lt;br /&gt;
Here are some companion apps:&lt;br /&gt;
&lt;br /&gt;
* [https://www.gadgetbridge.org Gadgetbridge] (Android &amp;gt;= 4.4) - Companion mobile app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://openrepos.net/content/piggz/amazfish Amazfish] (SailfishOS and Linux) - Companion mobile and desktop app, supports updating firmware/bootloader, send notifications, etc.&lt;br /&gt;
* [https://github.com/alexr4535/siglo Siglo] (Linux) - Companion desktop app.&lt;br /&gt;
* [https://github.com/ZephyrLabs/PinetimeFlasher PinetimeFlasher] (Windows) - Companion desktop app, only supports flashing firmware.&lt;br /&gt;
* [https://apps.apple.com/us/app/nrf-connect-for-mobile/id1054362403 nRFConnect] (iOS) - Only supports flashing firmware.  The app is closed source and versions after 4.24.3 don't work for the PineTime anymore&lt;br /&gt;
* [https://github.com/xan-m/InfiniLink InfiniLink] (iOS) - Companion mobile app in development. Supports updating firmware/bootloader, setting date and time, Apple Music controls, and battery and heart rate data.&lt;br /&gt;
* [https://gitea.arsenm.dev/Arsen6331/itd itd] (Linux)&lt;br /&gt;
&lt;br /&gt;
== Specifications ==&lt;br /&gt;
* '''Dimensions:''' 37.5 x 40 x 11mm&lt;br /&gt;
* '''Weight:''' 38 grams&lt;br /&gt;
* '''IP Rating:''' IP67 (waterproof to 1 meter (sealed edition!))&lt;br /&gt;
* '''Display:'''&lt;br /&gt;
** '''Size:''' 1.3 inches (33mm) diagonal&lt;br /&gt;
** '''Type:''' IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** '''Display Controller:''' ST7789&lt;br /&gt;
** '''Resolution:''' 240x240 pixels&lt;br /&gt;
* '''System on Chip:''' Nordic Semiconductor nRF52832&lt;br /&gt;
* '''Flash:''' 512KB with additional 4MB SPI NOR&lt;br /&gt;
* '''RAM:''' 64KB&lt;br /&gt;
* '''Bluetooth:''' [[PineTime_Bluetooth|5.0 (including Bluetooth Low Energy)]]&lt;br /&gt;
* '''Sensors:''' Accelerometer, Heart rate sensor&lt;br /&gt;
* '''Feedback:''' Vibration motor&lt;br /&gt;
* '''Battery:''' 170-180mAh 3.8V LiPo&lt;br /&gt;
&lt;br /&gt;
== Community ==&lt;br /&gt;
&lt;br /&gt;
=== Forum ===&lt;br /&gt;
* [https://forum.pine64.org/forumdisplay.php?fid=134 PineTime forum]&lt;br /&gt;
&lt;br /&gt;
=== Chat ===&lt;br /&gt;
* [https://matrix.to/#/#pinetime:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* IRC Server: [ircs://irc.pine64.org#pinetime irc.pine64.org] Channel: PineTime&lt;br /&gt;
* [https://t.me/pinetime Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
Developers and coding:&lt;br /&gt;
* [https://matrix.to/#/#pinetime-dev:matrix.org Matrix Channel] (No login required to read)&lt;br /&gt;
* [https://t.me/pinetime_dev Telegram group]&lt;br /&gt;
* [https://discordapp.com/invite/DgB7kzr Discord server invite link]&lt;br /&gt;
&lt;br /&gt;
=== Development efforts ===&lt;br /&gt;
&lt;br /&gt;
To read more about development on the PineTime, the projects available and more technical details, check out [[PineTime Development]]&lt;br /&gt;
&lt;br /&gt;
=== Useful articles and blog posts === &lt;br /&gt;
&lt;br /&gt;
If you want to dive in to the ecosystem, here's a short list of various articles and blog posts that can help you set up your soft- or hardware development environment.&lt;br /&gt;
&lt;br /&gt;
* [https://www.ncartron.org/one-week-with-my-pinetime---a-feedback.html Using the PineTime in production (January 2021)]&lt;br /&gt;
* [https://lupyuen.github.io/articles/sneak-peek-of-pinetime-smart-watch-and-why-its-perfect-for-teaching-iot Sneak Peek of PineTime Smart Watch… And why it’s perfect for teaching IoT]&lt;br /&gt;
* [https://lupyuen.github.io/articles/building-a-rust-driver-for-pinetimes-touch-controller Building a Rust Driver for PineTime’s Touch Controller]&lt;br /&gt;
* [https://lupyuen.github.io/articles/porting-druid-rust-widgets-to-pinetime-smart-watch Porting (druid) Rust Widgets to PineTime Smart Watch]&lt;br /&gt;
* [https://lupyuen.github.io/articles/optimising-pinetimes-display-driver-with-rust-and-mynewt Optimising PineTime’s Display Driver with Rust and Mynewt]&lt;br /&gt;
* [https://electronut.in/getting-started-with-zephyr-rtos-on-nordic-nrf52832-hackable/ Getting Started with Zephyr RTOS on Nordic nRF52832 hackaBLE]&lt;br /&gt;
* [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]&lt;br /&gt;
* [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]&lt;br /&gt;
* [https://www.nrbtech.io/blog/2020/1/4/using-clion-for-nordic-nrf52-projects Using CLion for Nordic nRF52 projects]&lt;br /&gt;
* [https://dev.to/aaronc81/flashing-your-pinetime-using-an-st-link-and-openocd-54dd Flashing your PineTime using an ST-Link and OpenOCD]&lt;br /&gt;
* [https://zephyrlabs.github.io/Watchfaces/ Zephyrlabs: just a bunch of watchfaces made for the pinetime]&lt;br /&gt;
* [https://pankajraghav.com/2021/04/03/PINETIME-STOPCLOCK.html Creating a stopwatch in Pinetime (with Infinitime)]&lt;br /&gt;
* [[PineTime Custom Watchface Tutorial]]&lt;br /&gt;
* [[PineTimeStyle]]&lt;br /&gt;
&lt;br /&gt;
== Hardware ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Command/Data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_BACKLIGHT_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
'''References''':&lt;br /&gt;
&lt;br /&gt;
[https://github.com/adafruit/Adafruit-ST7735-Library/ Adafruit ST7789 driver in cpp]&lt;br /&gt;
&lt;br /&gt;
=== Battery measurement ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
=== Button ===&lt;br /&gt;
&lt;br /&gt;
The button on the side of the PineTime is disabled by default. To enable it, drive the button out pin (P0.15) high.&lt;br /&gt;
&lt;br /&gt;
While enabled, the button in pin (P0.13) will be high when the button is pressed, and low when it is not pressed.&lt;br /&gt;
&lt;br /&gt;
Note that the button consumes around 34µA when P0.15 is left high. To reduce current consumption, set it to low most of the time and only set it to high shortly before reading it. The button needs a short time to give good outputs though, setting P0.15 high at least four times in a row seems to result in enough delay that P0.13 has a stable output.&lt;br /&gt;
&lt;br /&gt;
=== Touch panel ===&lt;br /&gt;
&lt;br /&gt;
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,...).&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.10 : Reset&lt;br /&gt;
* P0.28 : Interrupt (signal to the CPU when a touch event is detected)&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
&lt;br /&gt;
==== I²C ====&lt;br /&gt;
&lt;br /&gt;
* Device address : 0x15&lt;br /&gt;
* Frequency : from 10Khz to 400Khz&lt;br /&gt;
&lt;br /&gt;
'''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.&lt;br /&gt;
&lt;br /&gt;
'''NOTE: ''' The I²C bus, also known as TWI bus has known issues, make sure to write your TWI driver with timeouts.&lt;br /&gt;
&lt;br /&gt;
==== Touch events ====&lt;br /&gt;
&lt;br /&gt;
Touch information is available from 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. &lt;br /&gt;
&lt;br /&gt;
These 63 bytes contain up to 10 touch point (X, Y, event type, pressure,...) : &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! Byte&lt;br /&gt;
! Bit7&lt;br /&gt;
! Bit6&lt;br /&gt;
! Bit5&lt;br /&gt;
! Bit4&lt;br /&gt;
! Bit3&lt;br /&gt;
! Bit2&lt;br /&gt;
! Bit1&lt;br /&gt;
! Bit0&lt;br /&gt;
|-&lt;br /&gt;
|0&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|?&lt;br /&gt;
|-&lt;br /&gt;
|1&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|GestureID : (Gesture code ,&lt;br /&gt;
&lt;br /&gt;
0x00: no gesture,&lt;br /&gt;
&lt;br /&gt;
0x01: Slide down,&lt;br /&gt;
&lt;br /&gt;
0x02: Slide up,&lt;br /&gt;
&lt;br /&gt;
0x03: Slide left,&lt;br /&gt;
&lt;br /&gt;
0x04: Slide right,&lt;br /&gt;
&lt;br /&gt;
0x05: Single click,&lt;br /&gt;
&lt;br /&gt;
0x0B: Double click,&lt;br /&gt;
&lt;br /&gt;
0x0C: Long press) &lt;br /&gt;
|-&lt;br /&gt;
|2&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|? &lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Number of touch points &lt;br /&gt;
|-&lt;br /&gt;
|3&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Event (0 = Down, 1 = Up, 2 = Contact)&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|X (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|4&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|X (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|5&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|?&lt;br /&gt;
|colspan=&amp;quot;2&amp;quot;|Touch ID&lt;br /&gt;
|colspan=&amp;quot;4&amp;quot;|Y (MSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|6&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Y (LSB) coordinate&lt;br /&gt;
|-&lt;br /&gt;
|7&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Pressure (?)&lt;br /&gt;
|-&lt;br /&gt;
|8&lt;br /&gt;
|colspan=&amp;quot;8&amp;quot;|Miscellaneous (?)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Bytes 3 to 8 are repeated 10 times (10*6 + 3 = 63 bytes).&lt;br /&gt;
&lt;br /&gt;
'''NOTES'''&lt;br /&gt;
&lt;br /&gt;
* The touch controller seems to report only 1 touch point&lt;br /&gt;
* Fields X, Y, Number of touch points and touch ID are updated. The others are always 0.&lt;br /&gt;
&lt;br /&gt;
==== Registers ====&lt;br /&gt;
&lt;br /&gt;
The reference driver specifies some registers and value, but there is no information about them: &lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!Register&lt;br /&gt;
!Address&lt;br /&gt;
!Description&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_INT_CNT&lt;br /&gt;
|0x8F&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FLOW_WORK_CNT&lt;br /&gt;
|0x91&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_WORKMODE &lt;br /&gt;
|0x00&lt;br /&gt;
|0 = WORK, 0x40 = FACTORY&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID&lt;br /&gt;
|0xA3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHIP_ID2&lt;br /&gt;
|0x9F&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_POWER_MODE&lt;br /&gt;
|0xA5&lt;br /&gt;
|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)&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FW_VER&lt;br /&gt;
|0xA6&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_VENDOR_ID&lt;br /&gt;
|0xA8&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_LCD_BUSY_NUM&lt;br /&gt;
|0xAB&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_FACE_DEC_MODE_EN&lt;br /&gt;
|0xB0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GLOVE_MODE_EN&lt;br /&gt;
|0xC0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_COVER_MODE_EN&lt;br /&gt;
|0xC1&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_CHARGER_MODE_EN&lt;br /&gt;
|0x8B&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_EN&lt;br /&gt;
|0xD0&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_GESTURE_OUTPUT_ADDRESS&lt;br /&gt;
|0xD3&lt;br /&gt;
|&lt;br /&gt;
|-&lt;br /&gt;
|HYN_REG_ESD_SATURATE 0xED&lt;br /&gt;
|0xED&lt;br /&gt;
|&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
'''WARNING : ''' &amp;lt;del&amp;gt;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!&amp;lt;/del&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Accelerometer ===&lt;br /&gt;
The on board accelerometer in devices shipped before July 2021 is a Bosch BMA421, connected to the I2C bus.&lt;br /&gt;
Devices shipped after July 2021 use a Bosch BMA425 accelerometer.&lt;br /&gt;
&lt;br /&gt;
==== Pins ====&lt;br /&gt;
&lt;br /&gt;
* P0.06 : I²C SDA&lt;br /&gt;
* P0.07 : I²C SCL&lt;br /&gt;
* P0.08 : Interrupt&lt;br /&gt;
&lt;br /&gt;
I2C Device address : 0x18&lt;br /&gt;
&lt;br /&gt;
== Accessory == &lt;br /&gt;
&lt;br /&gt;
The following accessory is compatible with the PineTime.&lt;br /&gt;
&lt;br /&gt;
=== Watch band ===&lt;br /&gt;
&lt;br /&gt;
The PineTime uses a standard 20mm watch band / strap. There is a [https://forum.pine64.org/showthread.php?tid=9392&amp;amp;pid=81902 thread] in the forum discussing this.&lt;br /&gt;
&lt;br /&gt;
Due to the watches design. Retention for the spring bars are recessed into the watch. Not all 20mm bands / straps work. This is especially the case for Nato style bands / straps being too thick.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Known working bands:&lt;br /&gt;
&lt;br /&gt;
* [https://www.bisonstrap.com/products/bisonstrap-waterproof-sport-silicone-watch-bands-black?variant=40103305543773 BISONSTRAP 20mm Quick Release Silicone Watch Band] / [https://www.amazon.com/dp/B08XTNKQSJ Amazon US]&lt;br /&gt;
* DMVEIMAL 20mm Quick Release Watch Band Metal Strap / [https://www.amazon.com/gp/product/B0BGJC8CXG Amazon US]&lt;br /&gt;
* Morsey 20mm Quick Release Watch Band / [https://www.amazon.com/dp/B08DD57SHV Amazon US]&lt;br /&gt;
&lt;br /&gt;
=== Cases ===&lt;br /&gt;
There are no cases for PineTime yet, but some cases for Fitbit are suitable for it. Cases for Fitbit have one microphone hole, which is unnecessary for the PineTime, but otherwise they fit perfectly.&lt;br /&gt;
&lt;br /&gt;
* [https://www.aliexpress.com/item/1005003150606521.html Soft TPU case for Fitbit Versa 2/Versa Lite from AliExpress]&lt;br /&gt;
&lt;br /&gt;
The community designed the following cases:&lt;br /&gt;
* [https://www.thingiverse.com/thing:4172849 PineTime Smart Watch case by dara0s at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4651462 PineTime dev kit back fix by joaquimorg at thingiverse]&lt;br /&gt;
* [https://www.thingiverse.com/thing:4763267 PineTime dev kit charging holder v4 by zevix81 at thingiverse]&lt;br /&gt;
* [https://www.prusaprinters.org/prints/88913-pinetime-charger-case PineTime Charger Travel Case by brett at PrusaPrinters]&lt;br /&gt;
&lt;br /&gt;
== Datasheets, Schematics and Certifications ==&lt;br /&gt;
&lt;br /&gt;
=== Schematics ===&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Schematic-V1.0a-20191103.pdf PineTime Schematic ver1.0a]&lt;br /&gt;
* [https://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
=== Chip Datasheets ===&lt;br /&gt;
&lt;br /&gt;
NORDIC nRF52832 information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf nRF52832 Product Brief]&lt;br /&gt;
* [https://infocenter.nordicsemi.com/pdf/nRF52832_PS_v1.4.pdf nRF52832 Product Specification v1.4]&lt;br /&gt;
&lt;br /&gt;
ARMv7-M information:&lt;br /&gt;
* [https://developer.arm.com/documentation/ddi0403/ee/?lang=en ARMv7-M Architecture Reference Manual]&lt;br /&gt;
&lt;br /&gt;
=== Component Datasheets ===&lt;br /&gt;
&lt;br /&gt;
PMU (Power Management Unit) information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
&lt;br /&gt;
SPI Flash information:&lt;br /&gt;
* [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])&lt;br /&gt;
* [https://datasheet.lcsc.com/szlcsc/2005251035_XTX-XT25F32BSOIGU-S_C558851.pdf XTX XT25F32B]&lt;br /&gt;
* IDs for XT25F32B are: manufacturer (0x0b), device (0x15), memory type (0x40), density (0x16)&lt;br /&gt;
&lt;br /&gt;
LCD Panel:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
* [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
&lt;br /&gt;
Touchpad information:&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
* [https://wiki.pine64.org/images/2/2f/CST816S.zip Touch Controller Datasheet en]&lt;br /&gt;
&lt;br /&gt;
Sensor:&lt;br /&gt;
* [https://datasheet.lcsc.com/lcsc/1912111437_Bosch-Sensortec-BMA425_C437656.pdf BOSCH BMA425 Triaxial Acceleration Sensor Datasheet on current PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial Acceleration Sensor Product Brief on early PineTime device]&lt;br /&gt;
* [https://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Heart Rate Sensor Data Sheet]&lt;br /&gt;
&lt;br /&gt;
=== Certificates ===&lt;br /&gt;
* [https://files.pine64.org/doc/cert/FCC_Grant_PineTime_2AWAG-PINETIME_DTS.pdf PineTime FCC Certificate]&lt;br /&gt;
* [https://files.pine64.org/doc/cert/CTL2203033031-W%20RED%20Certificate.pdf PineTime CE Certificate]&lt;br /&gt;
&lt;br /&gt;
=== Manuals ===&lt;br /&gt;
* [[:File:PineTime Quick Start Guide.pdf|PineTime Quick Start Guide]]&lt;br /&gt;
&lt;br /&gt;
[[Category:PineTime]]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3912</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3912"/>
		<updated>2019-10-30T13:03:52Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Battery */ The reference voltage isn't always 3.3V&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PINE64 SmartWatch &amp;quot;PineTime&amp;quot;  =&lt;br /&gt;
The PINE64 SmartWatch, dubbed &amp;quot;PineTime&amp;quot;, is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers &amp;amp; communities. &lt;br /&gt;
&lt;br /&gt;
PineTime development has been broken down into two distinct phases: &lt;br /&gt;
* Phase One - PineTime Dev Kit Project on October 2019&lt;br /&gt;
* Phase Two - Introducing the PineTime smartwatch around Q1 2020, depending on development results in Phase 1.&lt;br /&gt;
&lt;br /&gt;
== PineTime Concept Photo ==&lt;br /&gt;
[[File:PineTime_leaflet.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime Case and Charging Cradle Photos ==&lt;br /&gt;
[[File:PineTime_on_wrist_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_PPG_Sensor_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_Charging_Cradle_Photo.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit internal Photos ==&lt;br /&gt;
[[File:PineTime_Devkit-1.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-2.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_Devkit-4.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-5.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-6.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Watch Information ==&lt;br /&gt;
* LAUNCH:&lt;br /&gt;
** Announced: Tweet on 13 September 2019&lt;br /&gt;
** Devkit Release: October, 2019&lt;br /&gt;
** Expected Release: Q1/Q2 2020, pending on development result&lt;br /&gt;
** Availability: at least 5 years &lt;br /&gt;
&lt;br /&gt;
* BODY:&lt;br /&gt;
** Dimensions: 37.5mm x 40mm x 11mm&lt;br /&gt;
** Weight: 38 grams&lt;br /&gt;
** Build: Zinc Alloy and Plastic&lt;br /&gt;
** Environmental Rating: IP67 (waterproof to 1 meter of immersion; '''not applicable to devkits''')&lt;br /&gt;
&lt;br /&gt;
* DISPLAY:&lt;br /&gt;
** Type: IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** Size: 1.3 inches&lt;br /&gt;
** Resolution: 240x240 pixels, 1:1 ratio&lt;br /&gt;
&lt;br /&gt;
* PLATFORM:&lt;br /&gt;
** OS: Various open source RTOS such as Zephyr, FreeRTOS, Mbed, Mynewt, or NuttX&lt;br /&gt;
** SoC: NORDIC Semiconductor nRF52832 (final product may use nRF52840)&lt;br /&gt;
** CPU: 64MHz ARM Cortex-M4F &lt;br /&gt;
&lt;br /&gt;
* MEMORY:&lt;br /&gt;
** Internal: 512KB Flash, 64KB RAM (nRF52840: 1 MB flash, 256KB RAM)&lt;br /&gt;
** Additional: SPI NOR 8 MB Flash&lt;br /&gt;
&lt;br /&gt;
* COMMUNICATION:&lt;br /&gt;
** Bluetooth 5 (including Low Energy)&lt;br /&gt;
&lt;br /&gt;
* FEATURES:&lt;br /&gt;
** Sensors: Accelerometer, PPG Heart Rate Sensor&lt;br /&gt;
** Actuator: Vibrator&lt;br /&gt;
&lt;br /&gt;
* BATTERY:&lt;br /&gt;
** Built-in LiPo 170-180mAh battery&lt;br /&gt;
** Charging: Proprietary 2pin 5V 500mA, USB type A plug&lt;br /&gt;
&lt;br /&gt;
* PRICE:&lt;br /&gt;
** USD $22.99 (PineTime pebble and charging cradle, based on phone on PineTime devkit hardware configuration)&lt;br /&gt;
** USD $2 and up (20mm straight generic wrist band: silicone, NATO, Milanese steel, leather, and etc)&lt;br /&gt;
&lt;br /&gt;
== PineTime Schematic and Certifications ==&lt;br /&gt;
* PineTime Main Board Schematic:&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PinTime%20Schematic-V1.0-20191020.pdf PineTime Schematic ver1.0]&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
* PineTime Certifications:&lt;br /&gt;
** not yet available&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit SWD Probe ==&lt;br /&gt;
* PineTime SWD probe pinout definition:&lt;br /&gt;
[[File:PineTime_SWD_location.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== PineTime SWD Probe Usage Method ===&lt;br /&gt;
Slightly bend or zig-zag the probe pins to the left and right to strengthen contact to the SWD pins on the dev kit.&lt;br /&gt;
&lt;br /&gt;
'''Note''': The color coding on the SWD probe wires is random and meaningless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_SWD_Plugin.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Driving the peripherals ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Clock/data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
=== Battery ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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):&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
== Datasheets for Components ==&lt;br /&gt;
* NORDIC SoC information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52840%20product%20brief.pdf NORDIC nRF52840 Product Brief]&lt;br /&gt;
* PMU (Power Management Unit) information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
* SPI Flash information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]&lt;br /&gt;
* LCD Panel:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
* Touchpad information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
*** [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]&lt;br /&gt;
* Sensor:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Hear Rate Sensor Data Sheet]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3911</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3911"/>
		<updated>2019-10-29T19:47:00Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Driving the peripherals */ Battery&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PINE64 SmartWatch &amp;quot;PineTime&amp;quot;  =&lt;br /&gt;
The PINE64 SmartWatch, dubbed &amp;quot;PineTime&amp;quot;, is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers &amp;amp; communities. &lt;br /&gt;
&lt;br /&gt;
PineTime development has been broken down into two distinct phases: &lt;br /&gt;
* Phase One - PineTime Dev Kit Project on October 2019&lt;br /&gt;
* Phase Two - Introducing the PineTime smartwatch around Q1 2020, depending on development results in Phase 1.&lt;br /&gt;
&lt;br /&gt;
== PineTime Concept Photo ==&lt;br /&gt;
[[File:PineTime_leaflet.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime Case and Charging Cradle Photos ==&lt;br /&gt;
[[File:PineTime_on_wrist_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_PPG_Sensor_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_Charging_Cradle_Photo.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit internal Photos ==&lt;br /&gt;
[[File:PineTime_Devkit-1.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-2.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_Devkit-4.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-5.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-6.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Watch Information ==&lt;br /&gt;
* LAUNCH:&lt;br /&gt;
** Announced: Tweet on 13 September 2019&lt;br /&gt;
** Devkit Release: October, 2019&lt;br /&gt;
** Expected Release: Q1/Q2 2020, pending on development result&lt;br /&gt;
** Availability: at least 5 years &lt;br /&gt;
&lt;br /&gt;
* BODY:&lt;br /&gt;
** Dimensions: 37.5mm x 40mm x 11mm&lt;br /&gt;
** Weight: 38 grams&lt;br /&gt;
** Build: Zinc Alloy and Plastic&lt;br /&gt;
** Environmental Rating: IP67 (waterproof to 1 meter of immersion; '''not applicable to devkits''')&lt;br /&gt;
&lt;br /&gt;
* DISPLAY:&lt;br /&gt;
** Type: IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** Size: 1.3 inches&lt;br /&gt;
** Resolution: 240x240 pixels, 1:1 ratio&lt;br /&gt;
&lt;br /&gt;
* PLATFORM:&lt;br /&gt;
** OS: Various open source RTOS such as Zephyr, FreeRTOS, Mbed, Mynewt, or NuttX&lt;br /&gt;
** SoC: NORDIC Semiconductor nRF52832 (final product may use nRF52840)&lt;br /&gt;
** CPU: 64MHz ARM Cortex-M4F &lt;br /&gt;
&lt;br /&gt;
* MEMORY:&lt;br /&gt;
** Internal: 512KB Flash, 64KB RAM (nRF52840: 1 MB flash, 256KB RAM)&lt;br /&gt;
** Additional: SPI NOR 8 MB Flash&lt;br /&gt;
&lt;br /&gt;
* COMMUNICATION:&lt;br /&gt;
** Bluetooth 5 (including Low Energy)&lt;br /&gt;
&lt;br /&gt;
* FEATURES:&lt;br /&gt;
** Sensors: Accelerometer, PPG Heart Rate Sensor&lt;br /&gt;
** Actuator: Vibrator&lt;br /&gt;
&lt;br /&gt;
* BATTERY:&lt;br /&gt;
** Built-in LiPo 170-180mAh battery&lt;br /&gt;
** Charging: Proprietary 2pin 5V 500mA, USB type A plug&lt;br /&gt;
&lt;br /&gt;
* PRICE:&lt;br /&gt;
** USD $22.99 (PineTime pebble and charging cradle, based on phone on PineTime devkit hardware configuration)&lt;br /&gt;
** USD $2 and up (20mm straight generic wrist band: silicone, NATO, Milanese steel, leather, and etc)&lt;br /&gt;
&lt;br /&gt;
== PineTime Schematic and Certifications ==&lt;br /&gt;
* PineTime Main Board Schematic:&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PinTime%20Schematic-V1.0-20191020.pdf PineTime Schematic ver1.0]&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
* PineTime Certifications:&lt;br /&gt;
** not yet available&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit SWD Probe ==&lt;br /&gt;
* PineTime SWD probe pinout definition:&lt;br /&gt;
[[File:PineTime_SWD_location.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== PineTime SWD Probe Usage Method ===&lt;br /&gt;
Slightly bend or zig-zag the probe pins to the left and right to strengthen contact to the SWD pins on the dev kit.&lt;br /&gt;
&lt;br /&gt;
'''Note''': The color coding on the SWD probe wires is random and meaningless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_SWD_Plugin.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Driving the peripherals ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Clock/data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
=== Battery ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
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. The reference voltage of the ADC is 3.3V so you can get the measured voltage with this formula:&lt;br /&gt;
&lt;br /&gt;
 adcVoltage = adcValue / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2 / (4095 / 3.3)&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / (4095 / 3.3)&lt;br /&gt;
 batteryVoltage = adcValue * 2000 / 1241&lt;br /&gt;
&lt;br /&gt;
Converting this voltage to an estimated capacity in percent requires a more complicated algorithm, because Lithium-ion batteries have a non-linear discharge curve.&lt;br /&gt;
&lt;br /&gt;
== Datasheets for Components ==&lt;br /&gt;
* NORDIC SoC information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52840%20product%20brief.pdf NORDIC nRF52840 Product Brief]&lt;br /&gt;
* PMU (Power Management Unit) information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
* SPI Flash information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]&lt;br /&gt;
* LCD Panel:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
* Touchpad information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
*** [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]&lt;br /&gt;
* Sensor:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Hear Rate Sensor Data Sheet]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3907</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3907"/>
		<updated>2019-10-28T22:22:01Z</updated>

		<summary type="html">&lt;p&gt;Ayke: /* Display */ SPI speed&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PINE64 SmartWatch &amp;quot;PineTime&amp;quot;  =&lt;br /&gt;
The PINE64 SmartWatch, dubbed &amp;quot;PineTime&amp;quot;, is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers &amp;amp; communities. &lt;br /&gt;
&lt;br /&gt;
PineTime development has been broken down into two distinct phases: &lt;br /&gt;
* Phase One - PineTime Dev Kit Project on October 2019&lt;br /&gt;
* Phase Two - Introducing the PineTime smartwatch around Q1 2020, depending on development results in Phase 1.&lt;br /&gt;
&lt;br /&gt;
== PineTime Concept Photo ==&lt;br /&gt;
[[File:PineTime_leaflet.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime Case and Charging Cradle Photos ==&lt;br /&gt;
[[File:PineTime_on_wrist_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_PPG_Sensor_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_Charging_Cradle_Photo.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit internal Photos ==&lt;br /&gt;
[[File:PineTime_Devkit-1.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-2.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_Devkit-4.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-5.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-6.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Watch Information ==&lt;br /&gt;
* LAUNCH:&lt;br /&gt;
** Announced: Tweet on 13 September 2019&lt;br /&gt;
** Devkit Release: October, 2019&lt;br /&gt;
** Expected Release: Q1/Q2 2020, pending on development result&lt;br /&gt;
** Availability: at least 5 years &lt;br /&gt;
&lt;br /&gt;
* BODY:&lt;br /&gt;
** Dimensions: 37.5mm x 40mm x 11mm&lt;br /&gt;
** Weight: 38 grams&lt;br /&gt;
** Build: Zinc Alloy and Plastic&lt;br /&gt;
** Environmental Rating: IP67 (waterproof to 1 meter of immersion; '''not applicable to devkits''')&lt;br /&gt;
&lt;br /&gt;
* DISPLAY:&lt;br /&gt;
** Type: IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** Size: 1.3 inches&lt;br /&gt;
** Resolution: 240x240 pixels, 1:1 ratio&lt;br /&gt;
&lt;br /&gt;
* PLATFORM:&lt;br /&gt;
** OS: Various open source RTOS such as Zephyr, FreeRTOS, Mbed, Mynewt, or NuttX&lt;br /&gt;
** SoC: NORDIC Semiconductor nRF52832 (final product may use nRF52840)&lt;br /&gt;
** CPU: 64MHz ARM Cortex-M4F &lt;br /&gt;
&lt;br /&gt;
* MEMORY:&lt;br /&gt;
** Internal: 512KB Flash, 64KB RAM (nRF52840: 1 MB flash, 256KB RAM)&lt;br /&gt;
** Additional: SPI NOR 8 MB Flash&lt;br /&gt;
&lt;br /&gt;
* COMMUNICATION:&lt;br /&gt;
** Bluetooth 5 (including Low Energy)&lt;br /&gt;
&lt;br /&gt;
* FEATURES:&lt;br /&gt;
** Sensors: Accelerometer, PPG Heart Rate Sensor&lt;br /&gt;
** Actuator: Vibrator&lt;br /&gt;
&lt;br /&gt;
* BATTERY:&lt;br /&gt;
** Built-in LiPo 170-180mAh battery&lt;br /&gt;
** Charging: Proprietary 2pin 5V 500mA, USB type A plug&lt;br /&gt;
&lt;br /&gt;
* PRICE:&lt;br /&gt;
** USD $22.99 (PineTime pebble and charging cradle, based on phone on PineTime devkit hardware configuration)&lt;br /&gt;
** USD $2 and up (20mm straight generic wrist band: silicone, NATO, Milanese steel, leather, and etc)&lt;br /&gt;
&lt;br /&gt;
== PineTime Schematic and Certifications ==&lt;br /&gt;
* PineTime Main Board Schematic:&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PinTime%20Schematic-V1.0-20191020.pdf PineTime Schematic ver1.0]&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
* PineTime Certifications:&lt;br /&gt;
** not yet available&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit SWD Probe ==&lt;br /&gt;
* PineTime SWD probe pinout definition:&lt;br /&gt;
[[File:PineTime_SWD_location.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== PineTime SWD Probe Usage Method ===&lt;br /&gt;
Slightly bend or zig-zag the probe pins to the left and right to strengthen contact to the SWD pins on the dev kit.&lt;br /&gt;
&lt;br /&gt;
'''Note''': The color coding on the SWD probe wires is random and meaningless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_SWD_Plugin.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Driving the peripherals ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Clock/data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
* Use SPI at 8MHz (the fastest clock available on the nRF52832) because otherwise refreshing will be super slow.&lt;br /&gt;
&lt;br /&gt;
== Datasheets for Components ==&lt;br /&gt;
* NORDIC SoC information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52840%20product%20brief.pdf NORDIC nRF52840 Product Brief]&lt;br /&gt;
* PMU (Power Management Unit) information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
* SPI Flash information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]&lt;br /&gt;
* LCD Panel:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
* Touchpad information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
*** [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]&lt;br /&gt;
* Sensor:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Hear Rate Sensor Data Sheet]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
	<entry>
		<id>https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3905</id>
		<title>PineTime</title>
		<link rel="alternate" type="text/html" href="https://wiki.pine64.org/index.php?title=PineTime&amp;diff=3905"/>
		<updated>2019-10-28T22:16:26Z</updated>

		<summary type="html">&lt;p&gt;Ayke: Information on how to drive the display&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= PINE64 SmartWatch &amp;quot;PineTime&amp;quot;  =&lt;br /&gt;
The PINE64 SmartWatch, dubbed &amp;quot;PineTime&amp;quot;, is a product of a community effort for an open source smartwatch in collaboration with wearable RTOS and Linux app developers &amp;amp; communities. &lt;br /&gt;
&lt;br /&gt;
PineTime development has been broken down into two distinct phases: &lt;br /&gt;
* Phase One - PineTime Dev Kit Project on October 2019&lt;br /&gt;
* Phase Two - Introducing the PineTime smartwatch around Q1 2020, depending on development results in Phase 1.&lt;br /&gt;
&lt;br /&gt;
== PineTime Concept Photo ==&lt;br /&gt;
[[File:PineTime_leaflet.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime Case and Charging Cradle Photos ==&lt;br /&gt;
[[File:PineTime_on_wrist_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_PPG_Sensor_Photo.jpg]]&lt;br /&gt;
[[File:PineTime_Charging_Cradle_Photo.jpg]]&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit internal Photos ==&lt;br /&gt;
[[File:PineTime_Devkit-1.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-2.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-3.jpg]]&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_Devkit-4.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-5.jpg]]&lt;br /&gt;
[[File:PineTime_Devkit-6.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Watch Information ==&lt;br /&gt;
* LAUNCH:&lt;br /&gt;
** Announced: Tweet on 13 September 2019&lt;br /&gt;
** Devkit Release: October, 2019&lt;br /&gt;
** Expected Release: Q1/Q2 2020, pending on development result&lt;br /&gt;
** Availability: at least 5 years &lt;br /&gt;
&lt;br /&gt;
* BODY:&lt;br /&gt;
** Dimensions: 37.5mm x 40mm x 11mm&lt;br /&gt;
** Weight: 38 grams&lt;br /&gt;
** Build: Zinc Alloy and Plastic&lt;br /&gt;
** Environmental Rating: IP67 (waterproof to 1 meter of immersion; '''not applicable to devkits''')&lt;br /&gt;
&lt;br /&gt;
* DISPLAY:&lt;br /&gt;
** Type: IPS capacitive touchscreen, RGB 65K colors&lt;br /&gt;
** Size: 1.3 inches&lt;br /&gt;
** Resolution: 240x240 pixels, 1:1 ratio&lt;br /&gt;
&lt;br /&gt;
* PLATFORM:&lt;br /&gt;
** OS: Various open source RTOS such as Zephyr, FreeRTOS, Mbed, Mynewt, or NuttX&lt;br /&gt;
** SoC: NORDIC Semiconductor nRF52832 (final product may use nRF52840)&lt;br /&gt;
** CPU: 64MHz ARM Cortex-M4F &lt;br /&gt;
&lt;br /&gt;
* MEMORY:&lt;br /&gt;
** Internal: 512KB Flash, 64KB RAM (nRF52840: 1 MB flash, 256KB RAM)&lt;br /&gt;
** Additional: SPI NOR 8 MB Flash&lt;br /&gt;
&lt;br /&gt;
* COMMUNICATION:&lt;br /&gt;
** Bluetooth 5 (including Low Energy)&lt;br /&gt;
&lt;br /&gt;
* FEATURES:&lt;br /&gt;
** Sensors: Accelerometer, PPG Heart Rate Sensor&lt;br /&gt;
** Actuator: Vibrator&lt;br /&gt;
&lt;br /&gt;
* BATTERY:&lt;br /&gt;
** Built-in LiPo 170-180mAh battery&lt;br /&gt;
** Charging: Proprietary 2pin 5V 500mA, USB type A plug&lt;br /&gt;
&lt;br /&gt;
* PRICE:&lt;br /&gt;
** USD $22.99 (PineTime pebble and charging cradle, based on phone on PineTime devkit hardware configuration)&lt;br /&gt;
** USD $2 and up (20mm straight generic wrist band: silicone, NATO, Milanese steel, leather, and etc)&lt;br /&gt;
&lt;br /&gt;
== PineTime Schematic and Certifications ==&lt;br /&gt;
* PineTime Main Board Schematic:&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PinTime%20Schematic-V1.0-20191020.pdf PineTime Schematic ver1.0]&lt;br /&gt;
** [http://files.pine64.org/doc/PineTime/PineTime%20Port%20Assignment%20rev1.0.pdf PineTime GPIO Port Assignment ver1.0]&lt;br /&gt;
* PineTime Certifications:&lt;br /&gt;
** not yet available&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== PineTime DevKit SWD Probe ==&lt;br /&gt;
* PineTime SWD probe pinout definition:&lt;br /&gt;
[[File:PineTime_SWD_location.jpg]]&lt;br /&gt;
&lt;br /&gt;
=== PineTime SWD Probe Usage Method ===&lt;br /&gt;
Slightly bend or zig-zag the probe pins to the left and right to strengthen contact to the SWD pins on the dev kit.&lt;br /&gt;
&lt;br /&gt;
'''Note''': The color coding on the SWD probe wires is random and meaningless.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:PineTime_SWD_Plugin.jpg]]&lt;br /&gt;
&lt;br /&gt;
== Driving the peripherals ==&lt;br /&gt;
&lt;br /&gt;
=== Display ===&lt;br /&gt;
&lt;br /&gt;
The display is driven using the ST7789 display controller. Use the following pins to drive the screen:&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! PineTime pin&lt;br /&gt;
! ST7789 pin&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SCK (P0.02)&lt;br /&gt;
| SPI clock&lt;br /&gt;
|-&lt;br /&gt;
| LCD_SDI (P0.03)&lt;br /&gt;
| SPI MOSI&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RS (P0.18)&lt;br /&gt;
| Clock/data pin (CD)&lt;br /&gt;
|-&lt;br /&gt;
| LCD_CS (P0.25)&lt;br /&gt;
| Chip select&lt;br /&gt;
|-&lt;br /&gt;
| LCD_RESET (P0.26)&lt;br /&gt;
| Display reset&lt;br /&gt;
|-&lt;br /&gt;
| LCD_BACKLIGHT_{LOW,MID,HIGH}&lt;br /&gt;
| Backlight (active low)&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* 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.&lt;br /&gt;
* SPI must be used in mode 3. Mode 0 (the default) won't work.&lt;br /&gt;
* LCD_DISPLAY_* is used to enable the backlight. Set at least one to low to see anything on the screen.&lt;br /&gt;
&lt;br /&gt;
== Datasheets for Components ==&lt;br /&gt;
* NORDIC SoC information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52832%20product%20brief.pdf NORDIC nRF52832 Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/nRF52840%20product%20brief.pdf NORDIC nRF52840 Product Brief]&lt;br /&gt;
* PMU (Power Management Unit) information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGM40561.pdf SGMicro SGM40561 Single Cell Charger Datasheet]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/SGMICRO-SGM2036.pdf SGMicro SGM2036 3.3V Low Power Low Dropout RF Linear Regulator Datasheet]&lt;br /&gt;
* SPI Flash information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L6433F,%203V,%2064Mb,%20v1.6.pdf Macronix 64Mb(8MB) SPI NOR Flash]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/MX25L12835F,%203V,%20128Mb,%20v1.6.pdf Macronix 128Mb(16MB) SPI NOR Flash]&lt;br /&gt;
* LCD Panel:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20LCD%20Panel.jpg 1.3&amp;quot; 240x240 IPS LCD Panel Specification for PineTime]&lt;br /&gt;
** [https://wiki.pine64.org/images/5/54/ST7789V_v1.6.pdf 11.6&amp;quot; Sitronix LCD Driver/Controller Datasheet]&lt;br /&gt;
* Touchpad information:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/PineTime%20Touch%20Panel.jpg Touchpad Specification for PineTimel]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/CST816S数据手册V1.1.pdf 11.6&amp;quot; Hynitron CST816S Capacitive Touch Controller Datasheet in Chinese]&lt;br /&gt;
*** [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]&lt;br /&gt;
* Sensor:&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/BST-BMA421-FL000.pdf BOSCH BMA421 Triaxial VAcceleration Sensor Product Brief]&lt;br /&gt;
** [http://files.pine64.org/doc/datasheet/pinetime/HRS3300%20Heart%20Rate%20Sensor.pdf TianYiHeXin HRS3300 PPG Hear Rate Sensor Data Sheet]&lt;/div&gt;</summary>
		<author><name>Ayke</name></author>
	</entry>
</feed>