<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Can&amp;#39;t start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/13773/can-t-start-lfclk-when-softdevice-is-not-present</link><description>Hi. 
 I am trying to get the RTC started, and I&amp;#39;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</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 11 May 2016 20:23:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/13773/can-t-start-lfclk-when-softdevice-is-not-present" /><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52640?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 20:23:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb35c625-16ca-4e38-8489-3f3d0219acfa</guid><dc:creator>Sven</dc:creator><description>&lt;p&gt;Well, I had the same intentions since I want to precisely determine when the SD is running. My case is simpler since I use ANT. SDK version is 10.&lt;/p&gt;
&lt;p&gt;But here is what I did:&lt;/p&gt;
&lt;p&gt;In the components/drivers_nrf/clock/nrf_drv_clock.c I added these controls at the beginning and at the end of the file. This file maintains the behavior when the SD is either enabled or disabled. Or it can easily changed back.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#ifdef SOFTDEVICE_PRESENT
#define RESTORE_SOFTDEVICE 1
#undef SOFTDEVICE_PRESENT
#endif

#if RESTORE_SOFTDEVICE
#define SOFTDEVICE_PRESENT
#undef ENABLE_SOFTDEVICE
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;In the examples/../config/nrf_drv_config.h I changed &lt;strong&gt;CLOCK_ENABLED&lt;/strong&gt; to &lt;strong&gt;1&lt;/strong&gt; and defined the calibration interval for the clock driver.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define CLOCK_ENABLED 1
 
#if (CLOCK_ENABLED == 1)
#define CLOCK_CONFIG_XTAL_FREQ          NRF_CLOCK_XTALFREQ_Default
#define CLOCK_CONFIG_LF_SRC             NRF_CLOCK_LF_SRC_RC
#define CLOCK_CONFIG_IRQ_PRIORITY       APP_IRQ_PRIORITY_LOW
#define CLOCK_CONFIG_LF_RC_CAL_INTERVAL	RC_16000MS_CALIBRATION_INTERVAL
#endif
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;As a result I can call &lt;strong&gt;nrf_drv_clk_init()&lt;/strong&gt; and &lt;strong&gt;nrf_drv_clock_lfclk_request()&lt;/strong&gt; without softdevice being inited. If I want to enable the SoftDevice I trigger corresponding release() and uninit() calls before initing the radio.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52637?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 20:10:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:119e93d7-c151-4587-8f11-380298254829</guid><dc:creator>Sven</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52639?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 13:54:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b82bf5d3-63a3-45e6-9aa4-6fdbd47d226a</guid><dc:creator>Texton</dc:creator><description>&lt;p&gt;Oh, I missed a SOFTDEVICE_PRESENT in my makefile. Thanks :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52636?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 13:39:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4edbe557-49cd-49a2-8bff-301e7d6c0370</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;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&amp;#39;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&amp;#39;t in connection, you can do some debugging, but further than that, you can&amp;#39;t, this is very well documented and understood.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52635?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 13:15:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f4e713e-5111-47bf-8b2e-a686e9667deb</guid><dc:creator>Sven</dc:creator><description>&lt;p&gt;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.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Can't start LFCLK when softdevice is not present</title><link>https://devzone.nordicsemi.com/thread/52638?ContentTypeID=1</link><pubDate>Wed, 11 May 2016 13:15:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5169cf75-ddbc-4748-8da1-a261ca49b4a3</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Well if you look at the source code for nrf_drv_clock_init() you&amp;#39;d see it compiles differently whether the &lt;code&gt;#define SOFTDEVICE_PRESENT&lt;/code&gt; is defined or not. So if you want to not have the softdevice-enabled code compiled, undefine that and it won&amp;#39;t call the sd_* function which is returning the error.&lt;/p&gt;
&lt;p&gt;Please read the threads about why debugging is not compatible with the softdevice, there&amp;#39;s many of them, it&amp;#39;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&amp;#39;t break, well you can break, you can&amp;#39;t resume again.&lt;/p&gt;
&lt;p&gt;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).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>