<?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>Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/35608/decrease-the-timer-resolution-of-sdk-14</link><description>How can we decrease the resolution of the timer to 500 ms in SDK 14? The minimum resolution I could get to was 1 ms by changing the APP_TIMER_CONFIG_RTC_FREQUENCY macro to 31. 
 Thanks 
 Atul</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 21 Jun 2018 23:05:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/35608/decrease-the-timer-resolution-of-sdk-14" /><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137184?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 23:05:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9383d3ff-1ce2-49f5-b592-6e92831e04b0</guid><dc:creator>Atul Bansal</dc:creator><description>&lt;p&gt;Want to send the timestamp values in the advertisement packets and I don&amp;#39;t want to have large timer values as the packet sizes are very small. About half a second resolution would have been pretty good. But, I guess I will try to work with 125 ms.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137183?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 22:55:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9fa65962-a6b7-48c1-9cad-34ec5a546d3e</guid><dc:creator>superpak</dc:creator><description>&lt;p&gt;Yes, I believe so. What is the reasoning for having a 500 ms resolution? Just curious!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137182?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 22:46:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:027a9d2f-8ac5-43f0-bd24-244d00462e1c</guid><dc:creator>Atul Bansal</dc:creator><description>&lt;p&gt;Cool. Got it! But 500 ms resolution is impossible then? 125 ms is the minimum we could get?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137181?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 22:37:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:61614466-acd4-476e-8dae-1ab9889acee6</guid><dc:creator>superpak</dc:creator><description>&lt;p&gt;The app_timer library sets the prescaler for you. Look at the rtc1_init(..) routine in app_timer.c&lt;/p&gt;
&lt;p&gt;The&amp;nbsp;&lt;span&gt;APP_TIMER_CONFIG_RTC_FREQUENCY&amp;nbsp;is the prescaler value for app_timer library.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static void rtc1_init(uint32_t prescaler)
{
    NRF_RTC1-&amp;gt;PRESCALER = prescaler;
    NVIC_SetPriority(RTC1_IRQn, RTC1_IRQ_PRI);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is called by app_timer_init(...)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;ret_code_t app_timer_init(void)
{
.....

rtc1_init(APP_TIMER_CONFIG_RTC_FREQUENCY);

....
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137178?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 21:37:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ef0f0e1b-d696-43dd-8b8d-1db294e10d4d</guid><dc:creator>Atul Bansal</dc:creator><description>&lt;p&gt;The counter resolution of 30.517 us is the highest resolution right, not the lowest one.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Is there any way in which I can get a resolution of 500 ms? And even if I make do with the 125 ms resolution, where should I change the PRESCALER register? I didn&amp;#39;t see any such command in the documentation of SDK 14. I could change the APP_TIMER_CONFIG_RTC_FREQUENCY macro, but in the description, there are some values provided to us, and I suppose, only those can be used as the possible values of the macro. I am attaching the code from the sdk_config file.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// &amp;lt;o&amp;gt; APP_TIMER_CONFIG_RTC_FREQUENCY  - Configure RTC prescaler.
 
// &amp;lt;0=&amp;gt; 32768 Hz 
// &amp;lt;1=&amp;gt; 16384 Hz 
// &amp;lt;3=&amp;gt; 8192 Hz 
// &amp;lt;7=&amp;gt; 4096 Hz 
// &amp;lt;15=&amp;gt; 2048 Hz 
// &amp;lt;31=&amp;gt; 1024 Hz 

#ifndef APP_TIMER_CONFIG_RTC_FREQUENCY
#define APP_TIMER_CONFIG_RTC_FREQUENCY 31        
#endif
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137177?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 21:28:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1a896c0c-4ffc-45b2-a9fc-b4b6569d7ab8</guid><dc:creator>superpak</dc:creator><description>&lt;p&gt;16383 will not work as the prescaler is only 12 bits!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137176?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 21:26:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6dd9eb2-45d6-4855-ae2c-314864d87217</guid><dc:creator>superpak</dc:creator><description>&lt;p&gt;The RTC peripheral has a 12 bit prescaler. So the max value for prescaler will be (2^12) - 1 = 4095. This will give you a counter resolution of 125 ms with an overflow of&amp;nbsp;582.542 hours.&lt;/p&gt;
&lt;p&gt;If you want the l̶o̶w̶e̶s̶t̶&amp;nbsp;&lt;strong&gt;highest&lt;/strong&gt; counter resolution, you can set the prescaler (APP_TIMER_CONFIG_RTC_FREQUENCY) to 0. This will give you a counter resolution of&amp;nbsp;30.517 us and an overflow of 512 seconds.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137163?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 16:59:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4339e22-ad37-4207-a82e-1bc4ff891d95</guid><dc:creator>Atul Bansal</dc:creator><description>&lt;p&gt;Hi Bjorn&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I knew it already that I have to change the PRESCALER to get the resolution I want. But, I am working with SDk 14.2 and I found that they have removed the PRESCALER argument from the APP_TIMER_TICKS function which was threre in SDK 13. The details can be found &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.nrf52832.ps.v1.1%2Frtc.html&amp;amp;cp=2_1_0_24_1&amp;amp;anchor=concept_iwc_1mj_sr"&gt;here&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thus, I need to know the code or any command which will change the PRESCALER value. As far as I searched, I can only find that I need to change the APP_TIMER_CONFIG_RTC_FREQUENCY macro present in sdk_config.h file and that too it&amp;#39;s maximum value was 31. If I change it to 16383, my device stops advertising.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Atul&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Decrease the timer resolution of SDK 14</title><link>https://devzone.nordicsemi.com/thread/137036?ContentTypeID=1</link><pubDate>Thu, 21 Jun 2018 09:00:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8c0ac8ed-0c50-4225-94b2-eb496fe7ef31</guid><dc:creator>Bj&amp;#248;rn Kvaale</dc:creator><description>&lt;p&gt;Hi Atul,&lt;/p&gt;
&lt;p&gt;I believe &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.nrf52832.ps.v1.1/rtc.html?cp=2_1_0_24_1#concept_iwc_1mj_sr"&gt;this link&lt;/a&gt; will be helpful for you. Since you want a resolution of 500 ms, this is the same as 1/.5 s = 2 Hz. Therefore f_RTC = 2Hz.&lt;/p&gt;
&lt;p&gt;Solving for the equation gives you a prescaler value of:&lt;/p&gt;
&lt;p&gt;PRESCALER = round(32768 Hz/ 2 Hz) - 1 = 16383.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>