<?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>manually start HFXO?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/81295/manually-start-hfxo</link><description>dear members, 
 how can I manually start hfxo from code? 
 thanks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 02 Nov 2021 07:49:36 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/81295/manually-start-hfxo" /><item><title>RE: manually start HFXO?</title><link>https://devzone.nordicsemi.com/thread/336980?ContentTypeID=1</link><pubDate>Tue, 02 Nov 2021 07:49:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd17e6c5-3bb5-44ea-b103-35e4e33dc71d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This depends a bit on which SDK you are using, and also which components from that SDK you are using.&lt;/p&gt;
&lt;p&gt;If for instance you are using the nRF5 SDK with a SoftDevice, then you need to either use the SoftDevice API directly and call&amp;nbsp;sd_clock_hfclk_request(). Alternatively, you can use the &lt;a href="https://infocenter.nordicsemi.com/topic/sdk_nrf5_v17.1.0/hardware_driver_clock.html"&gt;clock driver&lt;/a&gt;, which will do this for you. It will also handle multiple users so that if the clock is requested several time it will only be stopped after it has been released the same amount of times. That means that if you use other SDK&amp;nbsp;library that use the clock driver, you must also use the clock driver.&lt;/p&gt;
&lt;p&gt;If you do not use a SoftDevice, you can also use the clock driver, as it handles both cases. Alternatively, you can simply start the clock&amp;nbsp;directly like this:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&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;If you are using the nRF Connect SDK, you can start the HFXO as demonstrated by &lt;a href="https://github.com/nrfconnect/sdk-nrf/blob/v1.7.0/samples/bluetooth/direct_test_mode/src/dtm.c#L497-L527"&gt;clock_init() here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>