<?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>s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/7220/s110-and-max-value-of-app-timer</link><description>Hi, 
 What is the largest possible value of &amp;quot;MAX_VAL&amp;quot; for application timer given below: 
 &amp;quot;#define APP_TIMER_PRESCALER 0&amp;quot; 
 &amp;quot;#define M_DELAY APP_TIMER_TICKS(MAX_VAL, APP_TIMER_PRESCALER)&amp;quot; 
 Is it 32 bit value?</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 07 Mar 2016 08:35:19 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/7220/s110-and-max-value-of-app-timer" /><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25499?ContentTypeID=1</link><pubDate>Mon, 07 Mar 2016 08:35:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1169b372-1c92-446f-8b3a-9d4e3f7288d9</guid><dc:creator>Clem Taylor</dc:creator><description>&lt;p&gt;Okay, I haven&amp;#39;t been doing nrf development in a while and still using sdk 8.1.0 for a mostly frozen nrf51 design.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25501?ContentTypeID=1</link><pubDate>Sat, 05 Mar 2016 20:53:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e96e4b23-bc9b-4c9a-bd38-d24facd34570</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;But that bug mentioned in the link was fixed in SDK11_alpha wasn&amp;#39;t it?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25500?ContentTypeID=1</link><pubDate>Sat, 05 Mar 2016 06:01:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:97b978ae-c2c6-4cba-a2a3-8a10a1201851</guid><dc:creator>Clem Taylor</dc:creator><description>&lt;p&gt;At the time it was unclear to me if the app_timer code would accept a timeout up near the limit of 2**24 ticks, so it seemed like a good idea to add a little bit of headroom.&lt;/p&gt;
&lt;p&gt;But then I found that I was having timers misfire when the timeout was &amp;gt; 2**(24-1) ticks.
See: &lt;a href="https://devzone.nordicsemi.com/question/50059/bug-one-shot-app_timer-misfires-at-256-seconds/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Now I never use a timer &amp;gt; 2**23 ticks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25498?ContentTypeID=1</link><pubDate>Fri, 04 Mar 2016 13:35:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0ea7fe9-d935-4332-aa38-bd01f841d2ad</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Clem,&lt;/p&gt;
&lt;p&gt;What is this fudge factor you are talking about?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25497?ContentTypeID=1</link><pubDate>Wed, 27 May 2015 03:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4743547b-2fff-4682-a572-de6371469070</guid><dc:creator>Clem Taylor</dc:creator><description>&lt;p&gt;Short of rewriting app_timer, I&amp;#39;m not sure what the best option is. I ended up using a prescaler of 0 because I needed to use RTC1 for a &amp;#39;not-quite high enough precision&amp;#39; monotonic counter and I gave up on doing long timers directly with app_timer.&lt;/p&gt;
&lt;p&gt;At one point I started to rewrite app_timer with something that better matched my needs but decided I didn&amp;#39;t want to put the time (sic) to properly test it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25496?ContentTypeID=1</link><pubDate>Tue, 26 May 2015 11:36:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1d8bd1da-c4f5-48a7-a220-abb4c21598e3</guid><dc:creator>Adam</dc:creator><description>&lt;p&gt;Many thanks for explanation. So the easiest way to get timeout &amp;gt; 512 seconds is to increase APP_TIMER_PRESCALER, but on the other hand if e.g. APP_TIMER_PRESCALER=4095 I can only write &amp;quot;MAX_VAL&amp;quot; taht is multiple value of 125 ms counter period? As you mentioned the problem appears when I have a few timers that need to generate different delays (e.g 1ms and a few hours). Is there any good solution for this problem? (or should I use small prescaler and start timer many times in timeout_handler in a conditional loop to get the bigger delay).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: s110 and max value of app timer</title><link>https://devzone.nordicsemi.com/thread/25495?ContentTypeID=1</link><pubDate>Tue, 26 May 2015 03:23:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b421f038-0a91-4b98-a3f8-414bdf64ef2e</guid><dc:creator>Clem Taylor</dc:creator><description>&lt;p&gt;The RTC timer is only 24 bits and app_timer does all its timing modulo 2^24. So the largest value for your M_DELAY is (2^24)-1. However due to the way the modulo counting is done the max value is a bit smaller then this. The value I use is:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#define RTC_TICKS_BITS                24 // size of RTC[01] counter in bits 
#define TIMER_MAX_TIMEOUT \
    ((1 &amp;lt;&amp;lt; RTC_TICKS_BITS) - APP_TIMER_MIN_TIMEOUT_TICKS * 10) // fudge
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;How much time this represents is a function of the prescaler chosen. APP_TIMER_TICKS converts from miliseconds to ticks.&lt;/p&gt;
&lt;p&gt;The max value in miliseconds is something like:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;  (2**24) * (APP_TIMER_PRESCALER+1) * 1000 / 32768 - fudge
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This works out to &amp;lt;512 seconds for prescaler of 0.&lt;/p&gt;
&lt;p&gt;Personally I think app_timer could really use a thorough rewrite. It wouldn&amp;#39;t take much for it to support timeout intervals longer then the roll-over period of the timer and in the process the code could be greatly simplified. Only one timer is available for the user and I need it to provide both a monotonic real time counter (which requires a small prescaler), and timeouts/time scheduled events (which requires a larger prescaler for longer intervals) .&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>