<?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 handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/2638/timer-handler-called-immediately-on-app_timer_start</link><description>On an nRF51822 without the Soft Device, I use the app timers in a driver for a GPS module that uses the UART. Each time I start reading from the UART, I also start a timer with a timeout of 2 seconds. When the timer handler is called, I set a bool to</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 24 Sep 2015 06:15:43 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/2638/timer-handler-called-immediately-on-app_timer_start" /><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10408?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 06:15:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:48be44d6-8d2d-4531-998d-a74c51b6d53b</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Ok, I will check.&lt;/p&gt;
&lt;p&gt;Please let me know, which &amp;quot;timeout_handler&amp;quot;, I have to use...i mean, in which file, i hv to check for this handler..?&lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10407?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 06:12:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4808acb0-bd71-4036-a290-2d7d4c7ce9c4</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;There are many examples, both on the Github and in the SDK for this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10406?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 05:36:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3c376e18-2d5f-49c6-a95b-954077424f11</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Hello @Dave_couling,&lt;/p&gt;
&lt;p&gt;you suggested:&lt;/p&gt;
&lt;p&gt;[In that case I would use a REPEATING timer. In the timeout handler increment a global variable to track the number of times it has timed out. If you set the timer to 1sec timeout, then the counting variable in effect counts the seconds. In the button is released simply stop the timer].&lt;/p&gt;
&lt;p&gt;sir, I am sorry, I am a newbie to this;  could you please suggest some example code steps for this implementation~  please.&lt;/p&gt;
&lt;p&gt;Thanks n Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10405?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 05:22:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:928d0973-0905-4f78-96ca-968708075c60</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Hi @Dave_couling,&lt;/p&gt;
&lt;p&gt;Thanks for your reply~&lt;/p&gt;
&lt;p&gt;well,I am following [--nrf51-ble-app-lbs--] example. In this the button_detection_delay is using in a handler for short_button_push (1s) and I want to use the same handler for long_button_push (3s)........&lt;/p&gt;
&lt;p&gt;static void button_event_handler(uint8_t pin_no, uint8_t button_action)&lt;/p&gt;
&lt;p&gt;err_code = ble_lbs_on_button_change(&amp;amp;m_lbs, button_action);&lt;/p&gt;
&lt;p&gt;Do I need to create new timer to handle the same handler again.&lt;/p&gt;
&lt;p&gt;Please suggest~&lt;/p&gt;
&lt;p&gt;Thanks n Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10404?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 05:05:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5bcba842-3615-42dc-b740-c97eff30861e</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;use an app_timer created as a APP_TIMER_MODE_SINGLE_SHOT&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10403?ContentTypeID=1</link><pubDate>Thu, 24 Sep 2015 04:46:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2a3d41a4-46e8-45a9-8918-b2ec60d0f971</guid><dc:creator>HSA</dc:creator><description>&lt;p&gt;Hi @Håkon Alseth&lt;/p&gt;
&lt;p&gt;I want my timer to work only for one time; How can I implement that in code?&lt;/p&gt;
&lt;p&gt;Please suggest.&lt;/p&gt;
&lt;p&gt;Thanks n Regards&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10400?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2015 19:18:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b6d7664a-7079-41a4-80cf-f6692492537f</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;Hi Hakon,  I will try this. Also note that as a general rule in my application I always stop an app_timer before starting it, to assure any timer is started fresh if already running.  Could this increase the likelihood of this issue?&lt;/p&gt;
&lt;p&gt;I have been able to recreate my issue but hard-coding rtc1_stop() and rtc_start() from app_timer.c in the Button_handler at a Button push.   Normally a button push causes a button_timer to run to measure how long the button is held.   At specific intervals of this timer I schedule events.  After a specific amount of time the device is shutoff System_off via a scheduled event.   However adding the above code causes an immediate shutdown and seems to crash/overflow the scheduler???&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10402?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2015 09:21:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:98f1f6aa-f0c8-4bb8-8b10-e53441047da1</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Dave, This should have been fixed in the later version of the app_timer. Here&amp;#39;s the link to our SDKs:
&lt;a href="http://developer.nordicsemi.com/nRF51_SDK/"&gt;developer.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Could you try to use app_timer from a later SDK than v6 and see if the issue still occurs?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10401?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2015 04:27:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0faef241-d915-46ff-a61b-132975f0aa61</guid><dc:creator>Dave_couling</dc:creator><description>&lt;p&gt;I have seen this bug in SDK 6.1.   Has there been any progress on this issue?&lt;/p&gt;
&lt;p&gt;Similar situation we have timer that works 99.99% of the time.  However seemingly at random the handler will be called immediately rather than run for 8 seconds.  Causing havoc for our application logic.   We are also using the Scheduler for our app_timers&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10399?ContentTypeID=1</link><pubDate>Thu, 03 Jul 2014 21:46:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:eebba001-63c6-46cc-9692-43620ec48850</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;No problem, I can leave the dummy handler in. Might be worth a docs change to mention it&amp;#39;s required though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10398?ContentTypeID=1</link><pubDate>Thu, 03 Jul 2014 07:38:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b09b60c-5a0f-4700-8273-863f7b357bea</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Unfortunately, this is a side effect of the bug fixes in the last revisions. If we do not clear the COUNTER register in the case that one-shot timer is the only one running and this one times out, we stop the RTC and clear the COUNTER after this instance has timed out, as no other instances are using the app_timer library.&lt;/p&gt;
&lt;p&gt;In order to use the COUNTER register for timestamping, you will have to have at least one app_timer instance always running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10397?ContentTypeID=1</link><pubDate>Wed, 02 Jul 2014 20:22:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:283eb05c-29a6-41b0-b455-6142d5387e9a</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Hakon, I just upgraded to SDK 6.0.0 and this is still broken there. I still require the dummy handler in my code for app_timer_cnt_get() to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10396?ContentTypeID=1</link><pubDate>Mon, 16 Jun 2014 08:16:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:add7f956-842c-49c2-9ff3-6a22e84a1b8f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;You&amp;#39;ll need that dummy-handler. If its not registered with the app_timer library, it will stop the RTC when there&amp;#39;s nothing running, resulting in a cleared COUNTER register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10395?ContentTypeID=1</link><pubDate>Thu, 12 Jun 2014 13:05:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:624ef148-1898-49f9-922d-be6ce2da9bd0</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Will do. Do you want me to continue to use this dummy timer with the patched app_timer.c as a work around until the next SDK version ships?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10394?ContentTypeID=1</link><pubDate>Thu, 12 Jun 2014 13:00:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cbd278d9-39af-4609-af2c-55346a6ceb88</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Great to hear!
I would change the dummy handlers app_timer_create(..., APP_TIMER_MODE_REPEATED, ...) to ensure that the NRF_RTC1-&amp;gt;COUNTER register is never cleared.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10393?ContentTypeID=1</link><pubDate>Thu, 12 Jun 2014 12:52:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd3ea0b7-7361-402f-a05f-841f70a0ca47</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;Have added a dummy timer, created and started after the Soft Device is enabled and never stopped, like so:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint32_t err_code = app_timer_create(&amp;amp;m_empty_timeout_timer_id, APP_TIMER_MODE_SINGLE_SHOT, empty_timeout_handler);
	APP_ERROR_CHECK(err_code);

	// 0x00FFFFFF is MAX_RTC_COUNTER_VAL from app_timer.c
	uint32_t timeout = (0x00FFFFFF / 2);
	err_code = app_timer_start(m_empty_timeout_timer_id, timeout, NULL);
	APP_ERROR_CHECK(err_code);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;And yes indeed, I no long see the problem when this app timer is running.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10392?ContentTypeID=1</link><pubDate>Thu, 12 Jun 2014 11:24:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cb3d84c0-36a2-4645-a7d8-c5c64087ab64</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Sorry for the delay, Eliot. I had to get a hold of the developer of app_timer to understand the changes made.
The issue you&amp;#39;re seeing is due to a bugfix, where the counter is reset if it sees that no other app_timer instances are running.&lt;/p&gt;
&lt;p&gt;If you add a dummy-timeout handler (empty handler) with a timeout of MAX_RTC / 2 (255 seconds if prescaler 0 set, see RM chapter 18 for calculation) do you still see the issue of the counter being reset?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10391?ContentTypeID=1</link><pubDate>Mon, 09 Jun 2014 14:41:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ddc8fdf9-914a-4760-8ed0-f912ae926433</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;I spoke too soon. Although the patched app_timer.c fixes the issue I was seeing originally, it also breaks the implementation of app_timer_cnt_get() for me. That function is now returning a very low number of ticks (3) where it used to return the right value. This breaks all the timestamps in my log.&lt;/p&gt;
&lt;p&gt;Do you want me to try this patched app_timer.c with the 5.2.0 SDK instead?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10390?ContentTypeID=1</link><pubDate>Wed, 04 Jun 2014 18:03:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:216fb379-c824-4a6e-8770-5e4ccd9c7006</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;That does indeed seem to have fixed the problem! My code&amp;#39;s been running for 18 mins now without seeing the same behaviour.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m using SDK 5.1.0 though, not 5.2.0, just FYI. Not sure if the same problem exists in 5.2.0 but I&amp;#39;ll stick with 5.1.0 plus this modified source until the next release I guess.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10389?ContentTypeID=1</link><pubDate>Wed, 04 Jun 2014 13:56:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d483498-c983-46e1-a98e-039a96e507bd</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;We&amp;#39;ve had a couple of known bugs regarding the app_timer in the latest release, which we are working on fixing. I have the app_timer source file that will be included in the next release of the nRF51 SDK. Could you try that?&lt;/p&gt;
&lt;p&gt;-H&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/2474.app_5F00_timer.c"&gt;app_timer.c&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer handler called immediately on app_timer_start()</title><link>https://devzone.nordicsemi.com/thread/10388?ContentTypeID=1</link><pubDate>Fri, 30 May 2014 09:31:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ffe6e4d5-845a-4901-9659-7caffd409b57</guid><dc:creator>Eliot Stock</dc:creator><description>&lt;p&gt;This is happening at 4 minutes and 18 seconds after reset, every time, like clockwork.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>