<?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>Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/51071/stopping-saadc-after-buffer-convert-using-ppi</link><description>I&amp;#39;m using a timer to read the ADC repeatedly using PPI. On ADC read finish I call nrfx_saadc_buffer_convert ready for the next timer event. However, if I want to cancel conversion before the next timer event I stop the timer and call nrfx_saadc_abort</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 21 Aug 2019 09:17:25 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/51071/stopping-saadc-after-buffer-convert-using-ppi" /><item><title>RE: Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/thread/205237?ContentTypeID=1</link><pubDate>Wed, 21 Aug 2019 09:17:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4d4d7bd7-6086-41c4-9500-87f383684d72</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Good that you have a workaround for this and the workaround looks sensible too. It seems like a bug trying to abort immediately after buffer_convert.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/thread/205051?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 13:09:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39e4955f-f143-42e0-a4f7-66781c16a925</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;I&amp;#39;ve changed my code now to work around the issue by calling sample and waiting for the next ADC result. But to reproduce, roughly:&lt;/p&gt;
&lt;p&gt;init saadc and a channel&lt;/p&gt;
&lt;p&gt;call buffer_convert on the channel&lt;/p&gt;
&lt;p&gt;call abort, will hit assert&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/thread/205019?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2019 12:24:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c606316-27f9-4913-8231-a3ad4d049199</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;That does not look correct, Seems like a bug in the nrfx. But before confirming that it is a bug and giving you a possible workaround, can you please give me your project (or stripped version of it) for me to replicate this and analyze it a bit closer?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/thread/204526?ContentTypeID=1</link><pubDate>Fri, 16 Aug 2019 13:21:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ce57487-a1a7-49d3-a61f-fcdb89306796</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;I am running SAADC in low power mode, so all the&amp;nbsp;nrfx_saadc_buffer_convert function does is init the buffer and enable interrupts. The sampling is started on the timer. So when abort is called before sample, there is no task to stop (the state in SAADC is busy, but the ADC isn&amp;#39;t actually doing anything), so it waits for the state to be idle but the state is not changed by anything, so that fails and it hits the assert:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;// 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);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Stopping SAADC after buffer convert using PPI</title><link>https://devzone.nordicsemi.com/thread/204480?ContentTypeID=1</link><pubDate>Fri, 16 Aug 2019 11:30:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:316aea47-d499-4777-8a41-2998f122b2c2</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;When you call&amp;nbsp;&lt;span&gt;nrfx_saadc_buffer_convert&amp;nbsp;,&amp;nbsp;m_cb.adc_state = NRF_SAADC_STATE_BUSY;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;If you call&amp;nbsp;nrfx_saadc_abort before sampling&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;then it checks for the busy state as below&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    if (nrfx_saadc_is_busy())
    {
        xxx
    }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;The&amp;nbsp;nrfx_saadc_is_busy will return true since&amp;nbsp;nrfx_saadc_buffer_convert marked it so. Hence it should go ahead with trigger the STOP task.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]However, if I want to cancel conversion before the next&amp;nbsp;timer event I stop the timer and call nrfx_saadc_abort. This fails because the ADC isn&amp;#39;t converting, but nrfx_saadc_buffer_convert set the state to busy.[/quote]
&lt;p&gt;&amp;nbsp;I think you misunderstood&amp;nbsp;nrfx_saadc_abort-&amp;gt;nrfx_saadc_is_busy condition.&lt;/p&gt;
&lt;p&gt;Or maybe I misunderstood your question. If so, excuse me and please help me understand the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>