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

Can't start LFCLK when softdevice is not present

Hi.

I am trying to get the RTC started, and I've followed the rtc example in the NRF51_SDK.

But things go wrong when I call:

ret_code_t err_code = nrf_drv_clock_init(NULL);
APP_ERROR_CHECK(err_code);

I get the errer code: 2, meaning NRF_ERROR_SOFTDEVICE_NOT_ENABLED. And that is exactly right, the softdevice is not enabled, because I want to be able to debug for the moment?

(btw. will it ever be possible to debug while using the softdevice, it is getting pretty annoying, not to be able to debug :) )

  • Well if you look at the source code for nrf_drv_clock_init() you'd see it compiles differently whether the #define SOFTDEVICE_PRESENT is defined or not. So if you want to not have the softdevice-enabled code compiled, undefine that and it won't call the sd_* function which is returning the error.

    Please read the threads about why debugging is not compatible with the softdevice, there's many of them, it's a hard technical limitation of how the processor debug works. You actually can debug before you start advertising, but once the radio is going and bluetooth has timing requirements, then you can't break, well you can break, you can't resume again.

    however see the blog post on Monitor Mode debugging which is available on the nRF52, which does allow you to debug with the softdevice running (by using a different debugging mode not available on the Cortex M0 in the nRF51).

  • Debugging with SD is possible. What are you using? I am using SEGGER IDE on Mac OS X. From time to time the debugging can halt because of the SD, but it is rather rare occasion.

  • No debugging with the SD is generally not possible. Monitor mode debugging is possible with the nRF52, but not the nRF51. Once any timing critical radio communications have started, ie you're advertising or in connection, as soon as you break the softdevice misses critical timing marks and it hardfaults as soon as you resume. If you just have the softdevice enabled but aren't in connection, you can do some debugging, but further than that, you can't, this is very well documented and understood.

  • Oh, I missed a SOFTDEVICE_PRESENT in my makefile. Thanks :)

  • Sorry, yes, missed the fact that the radio stack is actively running. I have done this clock hack because I want to debug so I only enable radio/SD when I need to send something. I am using ANT.

Related