Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

cpu/nrf5x: implement pm_off() for nRF53/9160 #20590

Merged
merged 1 commit into from
Apr 18, 2024

Conversation

dylad
Copy link
Member

@dylad dylad commented Apr 17, 2024

Contribution description

This PR implements pm_off() support for nRF9160 and nRF53.
The register moved to the regulator peripheral compared to nRF52.
Nordic also have two different names for the same bit of this register, so I add a small workaround. (Could have use '1' instead but I prefer to clearly identify bits within registers).

Testing procedure

Run tests/periph/pm on nrf9160dk or nrf5340dk-app
and use pm off command

Issues/PRs references

None.

@dylad dylad requested a review from kaspar030 as a code owner April 17, 2024 17:08
@github-actions github-actions bot added Platform: ARM Platform: This PR/issue effects ARM-based platforms Area: cpu Area: CPU/MCU ports labels Apr 17, 2024
@dylad dylad added the CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR label Apr 17, 2024
@riot-ci
Copy link

riot-ci commented Apr 17, 2024

Murdock results

✔️ PASSED

7aa7e79 cpu/nrf5x: implement pm_off() for nRF53/9160

Success Failures Total Runtime
10065 0 10066 13m:46s

Artifacts

Copy link
Contributor

@benpicco benpicco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to take the opportuninty to untangle that #ifdef mess? It's really hard to read.

How about

#if defined(REGULATORS_SYSTEMOFF_SYSTEMOFF_Enter)
    NRF_REGULATORS_S->SYSTEMOFF = REGULATORS_SYSTEMOFF_SYSTEMOFF_Enter;
#elif defined(CPU_FAM_NRF51)
    NRF_POWER->RAMON = 0;
#else
    for (int i = 0; i < ARRAY_SIZE(NRF_POWER->RAM); i++) {
        NRF_POWER->RAM[i].POWERCLR = (POWER_RAM_POWERCLR_S1RETENTION_Msk |
                                      POWER_RAM_POWERCLR_S0RETENTION_Msk);
    }
#endif

@dylad dylad force-pushed the pr/cpu/nrf53/pm_off branch from f2f9656 to 46f3253 Compare April 18, 2024 09:56
@dylad
Copy link
Member Author

dylad commented Apr 18, 2024

@benpicco I've updated the commit and squashed.

Signed-off-by: Dylan Laduranty <dylan.laduranty@mesotic.com>
@dylad dylad force-pushed the pr/cpu/nrf53/pm_off branch from 46f3253 to 7aa7e79 Compare April 18, 2024 11:33
@dylad dylad enabled auto-merge April 18, 2024 11:36
@dylad dylad added this pull request to the merge queue Apr 18, 2024
Merged via the queue into RIOT-OS:master with commit c415758 Apr 18, 2024
25 checks passed
@dylad dylad deleted the pr/cpu/nrf53/pm_off branch April 18, 2024 17:30
@dylad
Copy link
Member Author

dylad commented Apr 18, 2024

Thanks for the review !

@mguetschow mguetschow added this to the Release 2024.07 milestone Jul 5, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Area: cpu Area: CPU/MCU ports CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Platform: ARM Platform: This PR/issue effects ARM-based platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants