<?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 intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/38371/timer-intermittently-finishes-too-soon-rare-conflict-between-app_timer-and-ble_advertising</link><description>Config 
 
 Using NRF52810 on a custom PCB with 32kHz + 32MHz crystals, very close to the reference schematic 
 S112 with SDK 14.2.0 in SEGGER Embedded Studio V3.30 
 
 A button press from a sleeping state triggers an app_button interrupt which calls ble_advertising_start</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 19 Sep 2018 15:18:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/38371/timer-intermittently-finishes-too-soon-rare-conflict-between-app_timer-and-ble_advertising" /><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/149494?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2018 15:18:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c4387bb3-8001-4b9f-88d8-c666e2607c82</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Thanks Jorgen, I&amp;#39;m afraid I can&amp;#39;t share the project in its current state, it&amp;#39;s almost production firmware now with the exception of this bug! I think what I&amp;#39;m going to do is try the full migration from 14.2 to 15, as I&amp;#39;m not happy with this squashed NRFX into 14.2 and the mess I now have here! I&amp;#39;ll get back to you at some point and let you know how it goes, for now I&amp;#39;ll mark your first answer as suggested answer &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/149473?ContentTypeID=1</link><pubDate>Wed, 19 Sep 2018 13:42:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51adc6a5-d280-4b6b-8a0a-24c97526fe05</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you share your project? I can help you debug it and try to get it working with app_timer2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/149305?ContentTypeID=1</link><pubDate>Tue, 18 Sep 2018 16:05:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:103da43e-6e7f-4b1a-85eb-c4bb036c622d</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;This is pretty much the first thing that happens in main() when the device is started. After LOG is initialised, app_timer and gpio is configured and the led_flash_for_ms() happens after. The old app_timer would work like this,&amp;nbsp;regardless of whether the softdevice was enabled or not.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Seems that when using app_timer2, the end event never actually gets called, so the LED never goes off. The long flash time I was seeing was because something else was disabling the LED much further in the program.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The V2 timer is failing to run my timeout handler before or after softdevice is enabled, or even if I enable and select LFCLK manually. I&amp;#39;ve even tried lowering&amp;nbsp;APP_TIMER_CONFIG_IRQ_PRIORITY but it still won&amp;#39;t ever trigger my timeout handler for some reason.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;(I&amp;#39;ll get to the memory problem after I&amp;#39;ve got the first part working! OP_QUEUE_SIZE default definitely seems large enough but I&amp;#39;ll see if increasing it solves the problem when I get there).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148724?ContentTypeID=1</link><pubDate>Fri, 14 Sep 2018 06:56:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2d9d67e7-d9ef-4eb1-bad1-91286e18742a</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I can&amp;#39;t see any obvious reasons that the timer should run 10x longer. Did you start the LFCLK before app_timer? This is required if the softdevice is not initialized. The NO_MEM error is most likely caused by the OP_QUEUE being too small. Please try increasing&amp;nbsp;APP_TIMER_CONFIG_OP_QUEUE_SIZE. Are you calling the timer start functions from interrupt context? Is there something else running on higher priority in your application that can delay the handling of the interrupts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148663?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 15:03:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:49012036-a546-424a-887f-149eec281dfb</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Here&amp;#39;s my LED flash code using app_timer (stripped out error handling etc.)&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ree.c"&gt;devzone.nordicsemi.com/.../ree.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;and excuse the mess, but here is the sdk_config file. I&amp;#39;ve just copied in a lot of the defines from SDK15 until my 14.2 project would build with the new NRFX and app_timer2 stuff squashed in.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/config.h"&gt;devzone.nordicsemi.com/.../config.h&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;All the RTC and crystal frequency things seem ok so I have no idea what&amp;#39;s making it run slow. The call to flash_for_ms happens before the softdevice is initialised, could that be a problem with this new app_timer2? It worked fine with the old one.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148627?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 12:41:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:18c6d823-14ee-4e9d-bdc9-b98f039de805</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Can you upload your sdk_config.h file, and the config/init code you use for app_timer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148546?ContentTypeID=1</link><pubDate>Thu, 13 Sep 2018 08:28:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de62001d-935d-4342-81f1-9edd396f46cb</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;I&amp;#39;ve managed to squeeze in all the new nrfx, hal and log things that app_timer2 depends on and for some reason the timer is lasting about 10x longer than it should now! I&amp;#39;m also getting an NRF_ERROR_NO_MEM&amp;nbsp;error when trying to start a different timer on top of the first one -&amp;nbsp;seems to be nrf_atfifo_item_alloc() inside&amp;nbsp;timer_req_schedule()&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148271?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 16:14:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:204596c0-236a-4af0-b073-fb41714e7878</guid><dc:creator>Jake</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;span&gt;J&amp;oslash;rgen,&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Thanks for that suggestion, certainly seems like it might make a difference. I&amp;#39;m trying to get app_timer2 working in my project but there are all kinds of changes I need to make (there is no nrfx in 14.2). I&amp;#39;ll let you know if it works out and mark this as answered sometime this week &lt;span class="emoticon" data-url="https://devzone.nordicsemi.com/cfs-file/__key/system/emoji/1f642.svg" title="Slight smile"&gt;&amp;#x1f642;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Many thanks,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;q&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timer intermittently finishes too soon, rare conflict between app_timer and ble_advertising</title><link>https://devzone.nordicsemi.com/thread/148186?ContentTypeID=1</link><pubDate>Tue, 11 Sep 2018 11:51:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5eddf7c-730b-4c9a-ac80-395d5edc68e6</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It sounds like&amp;nbsp;what you are experiencing could be related to &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/22524/app_timer-trigger-immediatly-on-sdk13/88600#88600"&gt;this issue&lt;/a&gt;. There is a new expermimental implementation of app_timer (app_timer2) in SDK 15.x.0, can you try to replace app_timer in your application with this implementation?&lt;/p&gt;
&lt;p&gt;The new implementation use the same API, but is much simpler than the old one. You will have to replace the source file app_timer.c with app_timer2.c and&amp;nbsp;drv_rtc.c, both found in&amp;nbsp;components\libraries\timer\experimental. You also need to define the preprocessor symbols APP_TIMER_V2 and&amp;nbsp;APP_TIMER_V2_RTC1_ENABLED.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>