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

How to config SAADC?

Hi.

I am using saadc example code or SDK V13 with the following requirements:

Voltage input up to 70mV,

Resolution: 50uV

So I did some modification to support the requirement:

Gain: 4,

Reference: internal,

Resolution: 14 bit.

But I have no idea how to choose acquisition time. Could you please help me?

Also I am wondering why I am getting some minus numbers as a digital result?

#define NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(PIN_P) \
    {                                                  \
        .resistor_p = NRF_SAADC_RESISTOR_DISABLED,     \
        .resistor_n = NRF_SAADC_RESISTOR_DISABLED,     \
        .gain       = NRF_SAADC_GAIN4,               \
        .reference  = NRF_SAADC_REFERENCE_INTERNAL,    \
        .acq_time   = NRF_SAADC_ACQTIME_20US,          \
        .mode       = NRF_SAADC_MODE_SINGLE_ENDED,     \
        .burst      = NRF_SAADC_BURST_DISABLED,        \
        .pin_p      = (nrf_saadc_input_t)(PIN_P),      \
        .pin_n      = NRF_SAADC_INPUT_DISABLED         \
    }

    nrf_saadc_channel_config_t channel_config =
    NRF_DRV_SAADC_DEFAULT_CHANNEL_CONFIG_SE(NRF_SAADC_INPUT_AIN0);

nrf_drv_saadc_config_t saadc_config;
//Configure SAADC
saadc_config.low_power_mode = true;                     
saadc_config.resolution = NRF_SAADC_RESOLUTION_14BIT;         
saadc_config.oversample = NRF_SAADC_OVERSAMPLE_DISABLED;                                           
saadc_config.interrupt_priority = APP_IRQ_PRIORITY_LOW;
err_code = nrf_drv_saadc_init(&saadc_config, saadc_callback);
Related