<?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>RADIO_IRQHandler called twice in quick succession</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/48335/radio_irqhandler-called-twice-in-quick-succession</link><description>While investigating my stack corruption issue , I noticed that the RADIO_IRQHandler is always called twice in quick succession: 
 
 But the NRF_RADIO-&amp;gt;INTENSET register only has the DISABLED interrupt listed as activated., but only within the first call</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 07 Jun 2019 16:10:06 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/48335/radio_irqhandler-called-twice-in-quick-succession" /><item><title>RE: RADIO_IRQHandler called twice in quick succession</title><link>https://devzone.nordicsemi.com/thread/191704?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 16:10:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:40faef46-b6fb-4c93-8551-fb3a67367154</guid><dc:creator>m.wagner</dc:creator><description>&lt;p&gt;It looks like calling NVIC_ClearPendingIRQ(RADIO_IRQn) before re-enabling the radio indeed does the trick.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: RADIO_IRQHandler called twice in quick succession</title><link>https://devzone.nordicsemi.com/thread/191703?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2019 16:04:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b820c98c-5bc6-4da3-96a0-d8e4c5787518</guid><dc:creator>m.wagner</dc:creator><description>&lt;p&gt;Okay, I just noticed that this piece of code usually gets called in the first call to RADIO_IRQHandler:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    NRF_RADIO-&amp;gt;SHORTS = m_radio_shorts_common;
    update_rf_payload_format(m_config_local.payload_length);
    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)m_rx_payload_buffer;
    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0;
    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1;

    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0);

    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0;
    NRF_RADIO-&amp;gt;SHORTS = m_radio_shorts_common | RADIO_SHORTS_DISABLED_TXEN_Msk;

    NRF_RADIO-&amp;gt;TASKS_RXEN = 1;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;I assume this has to do with the double trigger?&lt;/p&gt;
&lt;p&gt;This code forces the radio to stop if no valid packet has been received, because the SHORTS-configuration would put the RADIO in TX state at this moment.&lt;/p&gt;
&lt;p&gt;So, I assume that the fact, that the radio is disabled again and the events register is cleared results in the Interrupt being pended and the handler being executed immediately after.&lt;/p&gt;
&lt;p&gt;I tried disabling the DISABLED interrupt during this operation and re-enabling it before starting the radio, but to no avail.&lt;/p&gt;
&lt;p&gt;Is there a way to achieve the same behaviour as outlined above (i.e. forcing the readio to stop) without the interrupt being pended?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>