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

Sleep until WDT timesout

Hi All,

I have up to 8 nRF52832 devices sending data back to a base unit (another nRF52832 device.)   What I'm trying to do is have the remote units wakeup at a given time,

read sensors and send message back to the base unit.  (Each remote has a unique ID that the base unit tracks the data by.)

Currently I'm using a watchdog timer to bring the device out of sleep mode (reboot and read nvram to reload system state.)

I've been trying to use:

while(1)

{

__WFE();

}

To put the device asleep, but I'm thinking the devices are waking each other up.  (I'm getting more updates than expected and battery life is lower than expected.)

Is there a better way to get the unit to stay asleep?

thanks,

Bob

Parents
  • You can use an RTC to wake the system up from WFE sleep, the watchdog timeout inserts an unnecessary reset in between, which if I understood correctly is something you could avoid. Look at the example provided at nRF5_SDK_15.3.0_59ac345\examples\peripheral\rtc\main.c

  • Hi Susheel,

    My board has an external 32KHz crystal.  What is the deepest sleep mode I can put the nrf52832 into and leverage this crystal?  Goal being to wake up after a given time period (in seconds to minutes.)

    Thanks much for any pointers. I have a multi-meter on my board measuring current and I can't get it to stay below 170uA in sleep mode.  (I think I'm missing a power down mode of some sort.)

    thanks,

    Bob

  • Hi Susheel,

    I wanted to rule out that my hardware is drawing the high current, so I created a software build that just has:

    #define RAM_RETENTION_OFF       (0x00000003UL)  /**< The flag used to turn off RAM retention on nRF52. */
    
    int main( void )
    {
    #ifdef NRF51
        NRF_POWER->RAMON |= (POWER_RAMON_OFFRAM0_RAM0Off << POWER_RAMON_OFFRAM0_Pos) |
                            (POWER_RAMON_OFFRAM1_RAM1Off << POWER_RAMON_OFFRAM1_Pos);
    #endif //NRF51
    #ifdef NRF52
        NRF_POWER->RAM[0].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[1].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[2].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[3].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[4].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[5].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[6].POWER = RAM_RETENTION_OFF;
        NRF_POWER->RAM[7].POWER = RAM_RETENTION_OFF;
    #endif //NRF52
    
        // Set nRF5 into System OFF. Reading out value and looping after setting the register
        // to guarantee System OFF in nRF52.
        NRF_POWER->SYSTEMOFF = 0x1;
        (void) NRF_POWER->SYSTEMOFF;
        while (true);
    }
    

    The current draw in this mode is 12uA.

    So I know I'm close just missing a setting somewhere.

    thanks,

    Bob

    (ps I couldn't get the insert code feature to make the window larger above, if you click on it there is more.)

  • Bob,

    Waking up from system off mode is different than WFE. How are you intending to wake the chip from SystemOFF? 
    What is the acceptable power consumption in sleep mode you are aiming for? 
    Being in deep sleep will make your devices lose connection with each other

     

    rshankle said:
    What is the deepest sleep mode I can put the nrf52832 into and leverage this crystal?  Goal being to wake up after a given time period (in seconds to minutes.)

    The timers in the chip will be off, so you cannot reply on-chip timers to wake the chip here. Please read carefully the four ways that can wake the chip from system off mode. 

  • I'm looking for ideas.  What is the deepest sleep and still have the device wake itself up.  The device is a remote sensor and just needs to wake up read some IO, phone home, shut everything off and go back to sleep.  Maintaining connectivity with other devices isn't needed.

    The device does write to NVRAM before going to sleep so it can read that data on the next wakeup cycle.

    There is an external 32Khz crystal connected if that helps minimize power.

    (Under 20uA would probably be a solution.)

    thanks,

    Bob

  • rshankle said:
    The device is a remote sensor and just needs to wake up read some IO, phone home, shut everything off and go back to sleep.  Maintaining connectivity with other devices isn't needed.

     Then SystemOFF (deepest sleep mode) seems to suit your needs. You just need a proper wakeup mechanism configured with one GPIO pin, which could be an interrupt line from the externally powered sensor. 

  • We don't have the luxury of having something external running to wake up the nRF52832 device.  We need the device to wake itself up.  

Reply Children
Related