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

Usage of RTC0 as time basis (system time) possible?

Hello everybody,

RTC0 is used by the SoftDevice. Is it possible to use the current RTC0 counter value as a system time, so that RTC1 doesn't have to run additionally? For this purpose, RTC0 would have to run continuously.

My goal is to save timestamps for certain events (e.g. a interrupt through a GPIO pin, or a BLE event) and measure time difference between these events.

This is why I need to know if the RTC0 counter value can be accessed without any problem, and if the RTC0 may be stopped/disabled at any time after the SoftDevice has been enabled (using SOFTDEVICE_HANDLER_INIT()):

  • Is RTC0 disabled on S110 when there is no advertising and no connection in progress (so the stack is completely idle)?

  • Is RTC0 disabled on S120 when there is no scanning and no connection in progress (so the stack is completely idle)?

  • Is the RTC0 counter value reset at any time? E.g. when switching from Advertising mode to Connection mode, or restarting Advertising with a different interval.

One more question regarding energy consumption: Will there be a different sleep energy consumption with the S110 stack whether advertising/connection is active or the SoftDevice is idle? Sleep mode is entered with sd_app_evt_wait() in both cases. This question is related to my concern that RTC0 might be switched off when the SoftDevice is idle. (We intend to measure the sleep energy consumption without any wakeup because the measurement resolution would be too low otherwise.)

Parents
  • Even if currently RTC0 ran constantly, never stopped and was never reset and you could read it as you suggest, basing your application on that would be a very bad idea. The softdevice implementation could change at any time, in any way, to run, not run, reset the counter etc. as part of Nordic's softdevice evolution.

    You should treat the resources which are documented as used by the softdevice as unavailable for any purpose unless there's an exposed user API point or a documented exception.

Reply
  • Even if currently RTC0 ran constantly, never stopped and was never reset and you could read it as you suggest, basing your application on that would be a very bad idea. The softdevice implementation could change at any time, in any way, to run, not run, reset the counter etc. as part of Nordic's softdevice evolution.

    You should treat the resources which are documented as used by the softdevice as unavailable for any purpose unless there's an exposed user API point or a documented exception.

Children
No Data
Related