Difference between revisions of "PineTime Development"
Line 132: | Line 132: | ||
|} | |} | ||
== How to write battery friendly software? | == How to write battery friendly software? == | ||
The key to save battery is to enable only what you need when you need it. nRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks: | The key to save battery is to enable only what you need when you need it. nRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks: |
Revision as of 16:02, 16 September 2020
Available firmware and projects
How to write battery friendly software?
The key to save battery is to enable only what you need when you need it. nRF52832 has a lot of functionalities allowing you to draw as little current as possible. Here are some tips and tricks:
- Disable / shutdown / put in sleep mode all devices around the MCU (display controller, touch controller, external memory,...).
- Disable all peripheral inside the MCU when you don't need them (SPI, TWI(I²C),...). The power management of the NRF52832 is very smart and will completely shut down (power off and disable the clock) the peripheral when the software disables it.
- Put the MCU to sleep as soon and as often as possible. If you are not using a RTOS, this is done by calling WFE (wait for event) instruction. Most of the time, RTOS implement this functionality. For example, FreeRTOS calls it the tickless mode : it puts the CPU in sleep mode when no task is planned for execution for more than a specified time, and wakes up as soon as an event is detected or when a task is ready to run.
- Do not use logging (JLink RTT, SWO, semihosting,...), it uses a lot of power.
- Ensure that the debug circuitry of the MCU is not enabled when you measuring the battery life. The debug peripheral is enabled as soon as you connect a debugger to the device, and is not automatically disabled, even if you disconnect the debugger you will have to wait for the battery to go flat to disable to port. The software running in the NRF52832 cannot disable the debug peripheral. How to disable the debug circuitry:
- using nrfjprog --reset - using JLinkExe : issue the command writeDP 1 0
or with OpenOCD - issue the command halt - issue the command flash fillw 0x10001208 0xFFFFFF00 0x01 - issue the command reset
you can check if the debug port is enabled using the following code DWT->CYCCNT ? "NO":"YES"
- Read the errata sheet of the MCU and apply workarounds if they apply to your software.
Wishlist
In order to keep track of features and changes to the hardware people would like to see, check out this article: PineTime hardware wishlist
Compatibility with other projects
Different firmware running using different bootloaders and Bluetooth stacks on the nRF52832 have different requirements on how they should be initialised and what should be placed where in the internal flash.
To keep track of what, how and why things work like they do across the different projects, check out the PineTime SoftDevice and MCUBoot compatibility article.
= Compatibility with companions apps and Bluetooth communication
There are many firmwares running on Pinetime that implement different BLE APIs (time synchronization, notifications,...). Companion apps must be able to differentiate between different firmwares and forks of the same firmware. See PineTime Bluetooth.
PineTime equivalents and jailbreaking
This page contains a list of PineTime-like smartwatches that might be "jailbreakable" or a good source for ideas for the PineTime: PineTime Equivalents