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

Need a 30 second interrupt - using RTC ?

I need a 30 second hardware based interrupt for a Nordic BLE nrf52832 chip running S132 Softdevice.   I would like to use RTC2.  This will be used to run a short BLE ad scan every 30 seconds.

Is there some way to get a slow TRUE hardware based, 30 second interrupt using RTC2?

It seems that 8hz is the slowest frequency for RTC. 

SLOW RTC...

Is there a setting that will slow the RTC interrupt down such that I can get a 30 second period interrupt?

TRIGGER MECHANISM...

I am able to define a trigger interrupt occurring every 30 seconds, but it appears that the RTC2 handler is still receiving an interrupt at 8hz.  I want to avoid an 8hz interrupt with a switch block that looks for trigger event, as this would consume more power -- than a "true" 30 second hardware based interrupt.

    //Set compare channel to trigger interrupt after #of seconds.
    // channel=0
    // value=8hz * 30 seconds.
    // true= enable trigger interrupt.
    err_code = nrf_drv_rtc_cc_set(&mtag_rtc_sleep, 0, (8*30), true);

APP_TIMER...

I could use an app_timer to get a 30 second interrupt.  But I have a hunch that beneath the covers, the RTC1 interrupt is occurring at 8hz, and simply invoking my defined handler every 30 seconds using a clock variable in a low-level app_timer handler that is being invoked at 8hz.

Whereby app_timer may not be providing a "true" 30 second hardware based interrupt.  And it will consume more power.

Or is my concern over power usage a moot point?

Thanks,

Ken Huebner

Software Engineer

Huebner Design

Parents Reply Children
  • For app_timer, what are you measuring for power usage during the sleep time?

    I decided to give up on RTC and go with the app_timer, similar to your code.

    I am currently measuring 5uA @3V power usage during sleep when using app_timer.  This is not bad, but I am interested if I can reduce power further. 

    Thanks, Ken

  • Under the hood, app_timer just uses RTC1, so you're still using RTC ;-)

    (SoftDevice uses RTC0 by the way)

    As for the power consumption; 5 uA seems just a little bit on the high side. Your application is definitly sleeping, so that's ok, but for only RTC running and system in low-power system_on, one would expect around 2 uA. But when you get in this range, there is a whole set of things that might be important of course, such as quiescent currents in the board, proper pin configuration (no floating pins!), measurement accuracy, etc. So, I guess it depends on how bad you want that extra 3 uA ;-)

Related