<?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>Share pin between SAADC and digital interface</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/84522/share-pin-between-saadc-and-digital-interface</link><description>Hi, 
 I&amp;#39;m using nRF52840 - QIAAD0 (it&amp;#39;s revision 2 I think) and nrfx_saadc API v2 (but I don&amp;#39;t think it doesn&amp;#39;t really matter here) 
 tl;dr As stated in SAADC peripheral documentation &amp;quot; When enabled, the SAADC will acquire access to analog input pins</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 10 Feb 2022 10:07:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/84522/share-pin-between-saadc-and-digital-interface" /><item><title>RE: Share pin between SAADC and digital interface</title><link>https://devzone.nordicsemi.com/thread/352272?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 10:07:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:54a3032f-07a9-418e-8d97-a47fc2e9ee4e</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;I have created internal tickets to look into peripheral documentation and clearing pins in nrfx_saadc_uninit_v2_api.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Share pin between SAADC and digital interface</title><link>https://devzone.nordicsemi.com/thread/352218?ContentTypeID=1</link><pubDate>Thu, 10 Feb 2022 07:33:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41cae82d-42e5-4cca-a180-b26c7c6f17ae</guid><dc:creator>Tomasz K</dc:creator><description>&lt;p&gt;Hi, thanks for an answer.&lt;br /&gt;It makes complete sense and also matches what I observed. Indeed docs are slightly misleading here.&lt;br /&gt;&lt;br /&gt;I&amp;#39;m using currently nRF SDK 17.1.0 which supports two nrfx_saadc implementations.&lt;br /&gt;Older one indeed clears channel configuration on uninit:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrf_saadc_disable();
m_cb.adc_state = NRF_SAADC_STATE_IDLE;

for (uint32_t channel = 0; channel &amp;lt; NRF_SAADC_CHANNEL_COUNT; ++channel)
{
    if (m_cb.psel[channel].pselp != NRF_SAADC_INPUT_DISABLED)
    {
        nrfx_err_t err_code = nrfx_saadc_channel_uninit(channel);
        NRFX_ASSERT(err_code == NRFX_SUCCESS);
    }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;However, the newer one (called API_v2) doesn&amp;#39;t have it implemented:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;nrfx_saadc_abort();
NRFX_IRQ_DISABLE(SAADC_IRQn);
nrf_saadc_disable();
m_cb.saadc_state = NRF_SAADC_STATE_UNINITIALIZED;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;To do it the way you suggest, I would have to call &amp;quot;nrfx_saadc_channels_config&amp;quot; with all previously used pins set to &amp;quot;NRF_SAADC_INPUT_DISABLED&amp;quot; and then uninit saadc which isn&amp;#39;t really intuitive.&lt;br /&gt;&lt;br /&gt;As far as I see, nrfx_saadc implementation available on github has already &amp;quot;nrfx_saadc_channels_deconfig&amp;quot; implemented, which does exactly what is needed, however there is no information available that it needs to be called and it&amp;#39;s also not automatically called on uninit.&lt;br /&gt;&lt;br /&gt;Maybe it will be good idea to write separate ticket for it, so it can be modified or better explained in future releases?&lt;br /&gt;&lt;br /&gt;Thanks again for help, I will implement it and give it a go.&lt;br /&gt;&lt;br /&gt;Best regards&lt;br /&gt;Tomasz&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Share pin between SAADC and digital interface</title><link>https://devzone.nordicsemi.com/thread/352159?ContentTypeID=1</link><pubDate>Wed, 09 Feb 2022 16:40:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bd5ffefe-27e8-433d-9b36-9d1648cf1033</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As far as I can see, the analog pins are acquired as soon as they are configured in the PSELP/PSELN registers, not when the SAADC-&amp;gt;ENABLE register is set. Similar, the analog pins are released when the PSELP/PSELN registers are cleared.&lt;/p&gt;
&lt;p&gt;The comment in the ENABLE register documentation may thus be a bit inaccurate, as the ENABLE register does .&lt;/p&gt;
&lt;p&gt;Our SAADC driver clears the pin config in the uninit-function, and I would recommend you do the same in your application when you want to use the pins for digital peripherals.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Jørgen&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>