<?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>timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35230/timer-interrupts-nrf</link><description>//#define TRIGGER_INTERVAL 100 // ms int LED = 8; //int LED1 = 7; int i = 0; void timer_config(void) { NRF_TIMER0-&amp;gt;TASKS_STOP = 1; // Stop timer NRF_TIMER0-&amp;gt;MODE = TIMER_MODE_MODE_Timer; // taken from Nordic dev zone NRF_TIMER0-&amp;gt;BITMODE = (TIMER_BITMODE_BITMODE_24Bit</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Jun 2018 12:53:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35230/timer-interrupts-nrf" /><item><title>RE: timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/thread/136554?ContentTypeID=1</link><pubDate>Mon, 18 Jun 2018 12:53:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea0c008f-0df3-43a3-911e-ddebd88ece49</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;This code should work. I took your code and did a few trivial adaptations to be able to test it on the nRF52 DK. I expect it will work on any nRF5 device, though.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void TIMER0_IRQHandler()
{
    if (NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] != 0)
    {
        NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] = 0;
    }
}

void timer_config(void)
{
    NRF_TIMER0-&amp;gt;TASKS_STOP = 1; // Stop timer
    NRF_TIMER0-&amp;gt;MODE = TIMER_MODE_MODE_Timer; // taken from Nordic dev zone
    NRF_TIMER0-&amp;gt;BITMODE = (TIMER_BITMODE_BITMODE_24Bit &amp;lt;&amp;lt; TIMER_BITMODE_BITMODE_Pos);
    NRF_TIMER0-&amp;gt;PRESCALER = 8; // 1us resolution
    NRF_TIMER0-&amp;gt;TASKS_CLEAR = 1; // Clear timer
    NRF_TIMER0-&amp;gt;CC[0] = 62500;
    NRF_TIMER0-&amp;gt;INTENSET = TIMER_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE0_Pos; // taken from Nordic dev zone
    NRF_TIMER0-&amp;gt;SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE0_CLEAR_Pos);
    //attachInterrupt(TIMER1_IRQn, TIMER1_Interrupt); // also used in variant.cpp to configure the RTC1
    NVIC_EnableIRQ(TIMER0_IRQn);
    NRF_TIMER0-&amp;gt;TASKS_START = 1; // Start TIMER
}

void setup() 
{
    timer_config();
}

int main(void)
{
    setup();
    while (1);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The IRQ handler is called, verified by the breakpoint, as you can see from the screenshot.&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/resized-image/__size/320x0/__key/support-attachments/beef5d1b77644c448dabff31668f3a47-ceba60ceb12b4a21a5093108270baaa5/break_5F00_point_5F00_in_5F00_interrupt.PNG" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/thread/136375?ContentTypeID=1</link><pubDate>Fri, 15 Jun 2018 13:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a35d5498-78bd-48ce-8669-fe813a106f8f</guid><dc:creator>karthik999</dc:creator><description>&lt;p&gt;//#define TRIGGER_INTERVAL 100 // ms&lt;br /&gt;int LED = 8;&lt;br /&gt;//int LED1 = 7;&lt;br /&gt;int i = 0;&lt;br /&gt;void timer_config(void)&lt;br /&gt;{&lt;br /&gt; NRF_TIMER0-&amp;gt;TASKS_STOP = 1; // Stop timer&lt;br /&gt; NRF_TIMER0-&amp;gt;MODE = TIMER_MODE_MODE_Timer; // taken from Nordic dev zone&lt;br /&gt; NRF_TIMER0-&amp;gt;BITMODE = (TIMER_BITMODE_BITMODE_24Bit &amp;lt;&amp;lt; TIMER_BITMODE_BITMODE_Pos);&lt;br /&gt; NRF_TIMER0-&amp;gt;PRESCALER = 8; // 1us resolution&lt;br /&gt; NRF_TIMER0-&amp;gt;TASKS_CLEAR = 1; // Clear timer&lt;br /&gt; NRF_TIMER0-&amp;gt;CC[0] = 62500;&lt;br /&gt; NRF_TIMER0-&amp;gt;INTENSET = TIMER_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; TIMER_INTENSET_COMPARE0_Pos; // taken from Nordic dev zone&lt;br /&gt; NRF_TIMER0-&amp;gt;SHORTS = (TIMER_SHORTS_COMPARE0_CLEAR_Enabled &amp;lt;&amp;lt; TIMER_SHORTS_COMPARE0_CLEAR_Pos);&lt;br /&gt; //attachInterrupt(TIMER1_IRQn, TIMER1_Interrupt); // also used in variant.cpp to configure the RTC1&lt;br /&gt; NVIC_EnableIRQ(TIMER0_IRQn);&lt;br /&gt; NRF_TIMER0-&amp;gt;TASKS_START = 1; // Start TIMER&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void setup() {&lt;br /&gt; digitalWrite(LED, HIGH);&lt;br /&gt; delay(1000);&lt;br /&gt; timer_config();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void loop() {&lt;/p&gt;
&lt;p&gt;while (1);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void TIMER0_IRQHandler()&lt;br /&gt;{&lt;/p&gt;
&lt;p&gt;if (NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] != 0)&lt;br /&gt; {&lt;br /&gt; NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] = 0;&lt;br /&gt; digitalWrite(LED, LOW);&lt;br /&gt; }&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;I removed the delay.&lt;/p&gt;
&lt;p&gt;But i could not see any improvement. I am still not able to call&amp;nbsp;&lt;span&gt;TIMER0_IRQHandler().&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/thread/135662?ContentTypeID=1</link><pubDate>Tue, 12 Jun 2018 06:26:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:302025bd-f9a8-4c25-8277-a097a42dc359</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The simplest way to check if&amp;nbsp;&lt;code&gt;TIMER0_IRQHandler()&lt;/code&gt; is called is to put a breakpoint in the first lien of the function. If it is hit, that means that the interrupt mechanism works.&lt;/p&gt;
&lt;p&gt;Generally, this is also safer than toggling LEDs, as a common problem with using LEDs to debug is that if stuff happens too fast, you may not actually see the LED changing state. I see you allready have LED toggle mechanism there which I assume work (though I cannot see the implementation of your&amp;nbsp;&lt;code&gt;digitalWrite()&lt;/code&gt; function). As mentioned, you should not use the&amp;nbsp;&lt;code&gt;delay()&lt;/code&gt; function, which I assume is a busy wait. This will mess up your timing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/thread/135614?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 14:05:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:239b0406-3696-45df-9ed4-91e27d4b5e9a</guid><dc:creator>karthik999</dc:creator><description>&lt;p&gt;How to verify the&amp;nbsp;&lt;span&gt;TIMER0_IRQHandler()?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Or can you just post the code which could toggle the led for every 1second using interrupt?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: timer Interrupts nrf</title><link>https://devzone.nordicsemi.com/thread/135492?ContentTypeID=1</link><pubDate>Mon, 11 Jun 2018 07:34:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b24398e2-5aa4-476c-bb9d-e184444fbe67</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I do not see any problems with how you have configured the timer. Have you verified that &lt;code&gt;TIMER0_IRQHandler()&lt;/code&gt; is not called by placing a breakpoint at the start of the function? (Additionally, you may get problems missing interrupts if your&amp;nbsp;&lt;code&gt;delay(1000)&lt;/code&gt; call takes longer time than for the timer to count up to&amp;nbsp;62500 again).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>