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
  • 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.

  • Another inconsistency that I have seen is about gain:

    I'm measuring 577mV signal;

    If I setup the gain as;

    "ADC_GAIN_1" -> ADC Value 984, calculated voltage 577mV

    "NRF_SAADC_GAIN1" - > Configuration error - Selected ADC gain is not valid

    "ADC_GAIN_1_2" -> ADC Value 497. calculated voltage 582 mV

    "NRF_SAADC_GAIN1_2" -> same as "ADC_GAIN_1_2"

    "ADC_GAIN_1_3" -> ADC Value 333, calculated voltage 585 mV

    "NRF_SAADC_GAIN1_3" -> same as "ADC_GAIN_1_3"

    "ADC_GAIN_1_5" -> ADC Value 204, calculated voltage 595 mV

    "NRF_SAADC_GAIN1_5" -> same as "ADC_GAIN_1_5"

    "ADC_GAIN_1_6" -> ADC Value 171, calculated voltage 601 mV

    "NRF_SAADC_GAIN1_6" -> same as "ADC_GAIN_1_6"

Related