<?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>nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29565/nrf51822-timer-1-and-timer-2</link><description>In timer example in sdk 11, I replace the Timer 0 by timer 1 and timer 2 but the LED did not blink. Can you guys please guide me through this? In nrf_drv_config.h I have already replace: 
 #define TIMER1_ENABLED 0 
#define TIMER2_ENABLED 0
 
 by </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 10 Feb 2018 09:26:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29565/nrf51822-timer-1-and-timer-2" /><item><title>RE: nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/thread/120468?ContentTypeID=1</link><pubDate>Sat, 10 Feb 2018 09:26:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45f49fbb-f2cf-4398-8ed0-cd64d8e6f61c</guid><dc:creator>Hust</dc:creator><description>&lt;p&gt;Thank you for your support. It works now&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/thread/117522?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2018 15:17:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d1bb18c-4dcc-476b-b798-bd1d93abe761</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;In your comment I think you made a typo, the SD&amp;#39;s use Timer0 and RTC0. 1 and above are available for both types of timers.&lt;/p&gt;
&lt;p&gt;You can easily use one timer for multiple things it just involves more code and ISR&amp;#39;s. A good example of this is the app_timer.
And if you are creating a lot of timers, app_timer is a good resource.  Though since it makes use of a lot of ISR&amp;#39;s to accomplish what it does, latency can be long and jittery. So, don&amp;#39;t expect millisecond accuracy, maybe 10 msec accuracy instead.&lt;/p&gt;
&lt;p&gt;You can find it used in most examples.  The beacon example uses it for led&amp;#39;s.  Here is the documentation: &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v10.0.0%2Fgroup__app__timer.html&amp;amp;resultof=%22%61%70%70%5f%74%69%6d%65%72%22%20"&gt;infocenter.nordicsemi.com/index.jsp&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/thread/117525?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2018 01:52:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3797d9e5-a3bc-4e69-a426-219dbb4c2f48</guid><dc:creator>Hust</dc:creator><description>&lt;p&gt;Actually I had a project which use SD, and SD use 1 RTC and 1 Timer already. Therefore, I have only 1 RTC and 2 timers left. I have already use 1 RTC for another function and I want to use Timer 1 and Timer 2 for other tasks. They just count the time and run into interrupts, where I put my function into. Therefore, I want to ask if I can use 3 timers (1 RTC and 2 Timers) in parallel in SD and how to make it works?
Thank you for your kind support.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/thread/117524?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 21:14:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94fdf7d4-85f9-45f0-a4be-194098934f84</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;Here is some other code that that turns on the LED for 50msec. It uses the RTC and a ISR handler. The timer is one shot. LED_MASK is just whatever bit pattern you need to write to turn on your leds. You just call flash led to make it work. The RTC timers don&amp;#39;t have the shorts that let you turn the HF_CLK timers into an astable device.  But you can easily use the other CC registers for your entire on/off cycle.  So timer clear turns on led, cc0 turns off led, cc1 reset timer and process repeats.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void RTC1_IRQHandler (void)
{
	
	NRF_RTC1-&amp;gt;TASKS_CLEAR = 1;
	NRF_RTC1-&amp;gt;TASKS_STOP =1;
    NRF_RTC1-&amp;gt;EVENTS_COMPARE[0] = 0;
	NRF_GPIO-&amp;gt;OUTSET = (LED_MASK);
			                     

	
}
void flash_led  (void)
{
	NRF_GPIO-&amp;gt;OUTCLR = (LED_MASK);
	NRF_RTC1-&amp;gt;TASKS_STOP        = 1;                      // Stop timer, if it was running
    NRF_RTC1-&amp;gt;TASKS_CLEAR       = 1;
	NRF_RTC1-&amp;gt;PRESCALER = 31;
	NRF_RTC1-&amp;gt;CC[0] = 50;
		
		
	NRF_RTC1-&amp;gt;EVTENSET = RTC_EVTEN_COMPARE0_Msk;
	NRF_RTC1-&amp;gt;INTENSET = RTC_INTENSET_COMPARE0_Msk;
				
	NVIC_ClearPendingIRQ(RTC1_IRQn);
	NVIC_EnableIRQ(RTC1_IRQn);
	NRF_RTC1-&amp;gt;TASKS_START = 1;	
	
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf51822 TIMER 1 and TIMER 2</title><link>https://devzone.nordicsemi.com/thread/117523?ContentTypeID=1</link><pubDate>Thu, 18 Jan 2018 20:58:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b1ac330-eaea-400a-a3fd-0ddf17431b3b</guid><dc:creator>AmbystomaLabs</dc:creator><description>&lt;p&gt;I can&amp;#39;t guide you on the timer driver since I normally avoid the drivers in firmware apps unless absolutely required, but here is a link to some code I did recently that did two HF_CLK timers on gpiote for nRF52.  Logic is the same for RTC timers except the prefix for the registers is NRF_RTC1, 2, etc. As the user pointed out nRF51 didn&amp;#39;t have the TEP Fork which I had used.   But they got it working anyway.&lt;/p&gt;
&lt;p&gt;The example writes gpio via gpiote, but you can easily use the events to drive ISR handlers instead:
&lt;a href="https://devzone.nordicsemi.com/question/186804/how-to-use-multiple-timers/?comment=187487#comment-187487"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>