This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

RADIO Power Control for Register reset

Hello, I'm working on timeslot and RADIO on nRF52840.

I found a sample code which sets 1 to "NRF_RADIO->POWER" to initialize RADIO peripheral.

-------------------------------------------------
/* Reset all states in the radio peripheral */
NRF_RADIO->POWER = 1;
-------------------------------------------------

However, the description in "6.20.14.39 POWER" is somewhat different.

-------------------------------------------------
Peripheral power control. The peripheral and its registers will be reset to its initial state by switching the peripheral off and then back on again.
-------------------------------------------------

It is clearly saying that the POWER should be set to "0' and then "1" like following, isn't it?

-------------------------------------------------
/* Reset all states in the radio peripheral */
NRF_RADIO->POWER = 0;
NRF_RADIO->POWER = 1;
-------------------------------------------------

Parents Reply
  • Hi,

     

    jake.yoon said:
    What I'm asking is that "to set .POWER=1 when it was already .POWER=1 makes the registers to their default value. Is it?

    My apologies for misinterpreting.

    Only toggling the power, ie. at some point setting the .POWER=0, will reset the registers.

     

    By the way, since you're writing to a peripheral mapped register, you should introduce a wait-condition, as its not running on the same clock speed as the CPU:

    NRF_RADIO->POWER = 0;
    /* Dummy read of random volatile register. Wait state to ensure write */
    (void)NRF_RADIO->EVENTS_DISABLED;
    NRF_RADIO->POWER = 1;

     

    Kind regards,

    Håkon

Children
Related