<?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>interrupt on HFCLKSTARTED problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/6988/interrupt-on-hfclkstarted-problem</link><description>Hi, I have a problem with the HFCLKSTARTED interrupt. 
 I can&amp;#39;t have it. (I&amp;#39;m a little bit pressed with time I have to send a document in 2 days, so if you can quick respond to my 2 simple questionS first, and maybe later have a look for the rest you</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 08 Jul 2015 12:34:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/6988/interrupt-on-hfclkstarted-problem" /><item><title>RE: interrupt on HFCLKSTARTED problem</title><link>https://devzone.nordicsemi.com/thread/24644?ContentTypeID=1</link><pubDate>Wed, 08 Jul 2015 12:34:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0060a3bc-5fd2-40e6-a16b-d5f32d9ee939</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi bibi,
Can you please update this thread with your status&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: interrupt on HFCLKSTARTED problem</title><link>https://devzone.nordicsemi.com/thread/24643?ContentTypeID=1</link><pubDate>Tue, 12 May 2015 05:57:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aa224939-4a1e-4bae-a876-d31a84884904</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi bibi,&lt;/p&gt;
&lt;p&gt;you are right, you do not need to wait, so i updated the program to remove the while loop.&lt;/p&gt;
&lt;p&gt;your program did not clear the event NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0; in HFCLK_IRQ, I think that is important to do.&lt;/p&gt;
&lt;p&gt;HFCLK STARTED event will only happen if the clock circuit has detected an external clock signal coming into the chip. Are you sure that your XTAL oscillator is connected and working properly?&lt;/p&gt;
&lt;p&gt;Rest of your program logic looks good to me (except that i cannot see what initAll() does)&lt;/p&gt;
&lt;p&gt;Are you working on a Nordic DK or a custom board? which SDK and SD?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: interrupt on HFCLKSTARTED problem</title><link>https://devzone.nordicsemi.com/thread/24642?ContentTypeID=1</link><pubDate>Mon, 11 May 2015 19:30:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:15ce8766-c622-4824-9265-18e938ed908f</guid><dc:creator>bibi</dc:creator><description>&lt;p&gt;hello Aryan, thank you for your quick response.&lt;/p&gt;
&lt;p&gt;so yes the POWER_CLOCK_IRQn is enabled using NVIC.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using external 16MHz crystal oscillator for HFCLK and external 32,768KHz crystal oscillator for LFCLK.&lt;/p&gt;
&lt;p&gt;Something I haven&amp;#39;t anderstand in your code is why do you make&lt;code&gt;while(NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED != 1);&lt;/code&gt;in the rtc_IRQ ? this is to wait the HFCLK crystal to be ready, right ?&lt;/p&gt;
&lt;p&gt;because I make my program to sleep during the ramping up of the HF crystal.&lt;/p&gt;
&lt;p&gt;in the rtc_IRQ I just want to start the HF crystal but I don&amp;#39;t want to wait until it is ready. After HF crystal is started, I want to sleep and to be waking up when the HF crystal is ready. So to be waking up by the HFclock_IRQ.&lt;/p&gt;
&lt;p&gt;RTC_irq job&amp;#39;s to start HFclock and HFclk_irq job&amp;#39;s to do something where the HFcrystal is available like sending data by radio.&lt;/p&gt;
&lt;p&gt;I make a little diagram to tell you more explicitly what I would like to do. (the HFclk_irq is a little bit longer than RTC because we send a data)&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;RTC_irq                                                 *
HFclk_irq                                                               ***


Awake                                                   *               ***
Sleeping             *********************************** ***************   ****************


HFcrystal_ready                                                         ***
Hfcrystal_ramping_up                                     ***************
LFcrystal_ready      ********************************************************************** ---&amp;gt; [t]
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;THANKS YOU VERY MUCH FOR YOUR ANSWERS, YOU ARE A VERY GOOD TEAM =)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: interrupt on HFCLKSTARTED problem</title><link>https://devzone.nordicsemi.com/thread/24641?ContentTypeID=1</link><pubDate>Mon, 11 May 2015 10:41:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b106f9f-c807-4e37-a92d-adff65a57426</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi bibi,
I need to ask you if you are using external crystal oscillator?
You cannot control HFCLK RC oscillator. The system manages it automatically.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;NVIC_EnableIRQ(POWER_CLOCK_IRQn); // do this in main

rtc_IRQ(void)
{
     NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;       // clear clock event
     NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;          // start HFclock

     HF_Clk_Stay_On_To_Sleep = true;
     NRF_RTC0-&amp;gt;TASKS_CLEAR = 1UL;              // clear RTC event
     NRF_RTC0-&amp;gt;EVENTS_COMPARE[0] = 0;          // clear RTC event
 }

HFclock_IRQ(void)
{
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;       // clear clock event
    HF_Clk_Stay_On_To_Sleep = false;
    Radio_Send_Data();     // send a data by radio
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;After __wfe() the RC clock will be automatically shutdown if no other peripherals require HF RC.&lt;/p&gt;
&lt;p&gt;I think the problem that you face is that you are not clearing the event in HFclock interrupt.
The modified code above work. Have you enabled the interrupt by the way using &lt;code&gt;NVIC_EnableIRQ(POWER_CLOCK_IRQn);&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>