This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

The issue in ADC in nrf52840

Hi,

I am trying to integrate ADC in my project(ble_app_template) but getting garbage data. I have nothing connected with pin P0.4(NRF_SAADC_INPUT_AIN1). (Means not applied any voltage)


The behavior is the same with/without connecting NRF_SAADC_INPUT_AIN1 with input signal.
Here is my implementation.


void saadc_init(void)
{
	// A variable to hold the error code
  ret_code_t err_code;

  // Create a config struct and assign it default values along with the Pin number for ADC Input
  // Configure the input as Single Ended(One Pin Reading)
  // Make sure you allocate the right pin.
//  nrf_saadc_channel_config_t channel_config = NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
 nrf_saadc_channel_config_t channel_config = NRFX_SAADC_DEFAULT_CHANNEL_CONFIG_DIFFERENTIAL(NRF_SAADC_INPUT_VDD,NRF_SAADC_INPUT_AIN1);

  // Initialize the saadc 
  // first parameter is for configuring the adc resolution and other features, we will see in future tutorial
  //on how to work with it. right now just pass a simple null value
  err_code = nrf_drv_saadc_init(NULL, saadc_callback_handler);
  APP_ERROR_CHECK(err_code);

// Initialize the Channel which will be connected to that specific pin.
  err_code = nrfx_saadc_channel_init(0, &channel_config);
  APP_ERROR_CHECK(err_code);

  

}


    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
		// a blocking function which will be called and the processor waits until the value is read
		// the sample value read is in 2's complement and is automatically converted once retrieved
		// first parameter is for the adc input channel 
		// second parameter is to pass the address of the variable in which we store our adc sample value
      nrfx_saadc_sample_convert(0, &adc_val);

		// print this value using nrf log : here %d represents the integer value 
      NRF_LOG_INFO("Sample value Read: %d", adc_val);
		
		// use nrf log and float marker to show the floating point values on the log
		// calculate the voltage by this: input_sample * 3.6 / 2^n (where n = 8 or 10 or 12 or 14 depending on our configuration for resolution in bits)
      NRF_LOG_INFO("Volts: " NRF_LOG_FLOAT_MARKER "\r\n", NRF_LOG_FLOAT(adc_val  / 16384));
       
	   // give 500ms delay 
       nrf_delay_ms(2000);

    }





Any suggestions, please?

Parents Reply Children
  • Thanks,
    I have tried the above-mentioned project. Here is the ADC reading I am getting.



    Applied Voltage On pin(P0.4)                             nRF52840 Reading
                    (mV)                                                                (mV)


    1000                                                                               798-810
    1500                                                                               1216-1225
    2000                                                                               1622-1629
    2500                                                                               2023-2027
    3000                                                                               2425



    1-Can you please suggest how can I improve its reading/accuracy?
    2-I am also attaching my code. I want a function, when I call that function it gives me current ADC reading on P0.4. Can you please guide how can I do that(remove the timer from this code)?

    Thanks!

    /**
     * Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
     *
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     *    list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    /*
        Simplified SAADC example.
        Author : Abdelali Boussetta
     */
    
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <string.h>
    #include "nrf.h"
    #include "nrf_drv_saadc.h"
    #include "nrf_drv_ppi.h"
    #include "nrf_drv_timer.h"
    #include "boards.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "app_util_platform.h"
    #include "nrf_pwr_mgmt.h"
    
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    
    
    #define RES_14BIT                           16384                                    /**< Maximum digital value for 12-bit ADC conversion. */
    #define RES_12BIT                           4096                                    /**< Maximum digital value for 12-bit ADC conversion. */
    #define RES_10BIT                           1024                                    /**< Maximum digital value for 10-bit ADC conversion. */
    
    #define ADC_RES                             RES_12BIT
    #define ADC_REF_VOLTAGE_IN_MILLIVOLTS       600                                     /**< Reference voltage (in milli volts) used by ADC while doing conversion. */
    #define ADC_PRE_SCALING_COMPENSATION        5                                       /**< The ADC is configured to use VDD with 1/5 prescaling as input. And hence the result of conversion is to be multiplied by 3 to get the actual value of the battery voltage.*/                                
    
    
    #define ADC_RESULT_IN_MILLI_VOLTS(ADC_VALUE)\
             ((((ADC_VALUE) * ADC_REF_VOLTAGE_IN_MILLIVOLTS) / ADC_RES) * ADC_PRE_SCALING_COMPENSATION)
    
    #define SAMPLES_IN_BUFFER                 3  
    #define SAMPLE_RATE		        100   // ms
    
    #define   ANALOG_0         NRF_SAADC_INPUT_AIN1  // A0(P0.03)
    #define   ANALOG_1         NRF_SAADC_INPUT_AIN2  // A1(P0.04)
    #define   ANALOG_2         NRF_SAADC_INPUT_AIN4  // A2(P0.28)
    
    static uint32_t adc_event_counter = 0;
    
    static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(0);
    static nrf_saadc_value_t     m_buffer_pool[2][SAMPLES_IN_BUFFER];
    
    static nrf_ppi_channel_t     m_ppi_channel;
    
    
    int count=0;
    double t_mv=0;
    
    void timer_handler(nrf_timer_event_t event_type, void * p_context)
    {
    
    }
    
    void saadc_sampling_event_init(void)
    {
        ret_code_t err_code;
    
        err_code = nrf_drv_ppi_init();
        APP_ERROR_CHECK(err_code);
    
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
        err_code = nrf_drv_timer_init(&m_timer, &timer_cfg, timer_handler);
        APP_ERROR_CHECK(err_code);
    
        // setup m_timer for compare event every {SAMPLE_RATE} 
        uint32_t ticks = nrf_drv_timer_ms_to_ticks(&m_timer, SAMPLE_RATE);
        nrf_drv_timer_extended_compare(&m_timer,
                                       NRF_TIMER_CC_CHANNEL0,
                                       ticks,
                                       NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
                                       false);
        nrf_drv_timer_enable(&m_timer);
    
        uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&m_timer,
                                                                                    NRF_TIMER_CC_CHANNEL0);
        uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();
    
        // setup ppi channel so that timer compare event is triggering sample task in SAADC 
        err_code = nrf_drv_ppi_channel_alloc(&m_ppi_channel);
        APP_ERROR_CHECK(err_code);
    
    
        err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,
                                              timer_compare_event_addr,
                                              saadc_sample_task_addr);
    
    
        APP_ERROR_CHECK(err_code);
    }
    
    
    void saadc_sampling_event_enable(void)
    {
        ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
    
        APP_ERROR_CHECK(err_code);
    
    }
    
    
    void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
    {
        if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
        {
            ret_code_t err_code;
    
            // set buffers
            err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
            APP_ERROR_CHECK(err_code);
    
            adc_event_counter ++;
    if(count>=33)
    {
    
    // all the channels are scanned, and the values are stored in p_event->data.done.p_buffer.
    
    //     NRF_LOG_INFO("ANALOG_0 : ADC result = %d , Voltage = %d mV. ", p_event->data.done.p_buffer[0], ADC_RESULT_IN_MILLI_VOLTS(p_event->data.done.p_buffer[0]));   
    //        NRF_LOG_INFO("ANALOG_1 : ADC result = %d , Voltage = %d V. ", p_event->data.done.p_buffer[1], ADC_RESULT_IN_MILLI_VOLTS(p_event->data.done.p_buffer[1]));  
    //     NRF_LOG_INFO("ANALOG_2 : ADC result = %d , Voltage = %d mV. ", p_event->data.done.p_buffer[2], ADC_RESULT_IN_MILLI_VOLTS(p_event->data.done.p_buffer[2]));  
    
    
    NRF_LOG_INFO("Voltage     : %d mV. ", t_mv/34);  
    NRF_LOG_INFO("Float Value : " NRF_LOG_FLOAT_MARKER " V\r\n", NRF_LOG_FLOAT(t_mv/34000.0))
     // NRF_LOG_INFO("---------- ADC scanned %d times -----------", adc_event_counter);   
      count=0;
      t_mv=0;
    
     }
    else
    {
    count++;
    t_mv=t_mv+ ADC_RESULT_IN_MILLI_VOLTS(p_event->data.done.p_buffer[1]);
    
    
    //NRF_LOG_INFO("ANALOG_1 : ADC result = %d , Voltage = %d V. ", p_event->data.done.p_buffer[1],t_mv );  
    //NRF_LOG_INFO("---------- ADC scanned %d times -----------", adc_event_counter);   
    
    }
    
    
        }
    }
    
    void saadc_init(void)
    {
    
        ret_code_t err_code;
        // channels config
    
        nrf_drv_saadc_config_t saadc_config = NRF_DRV_SAADC_DEFAULT_CONFIG;
    
        // only set to 12-bit resolution, and let the other parameters to default
        saadc_config.resolution = NRF_SAADC_RESOLUTION_12BIT; 
    
        // saadc init
        err_code = nrf_drv_saadc_init(&saadc_config, saadc_callback);
        APP_ERROR_CHECK(err_code);
    
        // channel 0
        nrf_saadc_channel_config_t channel0_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(ANALOG_0);
    
        // channel 1
        nrf_saadc_channel_config_t channel1_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(ANALOG_1);
    
        // channel 2
        nrf_saadc_channel_config_t channel2_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(ANALOG_2);
    
        // channels init
        err_code = nrf_drv_saadc_channel_init(0, &channel0_config);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_saadc_channel_init(1, &channel1_config);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_saadc_channel_init(2, &channel2_config);
        APP_ERROR_CHECK(err_code);
    
    
       err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER);
       APP_ERROR_CHECK(err_code);
    
       err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER);
       APP_ERROR_CHECK(err_code);
    }
    
    
    static void log_init()
    {
       uint32_t err_code;
       err_code = NRF_LOG_INIT(NULL);
       APP_ERROR_CHECK(err_code);
       NRF_LOG_DEFAULT_BACKENDS_INIT();
    
    }
    /**
     * @brief Function for main application entry.
     */
    int main(void)
    {
        ret_code_t ret_code;
    
        log_init();
    
        ret_code = nrf_pwr_mgmt_init();
        APP_ERROR_CHECK(ret_code);
    
        saadc_init();
        saadc_sampling_event_init();
        saadc_sampling_event_enable();
      
        NRF_LOG_INFO("SAADC simplified example started.");
    
        while (1)
        {
            nrf_pwr_mgmt_run();
            NRF_LOG_FLUSH();
            nrf_delay_ms(3000);
        }
    }
    
    
    /** @} */
    








  • There's an issue in your data processing. The SAADC is not that inaccurate, even in a worst case scenario.

    I suggest you print out the raw samples and convert them by hand and compare them to what you get with your data processing. 

  • is right. there is actually an issue in this example regarding the conversion.

    I fixed that in this new one saadc modified example. 

  • Thanks, 

    It's working perfectly fine.

    Can you please mention/remove the timer? I want a function, when I call that function it gives me current ADC reading on P0.3. Can you please guide how can I do that(remove the timer from this code)? I have tried but it's not working.

    Thanks again

    /**
     * Copyright (c) 2014 - 2020, Nordic Semiconductor ASA
     *
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without modification,
     * are permitted provided that the following conditions are met:
     *
     * 1. Redistributions of source code must retain the above copyright notice, this
     *    list of conditions and the following disclaimer.
     *
     * 2. Redistributions in binary form, except as embedded into a Nordic
     *    Semiconductor ASA integrated circuit in a product or a software update for
     *    such product, must reproduce the above copyright notice, this list of
     *    conditions and the following disclaimer in the documentation and/or other
     *    materials provided with the distribution.
     *
     * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
     *    contributors may be used to endorse or promote products derived from this
     *    software without specific prior written permission.
     *
     * 4. This software, with or without modification, must only be used with a
     *    Nordic Semiconductor ASA integrated circuit.
     *
     * 5. Any software provided in binary form under this license must not be reverse
     *    engineered, decompiled, modified and/or disassembled.
     *
     * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS
     * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
     * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
     * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
     * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
     * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     *
     */
    /*
       Author : Abdelali Boussetta @rmptxf
       Description : This saadc example uses one channel (AIN1 (P0.3)), samples at 100ms (10 samples) =  get result each (1 second).
       It uses 14Bit as a resolution.
    */
    
    #include <stdbool.h>
    #include <stdint.h>
    #include <stdio.h>
    #include <string.h>
    #include "nrf.h"
    #include "nrf_drv_saadc.h"
    #include "nrf_drv_ppi.h"
    #include "nrf_drv_timer.h"
    #include "boards.h"
    #include "app_error.h"
    #include "nrf_delay.h"
    #include "app_util_platform.h"
    #include "nrf_pwr_mgmt.h"
    
    #include "nrf_log.h"
    #include "nrf_log_ctrl.h"
    #include "nrf_log_default_backends.h"
    
    #define SAMPLES_IN_BUFFER 10
    
    static const nrf_drv_timer_t m_timer = NRF_DRV_TIMER_INSTANCE(0);
    static nrf_saadc_value_t     m_buffer_pool[2][SAMPLES_IN_BUFFER];
    static nrf_ppi_channel_t     m_ppi_channel;
    static uint32_t              m_adc_evt_counter;
    
    // RESULT = [V(P) – V(N) ] * GAIN/REFERENCE * 2(RESOLUTION - m)
    // (m=0) if CONFIG.MODE=SE, or (m=1) if CONFIG.MODE=Diff.
    
    // V(N) = 0;
    // GAIN = 1/6;
    // REFERENCE Voltage = internal (0.6V);
    // RESOLUTION : 12 bit;
    // m = 0;
    
    // 12bit
    // V(P) = RESULT x REFERENCE / ( GAIN x RESOLUTION) = RESULT x (600 / (1/6 x 2^(12)) =  ADC_RESULT x 0.87890625;
    //#define ADC_RESULT_IN_MILLI_VOLTS(ADC_RESULT) ((ADC_RESULT * 0.87890625))
    
    // 14bit
    // V(P) = RESULT x REFERENCE / ( GAIN x RESOLUTION) = RESULT x (600 / (1/6 x 2^(14)) =  ADC_RESULT x 0.2197265625;
    #define ADC_RESULT_IN_MILLI_VOLTS(ADC_RESULT) ((ADC_RESULT * 0.2197265625))
    
    
    void timer_handler(nrf_timer_event_t event_type, void * p_context)
    {
    
    }
    
    
    void saadc_sampling_event_init(void)
    {
        ret_code_t err_code;
    
        err_code = nrf_drv_ppi_init();
        APP_ERROR_CHECK(err_code);
    
        nrf_drv_timer_config_t timer_cfg = NRF_DRV_TIMER_DEFAULT_CONFIG;
        timer_cfg.bit_width = NRF_TIMER_BIT_WIDTH_32;
        err_code = nrf_drv_timer_init(&m_timer, &timer_cfg, timer_handler);
        APP_ERROR_CHECK(err_code);
    
        /* setup m_timer for compare event every 100ms */
        uint32_t ticks = nrf_drv_timer_ms_to_ticks(&m_timer, 100);
        nrf_drv_timer_extended_compare(&m_timer,
                                       NRF_TIMER_CC_CHANNEL0,
                                       ticks,
                                       NRF_TIMER_SHORT_COMPARE0_CLEAR_MASK,
                                       false);
        nrf_drv_timer_enable(&m_timer);
    
        uint32_t timer_compare_event_addr = nrf_drv_timer_compare_event_address_get(&m_timer,
                                                                                    NRF_TIMER_CC_CHANNEL0);
        uint32_t saadc_sample_task_addr   = nrf_drv_saadc_sample_task_get();
    
        /* setup ppi channel so that timer compare event is triggering sample task in SAADC */
        err_code = nrf_drv_ppi_channel_alloc(&m_ppi_channel);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_ppi_channel_assign(m_ppi_channel,
                                              timer_compare_event_addr,
                                              saadc_sample_task_addr);
        APP_ERROR_CHECK(err_code);
    }
    
    
    void saadc_sampling_event_enable(void)
    {
        ret_code_t err_code = nrf_drv_ppi_channel_enable(m_ppi_channel);
    
        APP_ERROR_CHECK(err_code);
    }
    
    
    void saadc_callback(nrf_drv_saadc_evt_t const * p_event)
    {
        ret_code_t err_code;
    
        if (p_event->type == NRF_DRV_SAADC_EVT_DONE)
        {     
            uint32_t buffer_samples = 0;
            uint16_t adc_result = 0;
            uint16_t adc_voltage_mv = 0;
    
            err_code = nrf_drv_saadc_buffer_convert(p_event->data.done.p_buffer, SAMPLES_IN_BUFFER);
            APP_ERROR_CHECK(err_code);
    
            m_adc_evt_counter++;
    
            NRF_LOG_INFO("ADC event number: %d", (int)m_adc_evt_counter);
    
            for (uint8_t i = 0; i < SAMPLES_IN_BUFFER; i++)
            {
                buffer_samples += p_event->data.done.p_buffer[i];
            }
    
            adc_result = buffer_samples/SAMPLES_IN_BUFFER;
            adc_voltage_mv = ADC_RESULT_IN_MILLI_VOLTS(adc_result);
    
            NRF_LOG_INFO("adc result : %d.", adc_result);
            NRF_LOG_INFO("voltage : %d mV.", adc_voltage_mv);
             
            NRF_LOG_INFO("---------------------------");
        }
    }
    
    
    void saadc_init(void)
    {
        ret_code_t err_code;
        // Using the channel default single ended (SE) config
        // pin NRF_SAADC_INPUT_AIN1 : P0.03
        nrf_saadc_channel_config_t channel_config =
            NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN1);
    
        // changing the saadc resolution to 12bit
        nrf_drv_saadc_config_t saadc_config ;
        saadc_config.resolution = NRF_SAADC_RESOLUTION_14BIT;
    
        err_code = nrf_drv_saadc_init(&saadc_config, saadc_callback);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_saadc_channel_init(0, &channel_config);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[0], SAMPLES_IN_BUFFER);
        APP_ERROR_CHECK(err_code);
    
        err_code = nrf_drv_saadc_buffer_convert(m_buffer_pool[1], SAMPLES_IN_BUFFER);
        APP_ERROR_CHECK(err_code);
    
    }
    
    
    /**
     * @brief Function for main application entry.
     */
    int main(void)
    {
        uint32_t err_code = NRF_LOG_INIT(NULL);
        APP_ERROR_CHECK(err_code);
    
        NRF_LOG_DEFAULT_BACKENDS_INIT();
    
        ret_code_t ret_code = nrf_pwr_mgmt_init();
        APP_ERROR_CHECK(ret_code);
    
        saadc_init();
        saadc_sampling_event_init();
        saadc_sampling_event_enable();
        NRF_LOG_INFO("SAADC HAL simple example started.");
    
        while (1)
        {
            nrf_pwr_mgmt_run();
            NRF_LOG_FLUSH();
        }
    }
    
    
    /** @} */
    




  • Just call nrfx_saadc_sample instead of triggering the sample task via the timer. 

Related