<?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 not correct？</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/15141/timer-not-correct</link><description>Now，I use a 1s timer to calculate the clock.
At first,I use the telephone to adjust the time to fit the telephone time.
but finally(after a night ) the result runs fastly compared with the telephone.
For example,the telephone time is 8:40,but the devices</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Jul 2016 12:22:15 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/15141/timer-not-correct" /><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57806?ContentTypeID=1</link><pubDate>Wed, 27 Jul 2016 12:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04273468-bcfe-47e3-9d91-42a3fafd7e5f</guid><dc:creator>Milk</dc:creator><description>&lt;p&gt;I changed the APP_TIMER_PRESCALER from 0 to 4.After someday&amp;#39;s testing,the clock time is steady,but
not always the same.At one morning,I found a device&amp;#39;s clock time slowed eight minutes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57805?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2016 08:44:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f3b25ee4-7d6d-4989-ac2d-9d05bfd24276</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Did you fix it (since you accepted the answer)?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57804?ContentTypeID=1</link><pubDate>Wed, 20 Jul 2016 06:51:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:02bc7264-abdb-46ba-b284-b7bde4547ef0</guid><dc:creator>Milk</dc:creator><description>&lt;p&gt;I have created other timers.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void timers_init()
{
 APP_TIMER_INIT(APP_TIMER_PRESCALER,APP_TIMER_MAX_TIMERS,APP_TIMER_OP_QUEUE_SIZE,false);
err_code = app_timer_create(&amp;amp;m_sec_req_timer_id,APP_TIMER_MODE_SINGLE_SHOT,sec_req_timeout_handler);//for ancs

err_code = app_timer_create(&amp;amp;m_clock_timer_id,APP_TIMER_MODE_REPEATED,clock_meas_timeout_handler);//for clock timer ------1s


app_timer_create(&amp;amp;m_acc_timer_id,APP_TIMER_MODE_REPEATED,acc_meas_timeout_handler);//for acc timer------20ms

app_timer_create(&amp;amp;m_pulse_timer_id,APP_TIMER_MODE_REPEATED,pulse_meas_timeout_handler);//for acc timer------25ms

app_timer_create(&amp;amp;m_sec_timer_id,APP_TIMER_MODE_REPEATED,sec_meas_timeout_handler);//for some timer things-----1s

app_timer_create(&amp;amp;m_button_timer_id,APP_TIMER_MODE_REPEATED,button_meas_timeout_handler);//for button events----100ms
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57803?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2016 14:31:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28dd9953-c1ff-4c9f-b218-b3b4326f8d59</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I understand that you can&amp;#39;t just run the clock timer in a project, I only try to figure out why it does not work.&lt;/p&gt;
&lt;p&gt;It may be best if you let me see the code so I can see what is going on and try to reproduce it here. If you don&amp;#39;t want to share it on Devzone you can open a case on &lt;a href="https://www.nordicsemi.com/eng/nordic/mypage"&gt;mypage&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;You can use PPI to generate the clock timer, but in combination with the app_timer this will be hard.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57800?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2016 11:52:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffa614ca-3a5b-4913-b44a-c2dd4979e346</guid><dc:creator>Milk</dc:creator><description>&lt;p&gt;I have try with just the clock timer,after one hour,there are no drift.But I can&amp;#39;t just run the clock timer in a project.I have a question,how to use ppi to generate the clock timer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57801?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2016 08:18:11 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6d386105-8c26-4be2-a3c6-4d7df44a5ac1</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;Can you try with just the clock timer?&lt;/p&gt;
&lt;p&gt;After 23 hours I see only 2-3 seconds drift, so still within spec.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57799?ContentTypeID=1</link><pubDate>Tue, 19 Jul 2016 01:57:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:768c00c6-29a8-45ea-b4f9-7139c9e2cb38</guid><dc:creator>Milk</dc:creator><description>&lt;p&gt;Except the clock timer,I have defined other five timers,&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define APP_TIMER_MAX_TIMERS    (6+BSP_APP_TIMERS_NUMBER+2)
#define APP_TIMER_OP_QUEUE_SIZE  (6+BSP_TIMERS_NUMBER+2)
#define APP_TIMER_PRESCALER       4
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have tested the code by using the DK,meanwhile using our custom hardware,the result is the same.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57802?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2016 15:39:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e3a5d65-80f9-4236-8998-cf7b63555d14</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I have tested for 6 hours now and the drift is under 1 second.&lt;/p&gt;
&lt;p&gt;Could you only run the timer code (no BLE or other application code) and see if the timing still is incorrect? Are you using the DK or some custom hardware?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57798?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2016 10:29:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e037915-dc24-45f5-bea5-c0e12cfe0bf5</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;I don&amp;#39;t see the minutes conversion.&lt;/p&gt;
&lt;p&gt;I can test it on monday to see if I get the same error.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57797?ContentTypeID=1</link><pubDate>Fri, 15 Jul 2016 07:01:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0d1006-a737-4588-b244-723e6253af82</guid><dc:creator>Milk</dc:creator><description>&lt;p&gt;Hello,Ole Bauck&lt;/p&gt;
&lt;p&gt;My Function of clock_process() is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void clock_timer_process(ClkTime_t *p_time)

{
   p_time -&amp;gt; seconds++;

  if(60&amp;lt;= p_time-&amp;gt;seconds)

  {
    p_time-&amp;gt;seconds = 0x00;
    p_time-&amp;gt;minutes++;
    if(24&amp;lt;= p_time-&amp;gt;hour)
    {
      p_time -&amp;gt;hour = 0x00;
      p_tiime -&amp;gt;day++;
      ....
    }
  }


}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer not correct？</title><link>https://devzone.nordicsemi.com/thread/57796?ContentTypeID=1</link><pubDate>Thu, 14 Jul 2016 13:59:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd513643-602a-4213-b99e-d3877a11176b</guid><dc:creator>Ole Bauck</dc:creator><description>&lt;p&gt;The maximum drift over 12 hours using xtal with 20ppm should be 12x60x60*20/1000000 ~= 1 second, which is way lower than what you measure. You are sure it is not caused by the conversion, for example round off errors, overflow or that you for example count 61 seconds in a minute instead of 60?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>