<?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>Issue with 2 hw timer interrupt collision</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59118/issue-with-2-hw-timer-interrupt-collision</link><description>Hello, I am trying to use the timer peripheral via registers only, however I am running into issues when I setup two timers and they activate at the same time. Here are my interrupt handlers: 
 
 
 
 
 The end goal is to allow for custom event handlers</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Mar 2020 15:27:50 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59118/issue-with-2-hw-timer-interrupt-collision" /><item><title>RE: Issue with 2 hw timer interrupt collision</title><link>https://devzone.nordicsemi.com/thread/240298?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 15:27:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0271b33b-45c8-4199-ac83-46ca48c99e06</guid><dc:creator>sxd248</dc:creator><description>&lt;p&gt;First of all thank you so much for&amp;nbsp;helping me with this issue!&amp;nbsp;You were right in that the issue was with the handling of the gpio registers. I&amp;nbsp;changed it now to follow what the HAL does, which is just set the OUTSET and OUTCLEAR register equal to 1 &amp;lt;&amp;lt; pinnum. Thanks again! PS. Ur libraries are good, I just like to know how&amp;nbsp;it all works&amp;nbsp; &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;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue with 2 hw timer interrupt collision</title><link>https://devzone.nordicsemi.com/thread/240202?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 10:19:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3b57b8e-3e7a-4965-a02f-03734b1f5679</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The first that I noticed was the compiler warning that said that you didn&amp;#39;t have a type for y on line 61 in gpio.c. Please set it to e.g. uint8_t or uint32_t.&lt;/p&gt;
&lt;p&gt;It is actually not an interrupt issue. I ported your code to an example that had logging enabled, and the event handlers were called properly. The issue was in your function:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;// Set the output pin low
void gpio_pin_clear(NRF_GPIO_Type *port, uint32_t pin_num)
{
  port-&amp;gt; OUTCLR |= (1 &amp;lt;&amp;lt; pin_num);
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;There is a space there between &amp;quot;port-&amp;gt;&amp;quot; and &amp;quot;OUTCLR&amp;quot;, but I don&amp;#39;t think it caused any issues. Just wanted to let you know.&lt;/p&gt;
&lt;p&gt;The issue is the &amp;quot;|=&amp;quot;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I played around with the timer values, and noticed that whenever one pin is cleared (LED is turned on), both of them were turned on. The reason for this is that it takes some time to clear the OUTCLR register.&lt;/p&gt;
&lt;p&gt;Try to set it to:&lt;/p&gt;
&lt;p&gt;port-&amp;gt;OUTCLR &amp;amp;= (1 &amp;lt;&amp;lt; pin_num);&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, we see that some people insist on using the registers directly, but we do have libraries for these kinds of tasks, that can save you a lot of time if you use them. I suggest that you consider it for the future &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;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>