<?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>Exceeding values when using the SAADC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/111891/exceeding-values-when-using-the-saadc</link><description>Good afternoon, 
 I am trying to use a function generator to send a sinusoidal function to my nRF7002 DK and I am vizualizing the values in Putty. I am sending with a frequency of 100kHz, 1.5 Vpp. I observed that I get a lot of values of -4096, which</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Jun 2024 12:03:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/111891/exceeding-values-when-using-the-saadc" /><item><title>RE: Exceeding values when using the SAADC</title><link>https://devzone.nordicsemi.com/thread/488120?ContentTypeID=1</link><pubDate>Mon, 10 Jun 2024 12:03:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b5ab1803-cd12-4079-ad7d-ddcd7c3e0568</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;Is your signal centered around 0V? if so it will be outside the GPIO range which has a minimum level of -0.3V. If this is the case, could you try to add a positive DC offset and see if the problem is exist?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Exceeding values when using the SAADC</title><link>https://devzone.nordicsemi.com/thread/487926?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2024 13:00:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e1ed337d-f89c-4f7c-802e-40fae5e55f74</guid><dc:creator>Raluca</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;1. SDK version: v2.5.99 - dev1. Answering this I realized I am in a dev branch, I will change and test it again.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;2.&lt;span&gt;This is my prj file.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;CONFIG_LOG=y

# Step 1 - Enable nrfx drivers #
CONFIG_NRFX_SAADC=y
CONFIG_NRFX_PPI=y
CONFIG_NRFX_DPPI=y
CONFIG_NRFX_TIMER2=y

CONFIG_LOG_BUFFER_SIZE=16384&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;3.&amp;nbsp;My device tree:&lt;br /&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/dts-v1/;
#include &amp;lt;nordic/nrf5340_cpuappns_qkaa.dtsi&amp;gt;
#include &amp;quot;nrf5340_cpuapp_common.dts&amp;quot;

/ {
	model = &amp;quot;Nordic NRF5340 DK NRF5340 Application&amp;quot;;
	compatible = &amp;quot;nordic,nrf5340-dk-nrf5340-cpuapp&amp;quot;;

	chosen {
		zephyr,sram = &amp;amp;sram0_ns;
		zephyr,flash = &amp;amp;flash0;
		zephyr,code-partition = &amp;amp;slot0_ns_partition;
		zephyr,entropy = &amp;amp;psa_rng;
	};

	psa_rng: psa-rng {
		compatible = &amp;quot;zephyr,psa-crypto-rng&amp;quot;;
		status = &amp;quot;okay&amp;quot;;
	};
};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
&lt;p&gt;4. The configuration of the ADC:&lt;br /&gt;&amp;nbsp;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void configure_saadc(void)
{
    nrfx_err_t err;

    /* STEP 5.4 - Connect ADC interrupt to nrfx interrupt handler */
    IRQ_CONNECT(DT_IRQN(DT_NODELABEL(adc)),
    DT_IRQ(DT_NODELABEL(adc), priority),
    nrfx_isr, nrfx_saadc_irq_handler, 0);

    /* STEP 5.5 - Initialize the nrfx_SAADC driver */
    err = nrfx_saadc_init(DT_IRQ(DT_NODELABEL(adc), priority));
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_init error: %08x&amp;quot;, err);

        return;
    }   

    
    /* STEP 5.6 - Declare the struct to hold the configuration for the SAADC channel used to sample the battery voltage */
    nrfx_saadc_channel_t channel = NRFX_SAADC_DEFAULT_CHANNEL_SE(NRF_SAADC_INPUT_AIN0, 0);

    /* STEP 5.7 - Change gain config in default config and apply channel configuration */
    channel.channel_config.gain = NRF_SAADC_GAIN1_6;
    err = nrfx_saadc_channels_config(&amp;amp;channel, 1);
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_channels_config error: %08x&amp;quot;, err);
        return;
    }

    /* STEP 5.8 - Configure channel 0 in advanced mode with event handler (non-blocking mode) */
    nrfx_saadc_adv_config_t saadc_adv_config = NRFX_SAADC_DEFAULT_ADV_CONFIG;
    err = nrfx_saadc_advanced_mode_set(BIT(0),
                                    NRF_SAADC_RESOLUTION_12BIT,
                                    &amp;amp;saadc_adv_config,
                                    saadc_event_handler);
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_advanced_mode_set error: %08x&amp;quot;, err);
        return;
    }
                                            
    /* STEP 5.9 - Configure two buffers to make use of double-buffering feature of SAADC */
    err = nrfx_saadc_buffer_set(saadc_sample_buffer[0], SAADC_BUFFER_SIZE);
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_buffer_set error: %08x&amp;quot;, err);
        return;
    }
    err = nrfx_saadc_buffer_set(saadc_sample_buffer[1], SAADC_BUFFER_SIZE);
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_buffer_set error: %08x&amp;quot;, err);
        return;
    }

    /* STEP 5.10 - Trigger the SAADC. This will not start sampling, but will prepare buffer for sampling triggered through PPI */
    err = nrfx_saadc_mode_trigger();
    if (err != NRFX_SUCCESS) 
    {
        LOG_ERR(&amp;quot;nrfx_saadc_mode_trigger error: %08x&amp;quot;, err);
        return;
    }

}&lt;/pre&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Maybe it will be clearer if I attach the entire project as well.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/5857.current_5F00_code.zip"&gt;devzone.nordicsemi.com/.../5857.current_5F00_code.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you so much!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Exceeding values when using the SAADC</title><link>https://devzone.nordicsemi.com/thread/487884?ContentTypeID=1</link><pubDate>Fri, 07 Jun 2024 11:35:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8ee59c0e-8944-4cc2-ac81-edaff3f77534</guid><dc:creator>runsiv</dc:creator><description>&lt;p&gt;Hi Raluca&lt;/p&gt;
&lt;p&gt;It sounds to me like there might be some configuration issues here. Could you please provide the following information:&lt;/p&gt;
&lt;p&gt;1. SDK version&lt;/p&gt;
&lt;p&gt;2. Your prj.conf&lt;/p&gt;
&lt;p&gt;3. Your device tree&lt;/p&gt;
&lt;p&gt;4. The ADC part of the application&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;Runar&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>