Wake Up Time System On

Hi,

Im using a custom NRF52811 board and on this board we are using the internal RC as LFCLK source. I have a single thread that sleeps every 10 seconds, so during 10 seconds the system is sleeping (consumes more less 1.35 micro amp). However, the wake up time seems to be quite a lot - around 20ms. I attached the power profiling bellow. Any idea how this can be reduced ?
Im using NRF Connect SDK 2.4.3




Thank you!

Parents Reply Children
  • Then, unfortunately, I don't think there is much room for speeding this up. It will probably be quicker if you use the nRF5 SDK, but the Zephyr OS is a bit larger, so it takes a bit longer to start up things. 

    Alternatively, if you want to keep track of time or something, there are some few tricks that you can do this without waking up the CPU. You can use something called PPI to link events and tasks in different peripherals together, such as a timer or RTC timeout event with incrementing another timer running in counter mode. Let me know if this is of interest. 

    Best regards,

    Edvin

  • Yeah totally understand! Thanks for the help!
    Since we are on this topic and if you dont mind, during sleep I found that the system is doing clock calibration. Basically during the 10 seconds sleep, I see little spikes and if I change the CONFIG_CLOCK_CONTROL_NRF_CALIBRATION_PERIOD the space between these spikes will be smaller or larger depending of the value -  the default is 4000 ms.

    My question regarding this matter are:
     - If I increase the calibration period, for example 10000ms, the system stops responding. Can this calibration be done on demand ?  So I can decide when to do it.
     - I'm using Bluetooth on my application. Can this calibration affects the behavior of it ?

    Thanks again!

  • Miguel Ferreira said:
    If I increase the calibration period, for example 10000ms, the system stops responding

    What do you mean by "stops responding"?

    Miguel Ferreira said:
     - I'm using Bluetooth on my application. Can this calibration affects the behavior of it ?

    What kind of bluetooth are you doing? Advertising? Scanning? In a connection?

    The reason I ask is that if you are only advertising or scanning, the time accuracy isn't really a big deal, and you can calibrate less often. If you are in a connection, you need to provide the application with your clock accuracy. The peripheral will state it's accuracy when connecting to a central. The more accurate clock you have, it means that the peripheral needs less slack when they communicate. Let us say you have a connection interval of 100ms. If you have a very accurate clock, the peripheral can turn on the radio in RX when it is closing in on the 100ms timeout. (It is the central that sends the first packet in the connection event, occuring every connection interval)

    If you have a less accurate LFLCK, it means that you need to turn on the radio in RX sooner, because you can't know whether your clock has drifted. So while you save power not doing clock calibration, you will see that the radio current increases because of a larger RX slot when you have a less accurate clock. 

    If you are only doing advertising, this doesn't really matter, since the timing of this is not that strict, and there is little or no RX time on the radio (depending on the advertising type). 

    General, it is recommended to set the CLOCK_CONTROL_NRF_ACCURACY_PPM to CLOCK_CONTROL_NRF_k32SRC_500PPM if you are using the RC Oscillator (default value), and let the rest of the calibration options be set at default, if you plan to enter a bluetooth connection. If not, you may experience instable connections, disconnections and this again will draw more current than doing the clock calibration. If you plan to only advertise, though, you can give some slack on the calibration.

    Best regards,

    Edvin

  • Hi,

    Thanks for the detailed reply!

    Basically the system seems to not boot - no RTT output and on power profiling I can see the device stall.

    Just advertising and scanning. So I will not do any kind of connection. Thanks for the detailed explanation, that makes a lot of sense!

    Regarding this, is there a way to do the calibration on demand ? I was able to increase how often the calibrations are done, but I would like to have control of it if possible.

    Thanks a lot once again!

  • Hello, and sorry for the late reply. 

    I would say that the way to only calibrate on demand would be to disable calibration in the prj.conf, and then look at how it is done in the nrfx_clock.c found in ncs\modules\hal\nordic\nrfx\drivers\src\nrfx_clock.c. It looks like you can use the nrfx_clock_calibration_start(). 

    Best regards,

    Edvin

Related