<?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 in SAADC API V2</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/80636/nrfx_saadc_abort-in-saadc-api-v2</link><description>I&amp;#39;m using nrfx_saadc V2 in nRF5 SDK 17.0.2. In nrfx_saadc_abort nrf_saadc_task_trigger(NRF_SAADC_TASK_STOP); is called regardless of if the ADC is currently running. If the ADC is not running this pending task causes several mA of current consumption</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 16 Dec 2021 15:09:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/80636/nrfx_saadc_abort-in-saadc-api-v2" /><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/343972?ContentTypeID=1</link><pubDate>Thu, 16 Dec 2021 15:09:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4eb8b81e-9e6d-4e77-bcf0-8b78b16182f4</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Thank you for your continued patience with this.&lt;br /&gt;&lt;br /&gt;I have just gotten back to this, and after examining the driver more closely it seems that the NRFX_ASSERT at the beginning of nrfx_saadc_abort should have triggered to alert you to the fact that the abort call was made when the SAADC was already uninitialized. In general, calling HAL or driver functions on an uninitialized peripheral may produce undefined behavior.&lt;br /&gt;&lt;br /&gt;To avoid this happening in the future, I would recommend that you defined DEBUG_NRF in your preprocessor defines during your development, so that the NRFX_ASSERTS are enabled. This way, you will be notified if this or something similar ever happens again in the future. After having tested and verified your application you can safely remove the DEBUG_NRF define.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/336441?ContentTypeID=1</link><pubDate>Thu, 28 Oct 2021 11:30:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8078522d-44a8-4233-b2f8-2419cb9a890a</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;Thank you for your patience.&lt;/p&gt;
[quote user="nrbrook"]I haven&amp;#39;t tested this myself but I do not think I am doing anything particularly unique that would trigger this issue, I think it is likely to occur whenever the ADC is already stopped and the stop task is triggered. I assume that the task can&amp;#39;t be completed because the ADC is not running, so the CPU continues to run (I don&amp;#39;t know how the internal mechanisms of the tasks and CPU operate).[/quote]
&lt;p&gt;I think this sounds unlikely, since we have a lot of functionality implemented to get the CPU to idle as soon as possible, and avoid these kinds of hangups, but I will have to test this myself before I can say this for sure.&lt;/p&gt;
[quote user="nrbrook"]I don&amp;#39;t think it is necessary for the BLE connection to be active (or even the radio at all). I am fairly sure this condition occurred without the radio active, but my current measurement was from after the connection occurred.[/quote]
&lt;p&gt;This suffices as a working hypothesis that I may test out on my end, thank you for elaborating.&lt;/p&gt;
[quote user="nrbrook"]If you have difficulty reproducing the issue I can look in to what I might be doing differently.[/quote]
&lt;p&gt;Thank you. With this information I can do a test to try to replicate it on my end. I will update you as soon as I have had the chance to do so.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/335694?ContentTypeID=1</link><pubDate>Mon, 25 Oct 2021 11:05:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd25bc0a-cd87-4696-af88-292f86024724</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Hi Karl, here is some example code but no I don&amp;#39;t think there is an example project:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://github.com/NordicSemiconductor/nrfx/wiki/SAADC-Advanced-mode-with-IRQs"&gt;https://github.com/NordicSemiconductor/nrfx/wiki/SAADC-Advanced-mode-with-IRQs&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I haven&amp;#39;t tested this myself but I do not think I am doing anything particularly unique that would trigger this issue, I think it is likely to occur whenever the ADC is already stopped and the stop task is triggered. I assume that the task can&amp;#39;t be completed because the ADC is not running, so the CPU continues to run (I don&amp;#39;t know how the internal mechanisms of the tasks and CPU operate).&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t think it is necessary for the BLE connection to be active (or even the radio at all). I am fairly sure this condition occurred without the radio active, but my current measurement was from after the connection occurred.&lt;/p&gt;
&lt;p&gt;If you have difficulty reproducing the issue I can look in to what I might be doing differently.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/335591?ContentTypeID=1</link><pubDate>Sun, 24 Oct 2021 15:57:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95f3343f-16d2-4ffe-bc67-715f7bcf8cda</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;Thank you for your patience with this.&lt;br /&gt;It is the &lt;em&gt;pending task&lt;/em&gt; + &lt;em&gt;idling CPU&lt;/em&gt; = &lt;em&gt;increased power consumption&lt;/em&gt; that I am having trouble understanding. The 4.7 mA constant current consumption indicates that the CPU is running constantly, but at the same time it is not clearing the pending task?&lt;br /&gt;I would then suspect that the CPU is busy with some other task - or perhaps even busy-waiting - somewhere with a higher-priority for the duration of the increased power consumption. Could there be a possibility for this at all in your application?&lt;br /&gt;&lt;br /&gt;I will have to test this on my end, to see if I am able to replicate the behavior you are seeing.&lt;/p&gt;
[quote user="nrbrook"]I think if you use the standard SAADC v2 example it will exhibit the behaviour, but I haven&amp;#39;t tested it.[/quote]
&lt;p&gt;Could you be specific about which example you are referring to here? The nRF5 SDK does not contain an example using the SAADC v2 driver.&lt;br /&gt;You also mentioned that your application is in a BLE connection when this happens.&lt;br /&gt;Is it necessary to be in a connection to see the behavior?&lt;br /&gt;If so, would you think that a SAADC v2 + BLE UART example combination should suffice to replicate it?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334943?ContentTypeID=1</link><pubDate>Tue, 19 Oct 2021 17:06:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:26f4aaf7-d129-48e0-b239-3bdfb6828a94</guid><dc:creator>nrbrook</dc:creator><description>[quote userid="87869" url="~/f/nordic-q-a/80636/nrfx_saadc_abort-in-saadc-api-v2/334564#334564"]That is interesting! How long would these extended periods of time be?[/quote]
&lt;p&gt;With the task pending (existing implementation) &amp;ndash; ~4.7mA constantly until system off (when I call nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_STAY_IN_SYSOFF);). Resetting will reduce power consumption as task will not be pending.&lt;/p&gt;
&lt;p&gt;Without task pending (checking for busy before starting STOP task) &amp;ndash; ~50uA average current, with small peaks during radio or CPU activity (as normal)&lt;/p&gt;
&lt;p&gt;I think if you use the standard SAADC v2 example it will exhibit the behaviour, but I haven&amp;#39;t tested it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334564?ContentTypeID=1</link><pubDate>Mon, 18 Oct 2021 11:16:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:08a66c46-52d2-48db-ae41-91676d8b1b6f</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Thank you for elaborating.&lt;/p&gt;
[quote user="nrbrook"]When I added the busy check current consumption doesn&amp;#39;t get that high for extended periods of time (only during radio or CPU active)[/quote]
&lt;p&gt;That is interesting! How long would these extended periods of time be?&lt;/p&gt;
[quote user="nrbrook"]Current consumption after calling abort is constant at 4.7mA until power off (because the CPU is stopped) with the existing code.[/quote]
&lt;p&gt;You say that this goes on from the _abort call until power off because the CPU is stopped, could you elaborate on this? If you mean that the CPU is in SYSTEM_ON sleep (idle) it should not have gone halfway through the _abort call before entering the SYSTEM_ON sleep. When you say until power off, does this mean that you require a power cycle or device reset in order to see the current consumption go down again? If I am understanding what you are saying here correctly it does indeed not sound right at all.&lt;br /&gt;&lt;br /&gt;Have you based your application on a specific example, or do you have a minimal project that demonstrates this behavior?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334308?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 10:29:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2ab0358e-3483-4857-a4a1-8b4409436a62</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;By &amp;quot;connected&amp;quot; I just meant connected as a Bluetooth peripheral.&lt;/p&gt;
&lt;p&gt;Current consumption after calling abort is constant at 4.7mA until power off (because the CPU is stopped) with the existing code. When I added the busy check current consumption doesn&amp;#39;t get that high for extended periods of time (only during radio or CPU active)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334306?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 10:25:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7922a943-0f2b-49f9-9887-d5d84c6f894b</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;I&amp;#39;m glad to hear that you&amp;#39;ve already implemented a change that achieves the functionality you were after!&lt;br /&gt;Could you elaborate what you mean when you say connected - are you here exclusively talking about the scenario in which the SoftDevice takes control of the CPU before the task is processed?&lt;br /&gt;How long is the duration of the added 4.7 mA consumption, compared to when you&amp;#39;ve added the busy check?&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334297?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 09:46:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1854393-3609-45cd-a4a3-29f85d2c1305</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Hi, the pending task keeps the CPU active which does cause several mA of current consumption. I already surrounded with a busy check which fixed the issue and reduced current consumption from 4.7mA to 50uA when connected.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334287?ContentTypeID=1</link><pubDate>Fri, 15 Oct 2021 09:08:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1df4d136-1b9c-4b84-9b45-277f470c5b0b</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello again,&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve given this some more though- the STOP task should complete pretty much instantly if the SAADC is not currently busy anyways, so unless your application uninits and reinits the SAADC at a high frequency I would think that these added instructions will cause a &lt;span&gt;negligible increase in overall power consumption. Especially so when it prevents you from leaving the SAADC in a higher-power state if the uninit fails.&lt;br /&gt;If you think that this is causing excess power consumption in your application you may modify the driver to check for the SAADC&amp;#39;s current state, and not to trigger the STOP task if it is not active. You could then measure the average power consumption to see how this influences your applications consumption.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrfx_saadc_abort in SAADC API V2</title><link>https://devzone.nordicsemi.com/thread/334212?ContentTypeID=1</link><pubDate>Thu, 14 Oct 2021 14:54:40 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bc63c9e-ab03-4158-8e91-5c4351552a53</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;Thank you for bringing this to our attention. I will create an internal ticket with the developers of the SAADC driver and ask them to investigate this further.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Karl&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>