<?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>Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/78412/timers-interrupt-lagging-on-nrf5340</link><description>Hi All! 
 
 I have a problem which i can&amp;#39;t really understood. I&amp;#39;m using nRF5340-DK evaluation board, and currently i&amp;#39;m trying to get one of timer (TIMER1 in this example) to have a tick every 1s. 
 I want to have it done via NRF(X) library, not using</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 06 Dec 2021 11:21:31 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/78412/timers-interrupt-lagging-on-nrf5340" /><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/342036?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 11:21:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b10d8632-0cdd-4dea-b544-2ea70bdd6bbd</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;That&amp;#39;s great news, I will close this ticket then.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The best of luck with your project &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;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/342017?ContentTypeID=1</link><pubDate>Mon, 06 Dec 2021 09:58:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c2ba2975-c3b2-4cb4-9b95-5969a62a8ee8</guid><dc:creator>David Dabi</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt; on behalf of &lt;a href="https://devzone.nordicsemi.com/members/michal-obrembski"&gt;Michal Obrembski&lt;/a&gt; we&amp;#39;ve checked together with him the suggestion and you are correct, the issue is with UART delays rather than Timer callback.&lt;br /&gt;Thanks for the support !!!! this ticket can be resolved.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/337899?ContentTypeID=1</link><pubDate>Mon, 08 Nov 2021 12:03:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c0aa03a2-1887-4618-a7b1-978e768d62c1</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t have any issues running your code, but I made one change to store the instance to a variable:&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;nrfx_timer_t my_timer = NRFX_TIMER_INSTANCE(1);&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;And then I just refer to this in the later calls:&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;&lt;em&gt;nrfx_timer_init(&amp;amp;my_timer, &amp;amp;initCfg, timerEventHandler);&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;&lt;em&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div&gt;But if it works some times but not others I doubt this is the reason for the issue.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;What happens if you toggle a LED instead of writing to the UART?&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Is the problem still the same?&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;[quote user=""]&lt;p&gt;Then it appears that uart_irq_rx_disable also disables timer interrupt. When i do frequently rx_disable, then timer interrupt is lagging even more.&lt;/p&gt;
&lt;p&gt;Can&amp;#39;t really understood why disabling UART interrupt also disables Timer interrupt?&lt;/p&gt;[/quote]
&lt;p&gt;Could this be because the UART gets delayed rather than the interrupt?&lt;/p&gt;
&lt;p&gt;What if you add a small delay after each time you disable and re-enable the uart RX?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;k_msleep(1);&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/337627?ContentTypeID=1</link><pubDate>Fri, 05 Nov 2021 09:02:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caebe465-37e7-4f3e-8730-9a384a4ac456</guid><dc:creator>Michal Obrembski</dc:creator><description>&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/members/ovrebekk"&gt;ovrebekk&lt;/a&gt;, i&amp;#39;ve posted a code in first topic ;)&lt;/p&gt;
&lt;p&gt;This is all problematic code. If you need something specific, please let me know.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/336672?ContentTypeID=1</link><pubDate>Fri, 29 Oct 2021 11:55:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5da87b15-4607-4b83-b16b-c65b1ff05ba5</guid><dc:creator>ovrebekk</dc:creator><description>&lt;p&gt;Hi Michal&lt;/p&gt;
&lt;p&gt;Sorry for the missing response on our end. Håkon is currently unavailable, and I will help out with your case in the mean time.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you are still having issues with this, are you able to share your sample with me so I can try to reproduce the issue on my end?&lt;/p&gt;
&lt;p&gt;If you don&amp;#39;t want to share your code in a public case just let me know, and I can make it private.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards&lt;br /&gt;Torbjørn&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/333359?ContentTypeID=1</link><pubDate>Sun, 10 Oct 2021 19:59:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:19a555a7-b0ad-45b7-b2a8-85f02399a3ce</guid><dc:creator>Michal Obrembski</dc:creator><description>&lt;p&gt;OK, but i already provided handler in previous post:&lt;/p&gt;
&lt;p&gt;void timerEventHandler( nrf_timer_event_t event_type, void *p_context )&lt;br /&gt;{&lt;br /&gt; printk(&amp;quot;Timer called&amp;quot;);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;It&amp;#39;s just a simple printk, what&amp;#39;s wrong with that?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Timers interrupt lagging on nRF5340</title><link>https://devzone.nordicsemi.com/thread/325584?ContentTypeID=1</link><pubDate>Wed, 18 Aug 2021 17:54:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4dcc98c8-53d2-4280-8072-0c7ab314df2a</guid><dc:creator>helsing</dc:creator><description>&lt;p&gt;Hi Michal,&lt;/p&gt;
&lt;p&gt;It looks like the interrupts are not handled properly. You could try handling the interrupt in a similar way as in this &lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx/rtc/src/main.c"&gt;nrfx rtc sample&lt;/a&gt;. This is similar to nrfx_timer.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>