<?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>How do I properly setup my Timer2 to make it fire off every 5 secs?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/28896/how-do-i-properly-setup-my-timer2-to-make-it-fire-off-every-5-secs</link><description>Hello, the title is pretty descriptive. 
 I&amp;#39;ve tried to read through previous questions and got a rough idea but decided that it would cost too much time for me to explore everything on my own so here I am asking this question. 
 I copied pretty much</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 05 Jan 2018 07:42:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/28896/how-do-i-properly-setup-my-timer2-to-make-it-fire-off-every-5-secs" /><item><title>RE: How do I properly setup my Timer2 to make it fire off every 5 secs?</title><link>https://devzone.nordicsemi.com/thread/114363?ContentTypeID=1</link><pubDate>Fri, 05 Jan 2018 07:42:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9bee8e6-9ea1-4d64-9f8c-ea7291ebaee4</guid><dc:creator>Mitch996</dc:creator><description>&lt;p&gt;No inconvenience at all! Haha.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I properly setup my Timer2 to make it fire off every 5 secs?</title><link>https://devzone.nordicsemi.com/thread/114362?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2018 07:42:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:363b5869-cf47-4912-9825-ac47db18bcd2</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;There is some delays as many people have been away for the holidays. Hopefully this will normalize quite soon. Sorry for the inconvenience.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I properly setup my Timer2 to make it fire off every 5 secs?</title><link>https://devzone.nordicsemi.com/thread/114361?ContentTypeID=1</link><pubDate>Thu, 04 Jan 2018 01:51:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26275744-3dd0-40b6-917e-8f74a807dad8</guid><dc:creator>Mitch996</dc:creator><description>&lt;p&gt;That&amp;#39;s exactly the answer! Thank you!&lt;/p&gt;
&lt;p&gt;Also, the answers seem to be kind of slow these days... what is going on? People are busy?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How do I properly setup my Timer2 to make it fire off every 5 secs?</title><link>https://devzone.nordicsemi.com/thread/114360?ContentTypeID=1</link><pubDate>Wed, 03 Jan 2018 13:08:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bf272df-a0ac-4384-bbaa-118a9eb22e01</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Is this on nRF51 series? Note that TIMER1/2 on nRF51 series is &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51822_PS_v3.3.pdf#page=33"&gt;only 16-bit timers&lt;/a&gt;. If you run the timer at maximum frequency, the timer will overflow after ~4 ms:&lt;/p&gt;
&lt;p&gt;(1/16 MHz)*(2^16) = 4.096 ms&lt;/p&gt;
&lt;p&gt;You need to change the prescaler, to slow down the timer. Unfortunately, &lt;a href="http://infocenter.nordicsemi.com/pdf/nRF51_RM_v3.0.1.pdf#page=102"&gt;the maximum prescaler value is 9&lt;/a&gt;, which will make the timer overflow at ~2 seconds:&lt;/p&gt;
&lt;p&gt;(1/(16 MHz/(2^9))) * (2^16) = 2.097152 s&lt;/p&gt;
&lt;p&gt;This means you can&amp;#39;t achieve your desired 5 seconds using TIMER2 (on nRF51).&lt;/p&gt;
&lt;p&gt;Anyway, I would recommend that you use RTC for such long timing, it runs on LF clock and will consume less current. See &lt;a href="https://devzone.nordicsemi.com/question/72753/clocks-timers-rtc-why/?answer=72870#post-id-72870"&gt;this post&lt;/a&gt; about difference between timers and RTC.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>