[riot-notifications] [RIOT-OS/RIOT] cpu/nrf5x: enhance external HF clock source handling to allow for substantial energy savings (#15804)

Hauke Petersen notifications at github.com
Tue Jan 19 21:09:22 CET 2021


### Contribution description
Currently, we enable the external high frequency crystal (`HFXO`) as clock source for the nRFs high frequency clock (`HFCLK`) during CPU initialization per default. With the `HFXO` constantly enabled the CPU is however prevented to to into proper power saving states when idle. Further this external clock source is only needed for some selected peripherals (e.g. `radio`) or some specific peripheral configurations (e.g. `UART` with baudrate >> 500kbps). So the better solution is to not enable this clock source by default, but let the peripherals/drivers request that clock source on demand.

This PR introduces 2 changes:
- add two functions to request/release the `HFXO`
- disable the `HFXO` by default, however, keeping the option to enable it during boot setting the `CLOCK_HFXO_ONBOOT` define to `1`
- call the `clock_hfxo_request()` function from the 3 existing nrf radio drivers, as the radio depends on that clock source

The potential energy savings are drastic:
`examples/minimal` with `USEMODULE=stdio_null` @ `nrf52dk`, average current drawn:
master: 411µA
**with this PR: 3,6µA** -> saving factor > 100!!!

### Testing procedure
With this PR all existing application on any nordic platform should still work as expected.

Most important to verify:
- some xtimer/ztimer tests
- `gnrc_networking` using `USEMODULE=nrfmin`
- `gnrc_networking` using `USEMODULE=nrf802154` @ `nrf52840dk` or similar platform with a `nrf52840` cpu

### Issues/PRs references
none
You can view, comment on, or merge this pull request online at:

  https://github.com/RIOT-OS/RIOT/pull/15804

-- Commit Summary --

  * cpu/nrf5x: allow to request/release HFXO clk src
  * cpu/nrf/radio/nrf802154: request HFXO clock source
  * cpu/nrf/radio/nrfmin: request HFXO clock source
  * cpu/nrf/radio/nrfble: request HFXO clock source

-- File Changes --

    M cpu/nrf52/radio/nrf802154/nrf802154.c (6)
    M cpu/nrf5x_common/clock.c (34)
    M cpu/nrf5x_common/include/nrf_clock.h (12)
    M cpu/nrf5x_common/radio/nrfble/nrfble.c (6)
    M cpu/nrf5x_common/radio/nrfmin/nrfmin.c (6)

-- Patch Links --

https://github.com/RIOT-OS/RIOT/pull/15804.patch
https://github.com/RIOT-OS/RIOT/pull/15804.diff

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/RIOT-OS/RIOT/pull/15804
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210119/990b95a7/attachment.htm>


More information about the notifications mailing list