<?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>NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/126837/nrf54l15---adc_channel_setup_dt---invalid-argument--22</link><description>Based on the DevAcademy here is my following setup using a custom NRF54L15 chip with the NRF54L15-DK devicetree with following overlay: 
 prj.conf: 
 
 CONFIG_GPIO =y 
 
 CONFIG_ADC =y code: ADC pin is 1.05. I also tried to use io-channels = &amp;lt; &amp;amp; adc 0</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 05 Feb 2026 15:37:05 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/126837/nrf54l15---adc_channel_setup_dt---invalid-argument--22" /><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560474?ContentTypeID=1</link><pubDate>Thu, 05 Feb 2026 15:37:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1662e799-c382-408d-8248-6bc1457dd8f5</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good to hear that.&amp;nbsp;Actually this is possible with a high-impedance divider. GPIO pins default to a digital configuration, and with a 2 MΩ / 510 kΩ source the pin can be internally biased toward VIN (3.3 V), so the ADC ends up measuring that instead of the divider voltage.&lt;/p&gt;
&lt;p&gt;Resetting the pin to a default state with nrf_gpio_cfg_default() removes the internal GPIO influence and allows the SAADC to see the correct voltage. So yes this is a reasonable practice for such inputs.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560378?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 18:37:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3d3da1d9-4ae9-401d-92ed-a236a3e3135f</guid><dc:creator>Leschge</dc:creator><description>&lt;p&gt;Another question. I have a voltage divider with 2M&lt;span&gt;&amp;Omega; and 510k&amp;Omega;, which results on a 4.2V battery at 0.8V. Now I discovered that AIN1 (P1.05) are always at VIN 3.3V. It does not matter if the pin is floating or if its connected to my voltage divider. How can that be? Is it misconfigured?&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;&amp;amp;adc {
    status = &amp;quot;okay&amp;quot;;
    #address-cells = &amp;lt;1&amp;gt;;
    #size-cells = &amp;lt;0&amp;gt;;
    channel@1 {
        reg = &amp;lt;1&amp;gt;;
        zephyr,gain = &amp;quot;ADC_GAIN_1_4&amp;quot;;
        zephyr,reference = &amp;quot;ADC_REF_INTERNAL&amp;quot;;
        zephyr,acquisition-time = &amp;lt;ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 40)&amp;gt;; // Increased to 40us for your 2M Ohm divider
        zephyr,input-positive = &amp;lt;NRF_SAADC_AIN1&amp;gt;;
        zephyr,resolution = &amp;lt;12&amp;gt;;
    };
};&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;&lt;span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;EDIT:&amp;nbsp;&lt;br /&gt;Adding the following config command resolved the issue:&lt;br /&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;nrf_gpio_cfg_default&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;NRF_GPIO_PIN_MAP&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;1&lt;/span&gt;&lt;span&gt;, &lt;/span&gt;&lt;span&gt;5&lt;/span&gt;&lt;span&gt;));&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Is this the default procedure when dealing with high-impedance analog inputs?&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560372?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 16:56:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d0173152-7502-4437-9038-a99a0f14fc5f</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for your response. You can check the following link showing the supported gains:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf54L15/page/saadc.html#ariaid-title52"&gt;https://docs.nordicsemi.com/bundle/ps_nrf54L15/page/saadc.html#ariaid-title52&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Which shows that&amp;nbsp;nRF54L15 hardware does not support 1/6 gain.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560370?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 16:47:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a75005d3-8245-4840-918c-d10fe01ae0f3</guid><dc:creator>Leschge</dc:creator><description>&lt;p&gt;3.0.2&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560368?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 16:24:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fb005365-a458-4d1b-8a65-778c474994b3</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you please share which NCS version you are using? I’d like to double-check the behavior of ADC_GAIN_1_6.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Regarding the reference selection, as mentioned in&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="https://docs.nordicsemi.com/bundle/ps_nrf54L15/page/saadc.html#ariaid-title12"&gt;SAADC reference&lt;/a&gt;&lt;span&gt;&amp;nbsp;SAADC driver supports ADC_REF_INTERNAL (which maps to the 0.9 V internal reference) and external reference. For an external reference, it is recommended to stay within +-5% of the internal reference voltage.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560335?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 12:47:51 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bffc1fb5-9fb5-4aa7-91d8-d55991d24582</guid><dc:creator>Leschge</dc:creator><description>&lt;p&gt;Thanks a lot for the fast support! It worked. I am wondering where its documented that&amp;nbsp;ADC_GAIN_1_6 is not supported? I&amp;nbsp;also skimmed through the sdk code but did not find it.&lt;br /&gt;&lt;br /&gt;Edit: Also where do I find which refrerence input can be set? E.g.&amp;nbsp;ADC_REF_VDD_1 also leads to error -22&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF54L15 - adc_channel_setup_dt - Invalid argument (-22)</title><link>https://devzone.nordicsemi.com/thread/560331?ContentTypeID=1</link><pubDate>Wed, 04 Feb 2026 12:23:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e69ca42b-74a7-40ad-b59a-7ea72f5b9705</guid><dc:creator>Syed Maysum Abbas Zaidi</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Thanks for the detailed setup and code. The -22 (EINVAL) is most likely caused by an unsupported ADC gain setting on nRF54L15. Could you please try changing the channel gain in &amp;amp;adc to ADC_GAIN_1_4 in your devicetree:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;zephyr,gain = &amp;quot;ADC_GAIN_1_4&amp;quot;;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;This gain is recommended for nRF54L15 and is used in&amp;nbsp;&lt;a href="https://academy.nordicsemi.com/courses/nrf-connect-sdk-intermediate/lessons/lesson-6-analog-to-digital-converter-adc/topic/exercise-2-interfacing-with-adc-using-nrfx-driver-and-software-timers/#uagb-tabs__tab1"&gt;nRF Connect SDK Intermediate Course&lt;/a&gt;. Let us know if this resolves the issue.&lt;/p&gt;
&lt;p&gt;Best Regards,&lt;br /&gt;Syed Maysum&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>