InfiniTimeOrg / InfiniTime

Firmware for Pinetime smartwatch written in C++ and based on FreeRTOS
GNU General Public License v3.0
2.64k stars 907 forks source link

Power optimization - Improve SPI sleep mode #1758

Closed JF002 closed 1 year ago

JF002 commented 1 year ago

Ensure that all pins are set to their default configuration during sleep mode. Disable the workaround for FTPAN58 (SPI freezes when transfering a single byte) at the end of the transfer. This disables the resources needed for the workaround. Those changes reduce the power usage by 430-490µA.

github-actions[bot] commented 1 year ago
Build size and comparison to main: Section Size Difference
text 407660B 0B
data 940B 0B
bss 54136B 0B
JF002 commented 1 year ago

How much do each of the changes contribute to reducing the power consumption separately?

This PR basically contains 2 changes : reset the CS pin configuration during sleep (and restore it at wake up) and disable the "workaround for FTPAN58" (disable the PPI channel).

As I said in responses to your reviews, resetting the CS pin config is probably wrong as CS pins must be kept high whenever we don't want devices to listen to the bus, so I'll remove those change. The power usage reduction from this change is very small (not easy to measure, something between 1-5µA, 10µA max).

Most of the power usage reduction comes from disabling the PPI channel : from 900µA to 410µA in sleep mode with BLE disabled.

Mindavi commented 11 months ago

Thanks for these improvements! It seems like my pinetime is really holding out very long on one charge now, I am very happy about that. 😊