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

nRF9160 ADC Reference Values

Hello,

I'm trying to work with ADC on nRF9160DK and I'm using 3V for VDD IO;

With below configuration 

static const struct adc_channel_cfg m_1st_channel_cfg = {
	.gain = ADC_GAIN_1,
	.reference = ADC_REF_INTERNAL,
	.acquisition_time = ADC_ACQUISITION_TIME,
	.channel_id = 0,
#if defined(CONFIG_ADC_CONFIGURABLE_INPUTS)
	.input_positive = NRF_SAADC_INPUT_AIN0,
#endif
};

I'm getting full scale reading at 640mV

When I've switch to

static const struct adc_channel_cfg m_1st_channel_cfg = {
	.gain = ADC_GAIN_1,
	.reference = ADC_REF_VDD_1_4,
	.acquisition_time = ADC_ACQUISITION_TIME,
	.channel_id = 0,
#if defined(CONFIG_ADC_CONFIGURABLE_INPUTS)
	.input_positive = NRF_SAADC_INPUT_AIN0,
#endif
};

I'm getting full scale reading at 600mV, which I think it should 750mV due to 1/4th of VDD.

And another problem that I'm having is when I set gain to "ADC_GAIN_1_5" after 2.5V adc reading value start going down instead of going up. Like at 2.5V i'm reading 14600 and at 2.7V it is 9500.

Is there anything wrong with my configuration?

Regards,

Gurkan

Parents Reply Children
  • Hey Jared,

    I've switched to 1.8V and my observations;

    ADC Settings;

    Resolution: 14 bit

    Gain: ADC_GAIN_1

    Reference: ADC_REF_INTERNAL

    Oversampling: NRF_SAADC_OVERSAMPLE_256X

    at 640mV I can get 16380 which is maximum, it does not go over 16380

    ##############################################################

    Resolution: 14 bit

    Gain: ADC_GAIN_1

    Reference: ADC_REF_VDD_1_4

    Oversampling: NRF_SAADC_OVERSAMPLE_256X

    at 580mV(I think this supposed to be 450mV since our VDD 1.8V) can get 16380 which is maximum, it does not go over 16380

    ################################################################

    Gain: ADC_GAIN_1_3

    Reference: ADC_REF_INTERNAL

    Oversampling: NRF_SAADC_OVERSAMPLE_256X

    AN0 pin connected to VDD (1.8V)

    Resolution 14 bit - > ADC value 16130

    Resolution 12 bit - > ADC value 4030

    Resolution 10 bit - > ADC value 1008

  • Hi,

    Could you try this example and see if you get the expected output?

    Jared

  • Hi Jared,

    That sample was the first thing I have tried actually.

    Btw, I'm getting better readings if comment out "NRF_SAADC_NS->TASKS_CALIBRATEOFFSET = 1;"

    And when I don't comment out that line I'm trying to check if the calibration is finished with "NRF_SAADC_NS->EVENTS_CALIBRATEDONE" but this register returns always 0.

  • Hi,

    Are you experiencing wrong results even after the first result? Could you try clearing the the NRF_SAADC_NS->EVENTS_CALIBRATEDON field by setting it to 0 before writing NRF_SAADC_NS->TASKS_CALIBRATEOFFSET = 1 and see if the flag is set?

  • Hi.

    As I have mentioned earlier I always read the EVENTS_CALIBRATEDONE as 0, before  setting TASK_CALIBRATEOFFSET or after.

        printk("Calibration has started\n");
    	NRF_SAADC_NS->EVENTS_CALIBRATEDONE = 0;
    	NRF_SAADC_NS->TASKS_CALIBRATEOFFSET = 1;
    	while (!NRF_SAADC_NS->EVENTS_CALIBRATEDONE)
    		;

    For example it never passes the above check.

Related