Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nrf5-calendar example questions

https://github.com/NordicPlayground/nrf5-calendar-example

What is lowest power mode where real time clock could run?

How could retain RTC value during reset?

Thanks

Parents
  • What is lowest power mode where real time clock could run?

     System ON mode, with LFCLK and RTC running. ~ 2-3 µA. 

    How could retain RTC value during reset?

    It will depend on the type of reset. You could try to save the RTC value to a .noinit variable (will not be initialized to zero during startup) that you read at startup, alternatively save the RTC value to flash before the reset, and read it again startup.

  • Hi Sigurd,

    Do you have some example or tutorial about what need to be set for a .noinit variable as I'm receiving  linker errors when try

    uint32_t test_noinit __attribute__ ((section(".noinit")));

    Output/Debug/Exe/ble_app_ss_hid_rtos_pca10040_s112_19.elf section `.noinit' will not fit in region `UNPLACED_SECTIONS'

    region `UNPLACED_SECTIONS' overflowed by 4 bytes

    Also I'm using FreeRTOS in the app that I'm trying to implement RTC at lowest power mode. Does this affect  somehow your previous answer?

    Thanks

  • How does your SES project flash_placement.xml file look like ? 

    Do you have 

    <ProgramSection alignment="4" load="No" name=".non_init" />
    in the file ?

     

    during reset?

     What type of reset are you expecting ?

  • Hi Sigurd,

    yes, I have such line (only attributes order differ): <ProgramSection name=".non_init" load="No" alignment="4"/> 

    Does it mean I have to use ((section(".non_init"))) ?

    About 'Reset' - best if I could handle all types of resets, but for now will be Ok and only for resets which happen when nRF is awakes from seep mode (after button press) and restart which happen when system  when some faults happen without user interference?

    Thanks

  • So with ((section(".non_init"))) tested and work Ok so far with soft resets from code or faults, and give random numbers at power up or reset with the 'Reset' button. Didnt find any implications or side effects so far.

    Is there a way to find with code how was the nRF booted (power on, reset button, soft reset, ..), so to be able to distinguish is it a random number or  number I set before soft reset?

    Thanks

  • After a reset has occurred, register RESETREAS can be read to determine which source has triggered the reset.

    I also recommend doing some sanity check on the retained data when you wake-up.

Reply Children
  • Hi Sigurd,

    The RTC in System ON mode, with LFCLK and RTC running – how can check inside the callback event handler that I’m in such mode in order to skip/bypass the other stuff that normally is done there in regular mode like showing a clock etc. that cant run in low power mode?  Or to block interrupts from the RTC other way?

    The 'sanity check' is a good point, still didn’t find though reliable enough logic as the value in question is a timestamp, so far have idea how to check for out of range only the bottom limit (i.e.the compile or download timestamp), but with the upper limit is a tricky … so will leave if for a while in the TODO list until fix more important problems

    Thank you and best regards!  

  • In System OFF, everything is turned off, including clocks. You can read about the power modes here.

    There is no function to stop the callback, but one can easily be implemented. All you have to do is set the callback pointer to 0:

    void nrf_cal_clear_callback(void)
    {
        cal_event_callback = 0;
    }

Related