<?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>Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/18081/restartig-app_timer-does-not-work-with-nrf52832-and-sdk12-0-0</link><description>I am having an app_timer (nRF52832 / SDK12.0.0) that&amp;#39;s interval must be changed during its lifetime. I am using following code to change the interval: 
 app_timer_stop(m_timer_id);
uint32_t interval = APP_TIMER_TICKS(interval_ms, APP_TIMER_PRESCALER</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 25 May 2017 07:42:28 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/18081/restartig-app_timer-does-not-work-with-nrf52832-and-sdk12-0-0" /><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69761?ContentTypeID=1</link><pubDate>Thu, 25 May 2017 07:42:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce288d48-300a-4739-8f04-010eca74a6a6</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;As far as I can remember, in my code the stop/start calls were not in the timer&amp;#39;s callback. Well, strange. I haven&amp;#39;t had time to dig into this any more and I am now using nrf_drv_timer, instead.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69760?ContentTypeID=1</link><pubDate>Wed, 24 May 2017 22:10:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08c4603b-6005-497c-9156-8827d924ffc1</guid><dc:creator>Aaron</dc:creator><description>&lt;p&gt;I ran into this problem also.  It seems like app_timer does not like it when you call stop()/start() on a timer from that timer&amp;#39;s callback.  I moved the timer reset out of the callback and it seems to work.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69753?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 11:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fff05b9f-41cc-4641-948f-b59eb339fdd0</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Yep, I was thinking that too. Now I changed the bit width into 2 and got it working. Also, timer interval changing works now, with this nrf_drv_timer version, I mean. Thank you for help and patience!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69752?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 10:51:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35ee7e52-4ea3-46bf-96b5-9257e4b9d168</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;The default prescaler of the time is 0. So it will generate ticks with 16MHz tick.
For 100ms with prescaler 0, you need to put 16MHz/10 = 0x186A00 in CC register. This is a 24 bit value.&lt;/p&gt;
&lt;p&gt;Please check your nrf_drv_timer_config_t variable to see what .bitfield variable of it is initalized to. My guess is that it is initialized to TIMER_DEFAULT_CONFIG_BIT_WIDTH which is set to 0 = 16 bit. So instead of writing 0x 186A00, it writes only 0x6A00 = 1.69ms.&lt;/p&gt;
&lt;p&gt;Solution is to change the TIMER_DEFAULT_CONFIG_BIT_WIDTH to 2 which is 24bit in timer register.&lt;/p&gt;
&lt;p&gt;If this works, please accept the answer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69758?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 10:19:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f069bf67-014d-49f1-a22b-198b5db2dafc</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Okay, nrf_drv_timer_uninit() does it, of course. But now the interval seems to be incorret. Instead of 100 ms, I get something like 1 ms or 2 ms. Is there some hidden extra setting concerning the calls:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;time_ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;timer, interval_ms);
nrf_drv_timer_extended_compare(
     &amp;amp;timer, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69759?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 09:30:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee2c0be9-aff2-4238-b4f9-c033b033ad66</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;So, how do I deinitialize the timer in order to set new interval?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69757?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 09:27:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bacd6de-debc-4105-b134-32955105fc5c</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;You get this error when you are trying to initialize an already initialized timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69754?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 08:53:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6123fb01-e750-446d-9992-12648a7a35e1</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;I also tried to solve the problem by using nrf_drv_timer instead of app_timer. However, my code fails on this:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
err = nrf_drv_timer_init(&amp;amp;timer, &amp;amp;timer_cfg, timeoutHandler);
APP_ERROR_CHECK(err_code); // err_code returns 0x00000008 !!
time_ticks = nrf_drv_timer_ms_to_ticks(&amp;amp;timer, interval_ms);
nrf_drv_timer_extended_compare(
     &amp;amp;timer, NRF_TIMER_CC_CHANNEL0, time_ticks, NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK, true);
nrf_drv_timer_enable(&amp;amp;timer);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So, nrf_drv_timer_init() fails with error code 8. What coul be the reason?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69756?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 08:44:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:530ec7b1-8da5-4ea5-87e5-51be5d89a004</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;APP_TIMER uses RTC1, you cannot configure it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69755?ContentTypeID=1</link><pubDate>Mon, 02 Jan 2017 08:39:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:446895ce-c0df-42bd-aa28-db26964d1190</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;How do I configure which timer instance APP_TIMER is using? In the code there is only this macro:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69749?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 16:24:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:92a58ff0-7c98-4500-b41c-81d04d518be7</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Yes.  It is.  Dfined as blocked in softdevice specification document&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69751?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 12:00:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35b3c91d-728d-45f7-b515-4e30a8a6e2ca</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Yeah, but what are those resources that softdevice uses, is the TIMER0 such a resource?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69750?ContentTypeID=1</link><pubDate>Tue, 13 Dec 2016 11:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:53054d7d-1579-4dd0-9f3a-23c7de048c0f</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Jarmo, Softdevice specifications says all resources that it uses and reserves which are not available to the application after softdevice is enabled.&lt;/p&gt;
&lt;p&gt;The queue size depends on how fast you are pushing app_timer operations on a particular timer. Normally you would not need more than 4, but it depends on many things. I think the default in SDK is 10 items in the queue, that is max queue size is 10.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69748?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 08:20:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b186f51-3b44-4bd7-94f2-7c944f6038f9</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;How do I know which timer app_timer is atually using? And what timer I should use? Is the TIMER0 reserved for soft device? My timer system initialization code is as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  lfclk_config();
  APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Also, what is that &amp;quot;OP_QUEUE&amp;quot;, actually, and how long the queue should be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69747?ContentTypeID=1</link><pubDate>Mon, 12 Dec 2016 08:15:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cd5ebf3a-882f-409e-957c-7831b274cf32</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;There is ofcourse possibility of mixing up with timers. Easy mistake is to use the same timer instance two times, then we get completely unexpected results. It is also possible to configure PPI to trigger timer tasks with other events. In you case if you are not using TIMER0 and if you are not not reconfiguring the timer you use and not using PPI around it, then i do not know what else is wrong. Like I said it will be much easier if you upload more code.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69746?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 14:53:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc284291-47d9-4534-8eba-ee2a6430dec5</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Is it possible to somehow mix-up timers with soft device (conflicting with TIMER0, TIMER1 etc.)? It seems that the problem might be related to softdevice, since the problem occurs when connecting / disconnecting. I am changing the timer interval at those moments.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69745?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 13:51:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8554d129-4cb9-4b03-a406-73efe6aa725a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;for sure the problem is somewhere else in your project.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69744?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 13:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:52b2b677-5a7c-4e16-aeac-33cdba4a5d23</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Not sure what the problem is in your code. I tested app_timer with this example and it showed correct results&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/11127.main.c"&gt;main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3542.Capture1.PNG" alt="image description" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;img src="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5618.Capture1.PNG" alt="image description" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69743?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 12:50:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:70e72ae9-44c8-4285-8255-8bd018fd1c3a</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Thanks!
The problem arises when I change from 100 ms interval to 50 ms interval, and vice versa. The related code is shown above, in the original question. Could it be possible that the underlying hardware counter is not cleared and when the compare value is changed, first firing of the comparison is missed (because counter has already passed the value) and the timer starts to fire only after the counter rolls over back to zero?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69742?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 12:14:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6c2b4f4f-17a8-4ecc-8140-1213948b6ad2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;re-opened , please give some more details&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69741?ContentTypeID=1</link><pubDate>Fri, 09 Dec 2016 10:30:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b1636a74-340d-4a44-bcfd-dd63ae5a8fc1</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;I would need &amp;gt;200 points to reopen the question. I am now hitting hard into the same problem :( Can you please reopen this question?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69739?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 13:54:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8fb6aeef-904b-41ec-af38-5f7ac2632537</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;don&amp;#39;t hesitate to reopen this if you see this behavior again Jarmo. Since you started this thread, you are allowed to re-open it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69737?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 12:21:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f30424b1-4bf0-47d2-889b-487cbd941cc0</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Sigh, put wrong closing reason. Can&amp;#39;t change it any more, maybe you could do that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69736?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 12:19:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:13965645-b59b-418d-9654-03b616b316c8</guid><dc:creator>Jarmo</dc:creator><description>&lt;p&gt;Yeah, for now it looks like so :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Restartig app_timer does not work with nRF52832 and SDK12.0.0</title><link>https://devzone.nordicsemi.com/thread/69735?ContentTypeID=1</link><pubDate>Thu, 01 Dec 2016 12:18:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ccc1fff-192e-46b0-82ae-67c30839ba3b</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;maybe we can close this then Jarmo?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>