<?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>nrfx_saadc_abort() seems to be broken</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/56740/nrfx_saadc_abort-seems-to-be-broken</link><description>Hi, 
 I&amp;#39;m new to nRF52 and the SDK, trying a few things to learn, so might be missing something obvious, but I&amp;#39;ve been looking at this apparent issue for a few days now. 
 My test setup: 
 
 nRF52840 DK 
 SDK v16.0.0, 15.3.0 and 15.2.0 (see below) 
 no</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 29 Jan 2020 10:01:29 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/56740/nrfx_saadc_abort-seems-to-be-broken" /><item><title>RE: nrfx_saadc_abort() seems to be broken</title><link>https://devzone.nordicsemi.com/thread/231589?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 10:01:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c010079-e915-4352-9b9d-fc5c6dcbb26d</guid><dc:creator>David Meiklejohn</dc:creator><description>&lt;p&gt;Got it!&amp;nbsp; Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort() seems to be broken</title><link>https://devzone.nordicsemi.com/thread/231580?ContentTypeID=1</link><pubDate>Wed, 29 Jan 2020 09:48:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da0703e6-790b-4268-bcee-58f4f8d1e616</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;The problem is not related to the SAADC driver, but the example itself. The function &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples/blob/sdk_15.2.0_migration/saadc_low_power/main.c#L161"&gt;&lt;em&gt;nrf_drv_saadc_abort()&amp;nbsp;&lt;/em&gt;is called from an interrupt context&lt;/a&gt;, which causes a deadlock, since &lt;em&gt;nrf_drv_saadc_abort()&amp;nbsp;&lt;/em&gt;is waiting for an interrupt itself.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;If you move nrf_drv_saadc_abort &lt;a href="https://github.com/NordicPlayground/nRF52-ADC-examples/blob/sdk_15.2.0_migration/saadc_low_power/main.c#L274"&gt;to &lt;em&gt;main()&lt;/em&gt;&lt;/a&gt;&lt;em&gt;, &lt;/em&gt;the problem goes away.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;
&lt;div style="left:173px;position:absolute;top:34px;" id="gtx-trans"&gt;
&lt;div class="gtx-trans-icon"&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort() seems to be broken</title><link>https://devzone.nordicsemi.com/thread/231265?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 22:12:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7ac3b72f-76a7-454d-b30e-a64dc5c092c8</guid><dc:creator>David Meiklejohn</dc:creator><description>&lt;p&gt;Thanks Simon.&lt;/p&gt;
&lt;p&gt;I hesitate to modify the SDK code (messy when it comes to version control and tracking dependencies), but I could certainly make my own version of&amp;nbsp;nrfx_saadc_abort() based on this and use that.&lt;/p&gt;
&lt;p&gt;Thanks again.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort() seems to be broken</title><link>https://devzone.nordicsemi.com/thread/231229?ContentTypeID=1</link><pubDate>Mon, 27 Jan 2020 15:52:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2f094b0e-e442-42f5-b65e-86e15a1b7fd6</guid><dc:creator>Simon</dc:creator><description>&lt;p&gt;This seems like a bug, since&amp;nbsp;&lt;em&gt;nrfx_saadc_irq_handler()--&amp;gt;if (nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED))--&amp;gt;m_cb.adc_state = NRF_SAADC_STATE_IDLE&amp;nbsp;&lt;/em&gt;is never triggered&lt;/p&gt;
&lt;p&gt;I have reported the issue and I&amp;#39;m currently waiting for an answer. However, if&amp;nbsp;nrfx_saadc_abort() is modified accordingly it works fine:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;void nrfx_saadc_abort(void)
{
    .
    .
    .
        {
            // Wait for ADC being stopped.
            bool result;
            //NRFX_WAIT_FOR((m_cb.adc_state == NRF_SAADC_STATE_IDLE), HW_TIMEOUT, 0, result);
            //NRFX_ASSERT(result);
            NRFX_WAIT_FOR(nrf_saadc_event_check(NRF_SAADC_EVENT_STOPPED), HW_TIMEOUT, 0, result);
            NRFX_ASSERT(result);
        }
    .
    .
}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>