<?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 value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2519/timer-value-not-accurate-using-app_timer-c-in-nrf51822</link><description>Hi All 
 I am facing one issue using app_timer.c, When I put the PRESCALER value as 327 and started timer as app_timer_start(timer_ID, 100, NULL);, It was giving only 920ms instead of 1s? why is this so? 
 Here is my code 
 #include &amp;lt;stdint.h&amp;gt;
#include</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 15 May 2014 11:03:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2519/timer-value-not-accurate-using-app_timer-c-in-nrf51822" /><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10085?ContentTypeID=1</link><pubDate>Thu, 15 May 2014 11:03:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0beed2d-a9b5-432d-85d6-ea6e99b52eaf</guid><dc:creator>Mo A</dc:creator><description>&lt;p&gt;Great ,  Its working, Thank you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10084?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 18:39:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53571246-0317-4b9a-9f77-fddc43f49592</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;If you are using a development board of sorts, it will most likely have crystals for both LF and HF clock. Then adding a line specifying the clock source for LFCLK will make it use the crystal oscillator. The code snippet would be (edited, source must be specified before starting):&lt;/p&gt;
&lt;p&gt;NRF_CLOCK-&amp;gt;LFCLKSRC = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10083?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 14:18:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f9d1818-cc72-45d5-b71a-f1ec9842cd06</guid><dc:creator>Mo A</dc:creator><description>&lt;p&gt;How can I know that?, or should I explicitly enable the crystal in my code. ?(Sorry  Prithvi, as I am new to this)&lt;/p&gt;
&lt;p&gt;Mo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10082?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 14:02:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dfa0203d-a909-475d-94e7-2eb15506c296</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;Are (can) you using a crystal for either of the clocks?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10081?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 13:59:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ca9d67e3-e099-438d-8e61-807902ff6561</guid><dc:creator>Mo A</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am measuring this using CRO, (as in the code the pin 4 is used as gpio o/p).&lt;/p&gt;
&lt;p&gt;And yes, 920ms is too low, I hope my code is not wrong (not using softdevice)&lt;/p&gt;
&lt;p&gt;Any way?&lt;/p&gt;
&lt;p&gt;Mo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10080?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 13:32:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3de3816f-6931-4612-a56e-129fcccc2250</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;I guess you are using the RC oscillator for the LF clock, this will result in inaccuracy. Could you use a crystal? Either a 32.768 kHz one for LFCLK or 16MHz one for HFCLK so that you can synthesize the LFCLK. If you have a 16 MHz crystal, you could also calibrate the RC oscillator of LFCLK.
Even if you are using RC oscillator for LF CLK, 920 ms is way off. How are you measuring this?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10079?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 13:13:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8d6e0093-8e1d-4dc9-aa77-ad975e03638c</guid><dc:creator>Mo A</dc:creator><description>&lt;p&gt;Hi Prithvi,&lt;/p&gt;
&lt;p&gt;Still It is 920 ms. Why is this so? Any hardware issues?&lt;/p&gt;
&lt;p&gt;Mo,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer value not accurate using app_timer.c in nRF51822?</title><link>https://devzone.nordicsemi.com/thread/10078?ContentTypeID=1</link><pubDate>Wed, 14 May 2014 12:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c20376a9-862d-47bd-a665-84a1e727905c</guid><dc:creator>FormerMember</dc:creator><description>&lt;p&gt;The basis of using a 32.768kHz frequency for RTC is that it is a power of 2. So, having a PRESCALAR of  255 and waiting for 128 ticks would result in accurate 1s interval.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>