<?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</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1610/timer-interrupts</link><description>I&amp;#39;m using RFduino that utilizes nRF51822. I need to set a timer1 as timer0 is used by the BLE stack, so I used the following code: 
 
#define TRIGGER_INTERVAL 1000 // ms

void timer_config(void)
{
 NRF_TIMER1-&amp;gt;TASKS_STOP = 1;	// Stop timer
 NRF_TIMER1</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Jun 2018 14:00:47 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1610/timer-interrupts" /><item><title>RE: Timer interrupts</title><link>https://devzone.nordicsemi.com/thread/135384?ContentTypeID=1</link><pubDate>Fri, 08 Jun 2018 14:00:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3af86f1c-0cd1-4bef-9773-801c84ceb679</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;// digitalWrite(LED, HIGH);&lt;br /&gt;// delay(3000);&lt;br /&gt;// &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void setup() {&lt;br /&gt; Serial.begin(115200);&lt;br /&gt; pinMode(LED,OUTPUT);&lt;br /&gt; digitalWrite(LED, LOW);&lt;br /&gt; delay(3000);&lt;br /&gt; timer_config();&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void loop() {&lt;br /&gt;// digitalWrite(LED, LOW);&lt;br /&gt;// delay(1000);&lt;br /&gt;// digitalWrite(LED, HIGH);&lt;br /&gt;// delay(1000);&lt;br /&gt;// //digitalWrite(LED, HIGH);&lt;br /&gt;// //digitalWrite(LED, HIGH);&lt;br /&gt; &lt;br /&gt; //while(1);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;void TIMER0_IRQHandler()&lt;br /&gt;{&lt;br /&gt;// digitalWrite(LED, LOW);&lt;br /&gt;// delay(1000);&lt;br /&gt;// digitalWrite(LED, HIGH);&lt;br /&gt;// delay(1000);&lt;br /&gt; if (NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] != 0)&lt;br /&gt; {&lt;br /&gt; //Serial.println(&amp;quot;Timer interrupt called&amp;quot;);&lt;br /&gt; NRF_TIMER0-&amp;gt;EVENTS_COMPARE[0] = 0;&lt;br /&gt; int i = i+1;&lt;br /&gt; if(i%2 == 0)&lt;br /&gt; {&lt;br /&gt; digitalWrite(LED, LOW);&lt;br /&gt; delay(1000);&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt; digitalWrite(LED, HIGH );&lt;br /&gt; delay(1000);&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; }&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Hey this is my code for blinking an led using timer interrupt on nrf 52832board, there are no errors in the code but the code is not working as desired. The function TIMER_IRQHandler is not called during an interrupt.&lt;/p&gt;
&lt;p&gt;can someone please help me to tackle this problem?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer interrupts</title><link>https://devzone.nordicsemi.com/thread/7093?ContentTypeID=1</link><pubDate>Wed, 19 Feb 2014 20:11:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:88f2cf81-dede-47c9-be95-c2443283e024</guid><dc:creator>aabb</dc:creator><description>&lt;p&gt;Thanks All,
I got an answer from the RFduino team. The Timer1 is 16bit and regardless of the BITMODE the CC[0] cannot exceed 16 bit value (2^16=65536), so to obtain a 1sec timer it&amp;#39;s necessary to use another PRESCALER value and a compatible CC[0] one.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer interrupts</title><link>https://devzone.nordicsemi.com/thread/7092?ContentTypeID=1</link><pubDate>Tue, 18 Feb 2014 12:39:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ec17620-adb9-4df0-b78c-7c2c37dd7e68</guid><dc:creator>Ole Morten</dc:creator><description>&lt;p&gt;I don&amp;#39;t currently have access to an RFDuino, but when rewriting this code as a regular nRF51 project, this seems to work correctly. I&amp;#39;ve attached the main.c I used.&lt;/p&gt;
&lt;p&gt;I therefore think you&amp;#39;re better off asking this question on the RFDuino forums or similar. Sorry for not being able to give you better help.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/1362.main.c"&gt;main.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer interrupts</title><link>https://devzone.nordicsemi.com/thread/7091?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2014 21:56:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e85ec0b2-7bf2-4b14-8031-744e08f0e17e</guid><dc:creator>RS</dc:creator><description>&lt;p&gt;According to the PS, Timer1 is 8/16 bits, so you should try to change BITMODE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>