The results of nRF52840 ADC conversion are not as expected

I'm using PCA10040 for studying nRF SDK, and I tried running the sample 'saadc_pc10040' with the following change in the 'config.h':

#define NRFX_SAADC_CONFIG_RESOLUTION 2

I connected the board to my PC via USB and applied an external power source with the negative terminal connected to GND and +0.6V to P0.02.

At this point, I expected the ADC value (p_event->data.done.p_buffer) to be calculated as follows:

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

 

Where:

  • V(P) is the voltage at input P
  • V(N) is the voltage at input N
  • GAIN is the selected gain setting
  • REFERENCE is the selected reference voltage
  • m = 0 if CONFIG.MODE=SE, or m = 1 if CONFIG.MODE=Diff.

In this case:

  • V(P) = 0.6
  • V(N) = 0.0
  • GAIN = 1/6
  • REFERENCE = 0.6
  • m = 0

So, I expected to get the result as:

[0.6 – 0.0] * (1/6)/0.6 * 2^(12 - 0) = 682

However, in reality, I got 62000.

Can you please explain why this is happening?

 

Parents Reply
  • Can you post your current application code and configuration?

    The SAADC sample in nRF5 SDK does not use offset calibration by default.

    The results from the SAADC is given as 2's complement 16-bit values (corresponding to int16_t type). int16_t have a range between [-32768, +32767]. If you see values in the 62000 range, your data type is incorrect.

    You should not enable any other peripherals (e.g., GPIOTE) on the same pins used for SAADC input.

Children
No Data
Related