<?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>Suddenly app_timer events trigger instantly</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9433/suddenly-app_timer-events-trigger-instantly</link><description>Ok, so I&amp;#39;ve been trying to get to the bottom of a problem for a few days now where suddenly the app_timer is acting like it&amp;#39;s on crack and running super fast, i.e. triggering events instantly. 
 prescaler=0, no scheduler, sd initalized with SOFTDEVICE_HANDLER_INIT</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 28 Sep 2015 22:47:59 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9433/suddenly-app_timer-events-trigger-instantly" /><item><title>RE: Suddenly app_timer events trigger instantly</title><link>https://devzone.nordicsemi.com/thread/34819?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2015 22:47:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95a4b821-8e1b-4d90-a0aa-cd2a0cdaa287</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I think I &amp;#39;fixed&amp;#39; this by creating a dummy timer as in this post here:
&lt;a href="https://devzone.nordicsemi.com/question/12047/timer-handler-called-immediately-on-app_timer_start/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;So far no more glitches (crosses fingers...).&lt;/p&gt;
&lt;p&gt;In that post, Håkon Alseth, alludes that this should not be needed post SDK6.1, but I am on 8.0.0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suddenly app_timer events trigger instantly</title><link>https://devzone.nordicsemi.com/thread/34818?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 07:54:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:55217375-50e4-4d1a-8d8b-c0c997f349d4</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Ah - yes does help to know what you&amp;#39;ve tried, if that didn&amp;#39;t work for you then it looks like a different bug. I meant that in this case you should, instead of the delay, set the counter to that value ( pre_counter_val - 1 ) &amp;amp; 0xffffff, I guess it would be something like&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;rtc1_compare0_set( ( pre_counter_val - 1 ) &amp;amp; 0xffffff );
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;it goes in the same if() block where timer_timeouts_check_sched() is called, before or after, shouln&amp;#39;t matter.&lt;/p&gt;
&lt;p&gt;The idea behind the nrf_delay( 100 ) fix is to ensure that the counter event has definitely fired before you return, which means it won&amp;#39;t fire during the RTC1 interrupt handler. The idea behind the other fix is to set the counter to a value way in the future, so if it hasn&amp;#39;t fired already, it won&amp;#39;t fire until long after the interrupt handler has finished. Having the RTC1 compare occur during the RTC1 interrupt is the race condition.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suddenly app_timer events trigger instantly</title><link>https://devzone.nordicsemi.com/thread/34817?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 07:26:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d9a3f20d-8366-4486-9a54-07cb9e640a83</guid><dc:creator>Chris</dc:creator><description>&lt;p&gt;I should have mentioned that I already implemented the &amp;quot;nrf_delay_us(100);&amp;quot; &amp;#39;fix&amp;#39; from that thread, but I thought it was something else since it sounded like one misfire, whereas mine is misfiring continuously. I would like to try your solution, but I don&amp;#39;t completely understand how to implement it. Do you mean to put &amp;quot;pre_counter_val = (pre_counter_val-1) &amp;amp; 0xffffff;&amp;quot; instead of &amp;quot;nrf_delay_us(100);&amp;quot;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Suddenly app_timer events trigger instantly</title><link>https://devzone.nordicsemi.com/thread/34816?ContentTypeID=1</link><pubDate>Fri, 25 Sep 2015 06:48:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a20cec4-1429-4840-a586-26e401bb5998</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Read all the comments at the end of &lt;a href="https://devzone.nordicsemi.com/question/50059/bug-one-shot-app_timer-misfires-at-256-seconds/?comment=50471#comment-50471"&gt;devzone.nordicsemi.com/.../&lt;/a&gt; that question which talks about a race condition which causes events to trigger instantly and discusses two potential fixes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>