nordic: reduce sleep current by using SENSE feature for PinAlarm when possible #9534
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR decreases the power consumption of sleep modes with active pin interrupts by ~10x by using the SENSE feature, when possible.
"Normal" GPIOTE interrupts increase sleep current consumption by ~20µA, but using SENSE (aka PORT events) instead can reduce this to ~2µA.
This behaviour is documented as an Erratum here and discussed for Zephyr here (both for nrf52832, but it's also present in nrf52840 and also mentioned in the datasheet, Chapter "5.2.1.1 Sleep").
The documentation of
nrfx_gpiote_in_init
says that only 1 pin can be used for SENSE at one time, but by my own testing, 2 sense pins also work and it only breaks when trying to use 3 pins for SENSE. Hence when 3 or morePinAlarm
s are set, we stick to the previous behaviour.I have tested and confirmed that the following still works after this change (using a makerdiary_nrf52840_mdk_usb_dongle and a ssci_isp1807_dev_board):
alarm.wake_alarm.pin
in all of the above cases.PinAlarm
s, the behaviour is unchanged by this PR.But I would encourage that someone else verifies this before merging, should there be interest in this PR.