<?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>Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11428/adding-a-timer-to-a-ble-application</link><description>I am working on adding a periodic timer to an existing and running application to add some new features. 
 I mimic exactly what is done in the peripheral/timer_pca10028 example, except the following minor(?) changes: 
 
 Variable/function names and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 May 2018 07:14:54 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11428/adding-a-timer-to-a-ble-application" /><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/132643?ContentTypeID=1</link><pubDate>Tue, 22 May 2018 07:14:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b668fa02-8545-42ad-aaed-808dbc45997d</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This thread is complete with a proper answer.&lt;/p&gt;
&lt;p&gt;Your description is very little and not enough to conclude that your problem is related to this thread. I would strongly recommend you to create a new thread and try to get an answer. Please remember to be as descriptive as possible to get response from fellow enthusiastic devzone users&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/131402?ContentTypeID=1</link><pubDate>Tue, 08 May 2018 18:16:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b02eed4-7fc3-4ebc-a178-fae0887c727a</guid><dc:creator>Nordic_nRF52840</dc:creator><description>&lt;p&gt;Hi Hieu,&lt;/p&gt;
&lt;p&gt;Were you able to resolved your problem?&amp;nbsp; it appears that I have the same problem&lt;/p&gt;
&lt;p&gt;when I tried to add TIMER1 to the project sample&amp;nbsp; &amp;quot;ble_app_uart&amp;quot; .&lt;/p&gt;
&lt;p&gt;Any advise is appreciated. Looking forward to your reply.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;JIMMY&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/43104?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 05:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72914833-289b-409c-8fba-660331fa2e69</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Figured out what happened. Thanks for the tips, RK.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/43105?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 05:02:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60a99c86-e30c-44dc-8180-68887cec44e5</guid><dc:creator>Hieu</dc:creator><description>&lt;p&gt;Thanks to the &lt;a href="https://devzone.nordicsemi.com/question/65177/adding-a-timer-to-a-ble-application/?answer=65203#post-id-65203"&gt;tips from RK&lt;/a&gt;, I dived into the product specification and driver structure, and found the root of the problem.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;As &lt;a href="https://devzone.nordicsemi.com/users/1377/rols/"&gt;RK&lt;/a&gt; said, &lt;code&gt;TIMER0&lt;/code&gt; cannot be used for anything because it is used by the SoftDevice&lt;/li&gt;
&lt;li&gt;Short answer is because &lt;code&gt;TIMER1&lt;/code&gt; is a 16-bit timer.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;2.1. While &lt;code&gt;nrf_drv_timer_ms_to_ticks()&lt;/code&gt; does check for overflow, it only check if the ticks value is more than 32 bit. The function does not check if the ticks value is too big for the current timer. &lt;code&gt;TIMER1&lt;/code&gt; is only a 8/16 bit timer, so any ticks value greater than 0x0000ffff will have its MS 4 byte clipped off. My ticks value was 0xf42400, which means the actual value written on to the Capture/Compare register is 0x2400, about 1800 times shorter than intended.&lt;/p&gt;
&lt;p&gt;2.2. &lt;code&gt;NRF_DRV_TIMER_DEFAULT_CONFIG(1)&lt;/code&gt; set &lt;code&gt;TIMER1&lt;/code&gt; to 16MHz, too fast to set an interrupt interval of 1s with a 16-bit Capture/Compare register. A custom &lt;code&gt;nrf_drv_timer_config_t&lt;/code&gt; need to be passed for the second param of &lt;code&gt;nrf_drv_timer_init()&lt;/code&gt; instead of &lt;code&gt;NULL&lt;/code&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/43103?ContentTypeID=1</link><pubDate>Thu, 21 Jan 2016 03:04:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:84f1e92b-5f28-4b48-8832-690bc93d6775</guid><dc:creator>Hieu</dc:creator><description>&lt;ol&gt;
&lt;li&gt;That makes sense. May be it is just me but I have always had some difficulty grasping what the SoftDevice affect. Perhaps because I cannot ever trace back the reference chain back to its code.&lt;/li&gt;
&lt;li&gt;The issue is that I cannot find out the frequency. Tracing back the reference link from the timer init function lead to a dead end, with a certain &lt;code&gt;_CONFIG_FREQUENCY&lt;/code&gt;. I could never trace any further to find out what that value is.
Perhaps I will try to go into debug mode and dig further. Will update here once I did.&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Adding a timer to a BLE application</title><link>https://devzone.nordicsemi.com/thread/43102?ContentTypeID=1</link><pubDate>Wed, 20 Jan 2016 11:15:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:43cfbb7a-0d6a-45c2-badc-c4a8977463fb</guid><dc:creator>RK</dc:creator><description>&lt;ol&gt;
&lt;li&gt;Yes&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;1.1 no it&amp;#39;s something else - its the softdevice and documented in the softdevice docs&lt;/p&gt;
&lt;p&gt;1.2 n/a&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;don&amp;#39;t know yet&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;2.1 Why don&amp;#39;t you break there and find out what value it&amp;#39;s worked out and see if it makes sense given your timer frequency. If that&amp;#39;s default it should be 16,000 or 0x3e80.&lt;/p&gt;
&lt;p&gt;2.2 NRF_DRV_TIMER_DEFAULT_CONFIG (in the same documentation) which uses the TIMER1_CONFIG_FREQUENCY etc etc defines in the same file you enabled the timer.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>