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

Timed interval sleep mode

hi!

i am working with the nrf52 and i am looking for a timed sleep mode, meaning, a function that goes into sleep mode for a given duration.

is there anything like that in the SDK? if not, perhaps you can advise on how to implement this?

thanks a lot in advance.

  • Hi,

    There is no such functions in our SDK. Sleeping for a given period of time will require use of a timer. In nRF52 series, you can find TIMER peripherals, running off HFCLK with high accuracy/resolution, and RTC peripherals, running off LFCLK with lower resolution - but also lower current consumption. You can read more about the differences in this thread.

    The nRF52 have two primary sleep modes, system on mode, and system off mode. When using timers as wakeup source, only system on sleep mode can be used, as system off mode will disable all clock sources to save power. Available wakeup sources in system off mode can be seen in the documentation.

    In our SDK, you can find the application timer library, which can create multiple timers using a single RTC peripheral. I recommend that you have a look at the application timer tutorial to get started with this. The library can easily be used to create a function like you are requesting. Note that any generated event will wake the chip from system on mode, not only the event generated by your timer. You should then make sure no other peripherals will generate events, if you want the chip to be in sleep mode the full period.

    Best regards,

    Jørgen

  • I am learning NRF52 i can across this question.

    1. @Jørgen Holmefjord does it mean if temprature sensor is connected to nrf52 chip then chip cannot sleep as temperature sensor will keep updating the nrf52?

    2. Also if nrf52 is connected to a peripherals i.e. ipad and ipad request data then nrf52 will get up as soon as it receives the request.

    Can we make code like after every 1 min nrf52 sends temperature data to ipad then goes to sleep and when if ipad requests data it gets up and send temperature data and sleeps for next 1 mins. Then go back to normal 1 min regular interval?

    1. This will depend on the sensor, and what type of interface it has to the nRF52. Normally if the sensor is connected the nRF52 chip is the one requesting data from the sensor, not the other way around.
    2. If a BLE connection is used, either to the sensor or to an external device (phone, tablet, etc.), the configuration of the BLE connection will decide when the chip can sleep. The devices will negotiate intervals, which is the only time data can be sendt over the air between the device. The nRF52 can always enter system on mode when no events needs to be handled.

    Yes, you can make code that do this.

Related