<?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>HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55424/hfclk-hfxo-failure-detection</link><description>Hi, 
 We have below questions regarding HFXO. 
 1.&amp;gt; Will softdevice or nordic HW be able to recognize that the 32 MHz crystal is non functional during run time (after the HFCLKSTART task is successful)? 
 Is there any interrupt or event generated on the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 12 Dec 2019 10:27:18 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55424/hfclk-hfxo-failure-detection" /><item><title>RE: HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/thread/225124?ContentTypeID=1</link><pubDate>Thu, 12 Dec 2019 10:27:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dd9201d1-5eb0-41b2-8862-8c643ccef7c7</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;The HFCLK is (in most examples) is started by the SoftDevice (in SOFTDEVICE_HANDLER_INIT), which is why you&amp;#39;re not able to see the initialization of it. Sorry if I misunderstood, but I thought you wanted to know how&amp;nbsp;&lt;strong&gt;you&amp;nbsp;&lt;/strong&gt;could start the HFCLK if you wanted. If the HFCLK is not available during startup, the SoftDevice will just wait for the HFCLK to become available, which is why the connection is lost and the device is not advertising.&lt;/p&gt;
&lt;p&gt;If the application is already running and the HFXO (external HF clock) fails, it apparently does not return an error, and the SoftDevice will keep running (very inaccurately), and ultimately failing due to timing errors or similar.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/thread/224999?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 16:51:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc55d93d-6832-48d3-bd12-b0b57ffb0c3a</guid><dc:creator>santosh athuru</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
&lt;p&gt;thanks for your reply. Can you be more specific,&amp;nbsp;in SDK 15.0, other than ble_connectivity example, I don&amp;#39;t see anywhere else the&amp;nbsp;HFCLK being started.&lt;/p&gt;
&lt;p&gt;For example ble_peripheral/ble_app_uart - I don&amp;#39;t see the code you are referring to. How is the&amp;nbsp;softdevice handling HFCLK in this example?&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve added the code that you mentioned about in my example and&amp;nbsp;I see that current consumption is little bit higher because the crystal is always ON now. I verified this by reading HFCLKSTAT register.&lt;/p&gt;
&lt;p&gt;If I don&amp;#39;t add the code you mentioned and if I stop the 32 MHz clock input while BLE is connected, then the peripheral drops the connection and I don&amp;#39;t see any advertisements either until I start providing the 32MHz clock input again. Also reading the HFCLKSTAT shows that SoftDevice turns ON and turns OFF HFCLK as needed on its own.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Reading the HFCLKSTAT register in our&amp;nbsp;test&amp;nbsp;example (similar to ble_app_uart) tells&amp;nbsp;that HFCLK is sourced from XTAL which is not the default, so some piece of SW is initializing it and I&amp;#39;m not able to find it because I don&amp;#39;t do the code you mentioned in our example.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Other important&amp;nbsp;things is, while all the above is during startup, what happens if the crystal faults during run time, what type of error would the softdevice return. We don&amp;#39;t use/call sd_radio_request in our example directly, is this something that SoftDevice software is using internally?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Santosh&amp;nbsp;Athuru&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/thread/224853?ContentTypeID=1</link><pubDate>Wed, 11 Dec 2019 08:00:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:351f31bf-6292-4608-adba-c7550dc3da45</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;1. In our examples, the init functions are set up to wait for the EVENTS_HFCLKSTARTED event to be set to indicate that the HFCLK has been started. If this doesn&amp;#39;t happen it will cause the timeout error I mentioned in A3 of the last reply. The application initializes the HFCLK like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Start 64 MHz crystal oscillator.
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    // Wait for the external oscillator to start up.
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0)
    {
        // Do nothing.
    }&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;2. Again, in our examples, we always make sure to start the external HFCLK before starting the radio, to prevent this from occurring. We make sure that HFXO is running before starting the SoftDevice and radio, which needs the HFXO to work.&lt;/p&gt;
&lt;p&gt;3. See the code snippet added above.&lt;/p&gt;
&lt;p&gt;4.&amp;nbsp;You set this request when you request a radio timeslot using the following function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;SVCALL(SD_RADIO_REQUEST, uint32_t, sd_radio_request(nrf_radio_request_t const * p_request));&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Read more about the timeslot requests in the&amp;nbsp;&lt;strong&gt;\...\&amp;lt;SDK_FOLDER&amp;gt;\components\softdevice\s132\headers\nrf_soc.h&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/thread/224786?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 16:23:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9b4ee419-2043-4446-912c-c9b253115aa1</guid><dc:creator>santosh athuru</dc:creator><description>&lt;p&gt;Hi Simon,&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/55424/hfclk-hfxo-failure-detection/224620"]1. The SoftDevice needs the HFXO for radio operations, so it will return an error if there&amp;#39;s something wrong with the HFXO crystal.[/quote]
&lt;p&gt;on #1&amp;gt; can you point to the error that will happen, how can an application catch this error for handling?&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/55424/hfclk-hfxo-failure-detection/224620"]2. You will not be able to run the radio using the HFINT, as it is not accurate enough. If you&amp;#39;re not using the SoftDevice, the application should be able to run on HFINT.[/quote]
&lt;p&gt;on #2&amp;gt; as per section 19.1, of nRF52832_PS_v1.4, HFINT will be used when HFCLK is requested and HFXO has not been started. Also few lines below the manual mentions that HFXO must be running to use the Radio. So this means there should be a specific error that gets triggered for the application to handle it - correct?&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/55424/hfclk-hfxo-failure-detection/224620"]3. I believe the HFCLK startup will time out and return a timeout error.[/quote]
&lt;p&gt;on #3&amp;gt; again how will the&amp;nbsp;application know about timeout error, especially for cases when HFXO goes missing during runtime, there should be an asynchronous (or call back) way of informing about the error to the application, what is this and where is this documented?&lt;/p&gt;
[quote userid="75734" url="~/f/nordic-q-a/55424/hfclk-hfxo-failure-detection/224620"]4. Please check out the &lt;strong&gt;\&amp;lt;SDK_LOCATION&amp;gt;\components\softdevice\s132\headers\nrf_soc.h&lt;/strong&gt; header file in your SDK. Here you can see that if p-request-&amp;gt;hfclk_force_xtal is true the HF clock is guaranteed to be clocked from the external crystal.[/quote]
&lt;p&gt;on #4&amp;gt; who or where in code, p-&amp;gt;request-&amp;gt;hfclk_force_xtal is being set?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;Santosh Kumar Athuru&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HFCLK (HFXO) failure detection</title><link>https://devzone.nordicsemi.com/thread/224620?ContentTypeID=1</link><pubDate>Tue, 10 Dec 2019 08:53:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78662e9c-6104-4555-9b01-2db8151953e7</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1. The SoftDevice needs the HFXO for radio operations, so it will return an error if there&amp;#39;s something wrong with the HFXO crystal.&lt;/p&gt;
&lt;p&gt;2. You will not be able to run the radio using the HFINT, as it is not accurate enough. If you&amp;#39;re not using the SoftDevice, the application should be able to run on HFINT.&lt;/p&gt;
&lt;p&gt;3. I believe the HFCLK startup will time out and return a timeout error.&lt;/p&gt;
&lt;p&gt;4. Please check out the &lt;strong&gt;\&amp;lt;SDK_LOCATION&amp;gt;\components\softdevice\s132\headers\nrf_soc.h&lt;/strong&gt; header file in your SDK. Here you can see that if p-request-&amp;gt;hfclk_force_xtal is true the HF clock is guaranteed to be clocked from the external crystal.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>