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

SAADC - nRF52832 - questions

Hello, I have the following questions about the SAADC of nRF52832:

  1. The relationship between ADC code and result.

For 0.6V reference, 12-bit resolution and single-ended input the step between two levels will be (0.6V/4096 levels). Dividing that by the GAIN we get the scaling constant and we have:

RESULT = V(P) * [ REFERENCE/ 2^RESOLUTION/ GAIN]

Is that correct? I am a bit confused of the following term (given here ):

RESULT = [V(P) – V(N) ] * GAIN/REFERENCE * 2^(RESOLUTION - m)

  1. I am having the following setup of the SAADC:

    {

    channel_config.reference = NRF_SAADC_REFERENCE_INTERNAL; // Set internal reference of fixed 0.6 volts channel_config.gain = NRF_SAADC_GAIN1_6; // Set input gain to 1/6. The maximum SAADC input voltage is then 0.6V/(1/6)=3.6V. The single ended input range is then 0V-3.6V channel_config.acq_time = NRF_SAADC_ACQTIME_40US; // Set acquisition time. Set low acquisition time to enable maximum sampling frequency of 200kHz. Set high acquisition time to allow maximum source resistance up to 800 kohm, see the SAADC electrical specification in the PS. channel_config.mode = NRF_SAADC_MODE_SINGLE_ENDED; // Set SAADC as single ended. This means it will only have the positive pin as input, and the negative pin is shorted to ground (0V) internally. channel_config.pin_p = NRF_SAADC_INPUT_AIN0; // Select the input pin for the channel. AIN0 pin maps to physical pin P0.02. channel_config.pin_n = NRF_SAADC_INPUT_DISABLED; // Since the SAADC is single ended, the negative pin is disabled. The negative pin is shorted to ground internally. channel_config.resistor_p = NRF_SAADC_RESISTOR_DISABLED; // Disable pullup resistor on the input pin channel_config.resistor_n = NRF_SAADC_RESISTOR_DISABLED; // Disable pulldown resistor on the input pin

    }

In that, I am getting values that seem equal to the input voltage in [mV]. That is nice, but I am not quite sure I understand the logic to get such a result.

For example, for input voltage of 1.5V, the result would be

RESULT = 1.5 * [ 0.6/ 2^(12)/ (1/6)] = 0,001318359375 V

How I am then getting values around 1500 ( 12-bit, 0x5DC ), what I am missing?

  1. I need to use a GPIO in the role of analog switch. In that case, I have to account for the output low voltage on the pin. What would be the best strategy to measure it? As I see, there is no option to share the pin with SAADC input? Perhaps one option is to connect another pin for SAADC input and measure the GPUO output low voltage this way? Is there any better way?

  2. A derivative question of the previous one: I am having several GPIOs that act as analog multiplexers, and they are all connected to identical external circuits; in that case can I assume that all these several GPIOs that belong to the same nRF52832 will have the same output low voltage and would it be enough to measure the value of only one of them?

Parents Reply Children
No Data
Related