<?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>Long timer expires immediately</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/55738/long-timer-expires-immediately</link><description>Hi, 
 I&amp;#39;m having an issue with timers. They work fine for shorter timeout values (&amp;lt;8hours) but after trying with a timeout value of 24 hours, my timers expired immediately. After a bit more digging, I found that how I declare my timer variables seems</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Dec 2019 07:51:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/55738/long-timer-expires-immediately" /><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226883?ContentTypeID=1</link><pubDate>Fri, 27 Dec 2019 07:51:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f5984149-a5d9-438d-bf5e-848925a63126</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi again, you could try to do something like what was done &lt;a href="https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/lib/bin/lwm2m_carrier/os/lwm2m_os.c#L143"&gt;here&lt;/a&gt;, instead of delaying x ms you delay max_timeout_length, and then keep doing this until the sum of delays has become x.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226471?ContentTypeID=1</link><pubDate>Fri, 20 Dec 2019 05:29:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d3ef7c-ce3f-4dd8-8dac-8e9f0bd0dd1a</guid><dc:creator>Krzysztof Chruscinski</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;there is an ongoing work in zephyr to improve timeout API and eventually use 64 bit timeout values:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/21305"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/21305&lt;/a&gt;. That will fix this issue. For the workaround, i would just suggest building another layer on top of the timer which will fragment longer timeouts.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226413?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:47:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:267bc610-946c-4a67-858f-aa34bb43cbe3</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Okay, thank you for the information.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will ask around but since it&amp;#39;s the holidays here in Norway we are very low on staff. Worst case you will hear back during the beginning of week 2.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226409?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:de6df13f-2f8e-4546-a0f1-934e310e3254</guid><dc:creator>jlangballeswift</dc:creator><description>&lt;p&gt;What I&amp;#39;m actually trying to accomplish is having multiple software timers to monitor the health of my different threads. I declare them as an array at compile-time and initialize them later at runtime.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;static struct k_timer timers[NUM_MODULES];

...

for (int i = 0; i &amp;lt; NUM_MODULES; ++i)
{
    // Do init for each timer
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The example I posted is just a stripped down version of this basically&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226407?ContentTypeID=1</link><pubDate>Thu, 19 Dec 2019 14:21:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60baa746-bfd5-4d15-b8eb-cba1fd392dd2</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi again! Can I ask why you don&amp;#39;t want to do it the way you presented in your first example - which you said worked as expected?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226213?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 16:17:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a70fade7-d3d5-4e70-b57f-981f6438136a</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi! So sorry about that, I misread your post.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I will get back to you with an answer tomorrow.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226212?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 16:11:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a45f735-e99f-4c52-8f1a-cb31f3caeb6c</guid><dc:creator>jlangballeswift</dc:creator><description>&lt;p&gt;Hi Heidi,&lt;/p&gt;
&lt;p&gt;I am using the nRF9160 though...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/226206?ContentTypeID=1</link><pubDate>Wed, 18 Dec 2019 15:35:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c40a65d8-b580-4f86-a145-63823e5ab17f</guid><dc:creator>Heidi</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I&amp;#39;m sorry but as of now, DevZone does not provide support for Zephyr with nRF52840, only nRF9160.&lt;/p&gt;
&lt;p&gt;Nordic Semiconductor is part of the&amp;nbsp;&lt;a href="https://www.zephyrproject.org/what-is-zephyr/"&gt;Zephyr Project&lt;/a&gt;&amp;nbsp;and contributes with misc. components/software, but we do not give support for Zephyr running on nRF52840.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks for your understanding.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Heidi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Long timer expires immediately</title><link>https://devzone.nordicsemi.com/thread/225952?ContentTypeID=1</link><pubDate>Tue, 17 Dec 2019 15:51:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e40f6adc-dbf7-4aa7-9ac7-c3a891be0d2d</guid><dc:creator>jlangballeswift</dc:creator><description>&lt;p&gt;I posted in the Zephyr slack channel and was linked to this issue.&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/issues/19075"&gt;https://github.com/zephyrproject-rtos/zephyr/issues/19075&lt;/a&gt;&amp;nbsp;It looks related but is there some way I can work around this?&lt;/p&gt;
&lt;p&gt;After digging into the source a bit, it looks like this may affect all time values from the device&amp;#39;s clock, including k_uptime_get().&amp;nbsp;z_clock_elapsed is implemented&amp;nbsp;as a signed 32 bit integer which would overflow after ~18 hours with the ticks/seconds conversion.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>