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

Using rtc driver with SoftDevice

Hi,

i am trying to start a RTC0 on nrf52 DK with SoftDevice (s132) enabled with project based on "ble_app_template". The problem is that a sd_softdevice_enable() (called in main -> ble_stack_init() -> SOFTDEVICE_HANDLER_INIT()) returns NRF_ERROR_INVALID_STATE. Does it mean XTAL already running? In my project initialization of the RTC0 taking place after ble_stack_init() call. Moreover, once that code downloaded and ran into nrf52 the sd_softdevice_enable() fails all time even if RTC0 initialization is spiked at all until the project builded without "nrf_drv_rtc.c" module.

What can be a reason?

Parents
  • You can't use RTC0, the softdevice uses it for its timing. See table 4, section 8.1 of the softdevice 132 specification to see what peripherals the softdevice claims for itself.

    So start by fixing your code to use a different RTC instance and see if you get any further.

    Also the documentation for NRF_ERROR_INVALID_STATE says that you get that when the softdevice is already enabled. So it is?

  • Thanks for the fast reply.

    I've already tried to use other RTC instances with same result. But now i think it is because my first attempt to use the RTC0 instance (i really forget this SoftDevice requirement, because i certainly know that RTC1 occupied by app_timer.c realization). I will try to use RTC2 again.

Reply Children
No Data
Related