<?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>Problems with the use of ADC at low power</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70504/problems-with-the-use-of-adc-at-low-power</link><description>Hi, everyone, 
 I am pretty new to nRF52 development. Right now,I want to turn SAADC off at low power and turn it back on when wake up, but after nrfx_saadc_uninit(); When I use user_adc_init() again, the SAADC state is always busy.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 15 Jan 2021 14:01:21 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70504/problems-with-the-use-of-adc-at-low-power" /><item><title>RE: Problems with the use of ADC at low power</title><link>https://devzone.nordicsemi.com/thread/289453?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 14:01:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d2c0490-49e0-4a46-aae1-8ffb9f5dfb66</guid><dc:creator>Karl Ylvisaker</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user=""]I am pretty new to nRF52 development. [/quote]
&lt;p&gt;Welcome!&lt;/p&gt;
[quote user=""]Right now,I&lt;span&gt;&amp;nbsp;want to turn SAADC off at low power and turn it back on when wake up, but after &amp;nbsp;nrfx_saadc_uninit();&lt;/span&gt;&lt;span&gt;When I use user_adc_init() again, the SAADC state is always busy.&lt;/span&gt;[/quote]
&lt;p&gt;First, could you tell me which SDK version you are working with, and whether you are using an nRF52 Development Kit, or a custom board?&lt;br /&gt;&lt;br /&gt;The &lt;em&gt;&lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__nrfx__saadc.html&amp;amp;anchor=ga94a7376973f1726b22a5debc090763eb"&gt;nrf_drv_saadc_buffer_convert&lt;/a&gt;&lt;/em&gt;&amp;nbsp;function will return NRF_ERROR_BUSY if SAADC calibration is ongoing, or if the SAADC already is setup with two buffers. Could you ensure that neither of this is the case? It is hard to be sure when only seeing select lines from your code.&lt;br /&gt;Could you possibly share the entire project&amp;#39;s code? That would make spotting issues much easier. Is your application based on an example from the SDK, or code you have found elsewhere?&lt;em&gt;&lt;br /&gt;&lt;br /&gt;&lt;/em&gt;Furthermore, I highly recommend triggering the sampling through the &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.0.2%2Fgroup__nrf__saadc__hal.html&amp;amp;anchor=ggacde3c3040c12e04f9edc2bc92c1b2276a53f835ed3f4b6e9ff24d1550ead3c941"&gt;NRF_SAADC_TASK_SAMPLE&lt;/a&gt;&amp;nbsp;task through PPI, rather than calling nrf_drv_saadc_sample every sample. I would also recommend that you do not use&amp;nbsp;&lt;em&gt;magic numbers&lt;/em&gt; in your code, to save yourself from a lot of troubles down the line, in your programming career! &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;br /&gt;&lt;br /&gt;Looking forward to resolving this issue together!&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: Problems with the use of ADC at low power</title><link>https://devzone.nordicsemi.com/thread/289348?ContentTypeID=1</link><pubDate>Fri, 15 Jan 2021 08:38:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b0d1603c-e5b7-40a3-b2ee-50a80be1e2cc</guid><dc:creator>supper xie</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;void user_adc_init(void)
{
	ret_code_t errCode;
	user_adc_enable();
    nrf_saadc_channel_config_t channel_config =
        NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN3);

    errCode = nrf_drv_saadc_init(NULL, saadc_callback);
    APP_ERROR_CHECK(errCode);

    errCode = nrf_drv_saadc_channel_init(3, &amp;amp;channel_config);
    APP_ERROR_CHECK(errCode);


	errCode = nrf_drv_saadc_buffer_convert(m_buffer_pool, 1);
    APP_ERROR_CHECK(errCode);


}

void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
{
	float adcval;
	ret_code_t err_code;
    if (p_event-&amp;gt;type == NRF_DRV_SAADC_EVT_DONE)
    {
        ret_code_t err_code;

        err_code = nrf_drv_saadc_buffer_convert(p_event-&amp;gt;data.done.p_buffer, 1);
        APP_ERROR_CHECK(err_code);
			adcval = (float)p_event-&amp;gt;data.done.p_buffer[0]*3.6;
    }
}

void user_adc_read(void)
{
	ret_code_t errCode;
	errCode = nrf_drv_saadc_sample();
	APP_ERROR_CHECK(errCode);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>