I'm using a nRF51844
I'm writing my own ADC reading routines because I can't find any examples, but I know how to code so that's not a problem. I just want to confirm something:
If the analog reference is selected to be ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling , then does that mean to get a one-to-one reading, I should be using ADC_CONFIG_INPSEL_SupplyOneThirdPrescaling as well? If I do this, I assume that if my VDD is 3.3V and input is 3.3V, I get a 10 bit reading of 1023, correct?
What are the tolerances on the two prescalers?
If you have VDD (supply voltage) as reference by choosing e.g. ADC_CONFIG_REFSEL_SupplyOneThirdPrescaling, the ADC will compare the input voltage to the supply voltage. If you choose ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling then that would mean the ADC will output 1023 when the input voltage is equal to the supply voltage when sampling with 10 bit resolution. However, it would make no sense to choose Supply voltage for both reference and input, as you have suggested.
For ADC saturation points and maximum voltages on the analog input pins, please look at:
my mistake, i think i did mean to write ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling but copied the wrong line
thanks for the reply
is there any error specifications on each individual prescaler?
The error specification for the ADC is given in table 38 in the nRF51822 PS v1.2.
The impedance of the input voltage source, i.e. the device that generates the voltage to be measured by the ADC input pin, must be low, preferably within 1 kohm. If the impedance of the source is below 1 kohm the error specification in table 38 is valid and choosing different prescale settings for the ADC input will have little effect. On the other hand, when applying voltage source to the ADC input pin with high impedance, additional gain and offset error is introduced which is different for different prescalers.
The attached documents show the ADC model when the ADC is sampling and the value of R_AIN for different prescale settings. The internal VBG reference voltage is 1.2V so the ADC internal voltage source is VBG/2=0.6V. When the ADC is not sampling the AIN input pin has very high impedance and can be regarded as open circuit.