<?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>NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/89801/netcpu-timer-interrupt-issues</link><description>Hi, 
 I have an issue with interrupts on TIMER1 on nrf5340 NETCPU. My setup involves 2 timers that are linked via DPPI, TIMER2 counting microseconds and TIMER1 counting milliseconds. I also have 2 DPPI channels routed via IPC, one each way. The IPC events</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 25 Jul 2022 12:28:38 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/89801/netcpu-timer-interrupt-issues" /><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378538?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 12:28:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aad41035-554d-484e-bc04-5180b85ee72a</guid><dc:creator>Kenneth</dc:creator><description>[quote user="peran"]but are you saying that interrupts are not available on capture, and that my interrupts are generated from a compare match on the captured value?&amp;nbsp;[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes, the intention is simply something like:&lt;br /&gt;&lt;br /&gt;NRF_TIMER-&amp;gt;TASKS_CAPTURE[0] = 1;&lt;br /&gt;return NRF_TIMER-&amp;gt;CC[0];&lt;/p&gt;
&lt;div&gt;&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378531?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 11:55:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3035cd8a-25dd-452a-b01e-65c3b3f5539a</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;Reg capture and interrupt. I am not 100% sure&amp;nbsp;I understand, but are you saying that interrupts are not available on capture, and that my interrupts are generated from a compare match on the captured value?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I&amp;#39;ll check out the EGU.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378512?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 10:52:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5a7e2a9e-c652-4a21-812b-d1f51b7d9b1f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi again,&lt;/p&gt;
[quote user="peran"]But surely the interrupt is supposed to also trigger on a capture? There are so many cases where you want to capture something _and_ be notified about it. It does trigger on timer2, so that indicates that this functionality is available.[/quote]
&lt;p&gt;I see your point, but I would not rely on this, since by the time you update CC register the counter value might have incremented at the same time, so I expect there will be corner cases here where there is no interrupt from this operation. If you need an interrupt, you may trigger the EGU&amp;nbsp;interrupt&amp;nbsp;instead (which can trigger an event that also can be used to trigger capture on both timers if you want):&lt;br /&gt;&lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf5340/egu.html"&gt;https://infocenter.nordicsemi.com/topic/ps_nrf5340/egu.html&lt;/a&gt;&lt;/p&gt;
[quote user="peran"]Could this ticket be transferred to someone who is not vacationing? I appreciate that it is summer holidays, but it&amp;#39;s been 17 days since I submitted, and counting another 21 it will be 38 days&amp;nbsp;without anything more than scratching the surface of my issue.[/quote]
&lt;p&gt;I see your point here also, the problem the last 2 weeks have been low staff due to vacation, the next 2 and half week I am taking my vacation. But I can see if someone can fill in next week where there are more people back.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378510?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 10:22:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2711088e-d53a-466e-ba3c-0304c94f06d3</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;Regarding double MS_TIMER EVENTS clearing, yes that is an oversight. But it is the ISR&amp;nbsp;that uses MS_TIMER, so it does not matter if I clear it twice. I have amended my example, and attached it again.&lt;/p&gt;
&lt;p&gt;No, there is no check for which compare. As long as my issue is that the interrupts&amp;nbsp;don&amp;#39;t fire properly, I don&amp;#39;t care about which CC. This code is an example to reproduce the issue in the simplest way, not my production code. This is also why I execute the capture task from main. I am sure the result would be the same if I used e.g. a work-queue, or routed the signal via IPC and DPPI from the appcore.&lt;/p&gt;
&lt;p&gt;Regarding Capture interrupt. You say that the task doesn&amp;#39;t trigger the interrupt, and I see that the INTENSET register says &amp;quot;compare.&amp;quot; But surely the interrupt is supposed to also trigger on a capture? There are so many cases where you want to capture something _and_ be notified about it. It does trigger on timer2, so that indicates that this functionality is available.&lt;/p&gt;
&lt;p&gt;Could this ticket be transferred to someone who is not vacationing? I appreciate that it is summer holidays, but it&amp;#39;s been 17 days since I submitted, and counting another 21 it will be 38 days&amp;nbsp;without anything more than scratching the surface of my issue.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/blinky2.zip"&gt;devzone.nordicsemi.com/.../blinky2.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378500?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 09:32:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:be0faa4f-0e51-4219-8e73-adfb8e0452e2</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I will likely not have time to look into this until I am back from vacation in about 3 weeks time.&lt;/p&gt;
&lt;p&gt;I did quickly glance at the blinky example you provided, I found it a bit strange that you in your isr2 cleared both&amp;nbsp;MS_TIMER&amp;nbsp;and U&lt;span&gt;S_TIMER&amp;nbsp;&lt;/span&gt;EVENTS_COMPARE event, while in isr1 you cleared&amp;nbsp;MS_TIMER&amp;nbsp;&lt;span&gt;EVENTS_COMPARE&amp;nbsp;two times.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;There is no check in your isr handlers to check which compare event triggered the interrupt, and you should only need to clear the event for the timer that triggered the interrupt before you exit the interrupt handler.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I notice you are executing capture tasks in main, if you need those to execute straight after eachother I would recommend that you add a disable/enable interrupts around them. If not you can get some race condition where there is an interrupt between the two. The capture task doesn&amp;#39;t trigger the interrupt, it only copy the timer&amp;#39;s count value to the corresponding CC register.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Kenneth&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/378487?ContentTypeID=1</link><pubDate>Mon, 25 Jul 2022 08:27:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:456e1b0f-e334-4b1b-8640-13d7b535fd64</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Any update on this? Did anyone test my code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/377343?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 07:56:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b45a5aa-f768-4ee4-b979-138331fd484f</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;I recorded 900 secs of pin toggling. I got 40283 toggles from the event, and 40240 toggles from the interrupt, meaning I have 43 missing interrupts. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/377337?ContentTypeID=1</link><pubDate>Mon, 18 Jul 2022 07:28:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dc318be2-9a9c-416b-9a6e-582c6f426c29</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;A little update: I have found another timer interrupt issue:&lt;/p&gt;
&lt;p&gt;The screenshot shows two pins toggling. The bottom is toggling via GPIOTE, using the aforementioned APPCPU-IPC-DPPi-channel. This is the same signal that triggers the capture and thus initiaties the CC-interrupt. The top is a pin being toggled inside the interrupt. As you can see there are two events that don&amp;#39;t lead to an interrupt. I don&amp;#39;t have hard numbers right now, but this happens frequently, so it is a serious issue. I will do a more thorough test on the frequency today.&lt;/p&gt;
&lt;p&gt;Time between edges are approx 21ms.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/Screenshot-from-2022_2D00_07_2D00_18-09_2D00_20_2D00_47.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376577?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2022 10:40:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f592c30a-9cf2-4b29-83b2-9227f73811c6</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;I will, but I am currently working my way around it. With the DK example I feel I can be pretty sure that it is not my code that is the issue, and that I need nordic to look into the design and tell me why I am seeing this undocumented/errata-ish behaviour. Both regarding the missing IRQ and the need to clear CC reg on CC interrupt. &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376561?ContentTypeID=1</link><pubDate>Tue, 12 Jul 2022 09:17:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:186ca978-fb7b-4891-89fe-a6a0564b3627</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Due to many are on summer holiday I am not sure when I will have time to look into this, but it&amp;#39;s on my todo list. Let me know if you have new findings.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376490?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 16:06:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a73eef3-53e2-436b-b2e7-b094132eaa9f</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;Marking on chip is QKAA0D 2106AF. The DK I used for the example also has same markings, last line is 2122AH. I use NCS 1.7.0. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376488?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 15:58:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ba0ab76f-59d4-4fef-bfa8-a9dda889000f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I will try to replicate this, but just to make sure we are not overlooking anything here, can you provide details of the chip markings printed on the nRF5340 chip? I just want to make sure you are using the massproduction version, and not have received some early engineering samples before the chip was qualified. Also, please provide details of which NCS version the example is based on.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376454?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 13:59:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b56ecd86-e43c-48c4-9cf8-6e5feabd38e2</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;I&amp;#39;m using custom hw.&lt;/p&gt;
&lt;p&gt;I&amp;#39;ve created a quick example for NRF5340dk, which modifies the blinky example from zephyr. Please see how only one led blinks. By removing/toggling TIMERn-&amp;gt;TASKS_CAPTURE in the main function you can change the behaviour.There is also terminal output you can look at.&lt;/p&gt;
&lt;p&gt;Please also note that you need to write the CC reg in the ISR to clear the interrupt. This is not documented in the DS afaik.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/0523.blinky.zip"&gt;devzone.nordicsemi.com/.../0523.blinky.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376434?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 12:58:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99567569-a450-4792-93ac-8299001c5b18</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Can you provide label of the nRF5340-DK you are using?&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376427?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 12:35:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6939b3e2-1fbc-40a5-aeb3-a6b3cb5e19c0</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;No, my last comment is not a fix, it was simply about your readability.&lt;/p&gt;
&lt;p&gt;Even if I remove the IPC/DPPI stuff for triggering the interrupt, and do a NRF_TIMER1-&amp;gt;TASKS_CAPTURE[n] the interrupt will only run execute for TIMER2. I&amp;#39;ve also tried to run it in normal mode (not counter mode) and without the DPPI chaining of timers.&lt;/p&gt;
&lt;p&gt;I also checked the relevant isr_tables.c to see that my ISR is included.&lt;/p&gt;
&lt;p&gt;Any ideas as to next steps?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376389?ContentTypeID=1</link><pubDate>Mon, 11 Jul 2022 11:01:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:159de794-fded-40dd-befc-cdacaa8026d7</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;I am not aware of any issue with the hardware timers that should explain why they behave differently, based on your last comment I think you might have found the problem.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NETCPU timer interrupt issues</title><link>https://devzone.nordicsemi.com/thread/376209?ContentTypeID=1</link><pubDate>Fri, 08 Jul 2022 12:27:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8b372895-e5e9-4827-bb72-b3e3e55bfce3</guid><dc:creator>peran</dc:creator><description>&lt;p&gt;I did some renaming in the code to make it more readable, and immediately noticed one oversight: HS_TIMER is TIMER2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>