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

RTC turns off when using idle_state_handler in ble_app_template

Hi

Im developing an application that will wake up on RTC every 15 minutes. My issue is that when using idle_state_handle, which in turn calls sd_ble_app_wait, the RTC will turn off, and therefore will not wake up from this source. This is verified using prints to a terminal. Ive tried using both app_timer and configuring RTC2 myself, both have the issue. 

My question is how can i configure the sd_ble_app_wait to first of all not turn off the RTCs  and second of all, how can i choose to wake up from RTC?

Im on windows, using SDK17 on a 52840 using a devkit PCA10056. 

Parents Reply Children
  • I have found the solution. 

    When using the ble_app_template, the function sleep_mode_enter is called, where it enters system_OFF. This happens in the on_adv_evt - which explains all my issues with the RTC not working after advertising stops.

    I do have a follow up question - How can i choose which system_ON state it enters - say I want to wake up on any event compared to wake up on RTC? Is this the same state, but dependent on which peripherals are actually running on the chip during sleep or are there actual registers that needs to be set during shutdown?

  • ThomasN12 said:
    say I want to wake up on any event compared to wake up on RTC? Is this the same state, but dependent on which peripherals are actually running on the chip during sleep or are there actual registers that needs to be set during shutdown?

    If you enable any Peripheral Interrupt then that is a wake-up source from SystemON, Idle (sleep). Ie. turn on the interrupt of any of the RTC's COMPARE events and it will wake up the CPU, execute that interrupt handler and return to whatever execution state the CPU was in before it went to sleep. 

    See for instance the RTC's INTENSET register. 

    Usually, this register is configured by the RTC driver, depending on what config parameters it was given during set-up. See f.ex. nrfx_rtc_cc_set and its enable_irq parameter. 

  • Thank you for these answers, they are very helpful. i ahve managed to implement it succesfully.

    Another question that is springing to mind is numbers regarding the current consumption when running from a DCDC vs LDO in sleep mode. The numbers specified in the datasheet are only shown for an LDO, but im curious to know how using the internal DCDC converter will affect these numbers or if it has any effect at all. I can see nubmers are specified for when the CPU is running, but since it will spend most of its time in sleep, these numbers are of smaller significance. 

  • The current consumption for the active state is of less significance, since the board will only be active for small timeslots. But when its sleeping for such elongated periods the sleep current is now of larger importance. There are however only current consumptions listed for LDO usage and not DCDC for sleep. Will they be the same or will it be lower for DCDC compared to the LDO?

Related