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

nRF52832 - ADC Value With 0V at the Input

Hello there,

I have a question related to the ADC of the nRF52832.


I am using it in single-ended mode, 10-bit resolution, 1/5 gain, internal reference 0.6V. Thus, I should expect a reading range from 0V to 3V.

Everything works fine and as expected for voltages higher than ~10mV. However, when I ground the ADC input (or when I force 0V with an external power supply) the ADC starts providing strange and unstable results:

  • 0V -> 0xFFFE / 0x6665 / 0x9998 / 0xCCCB ...

If I apply negative voltages, the ADC returns stable:

  • -0.01V -> 0xFFFB
  • -0.05V -> 0xFFEE
  • -0.20V -> 0xFFBA

I am puzzled by this behavior. I would expect the ADC to provide 0x0000 for any voltage ≤ 0V.

I have found a similar question on the forum: link. However, that person was leaving the input floating while in my case is grounded!

Thanks everybody for the help!

Parents
  • If you get very big and wrong number, you are not handling the sample correctly. Note that the samples are stored as int16_t, not uint16_t:

    typedef int16_t nrf_saadc_value_t;  ///< Type of a single ADC conversion result.

    The values 0xFFFF, 0xFFFE represents -1 and -2 in int16_t format. You can compensate for this in your software by saying all negative values should be threated as 0. You can also do offset calibration , or oversampling to average multiple samples and compensate for the noise.

Reply
  • If you get very big and wrong number, you are not handling the sample correctly. Note that the samples are stored as int16_t, not uint16_t:

    typedef int16_t nrf_saadc_value_t;  ///< Type of a single ADC conversion result.

    The values 0xFFFF, 0xFFFE represents -1 and -2 in int16_t format. You can compensate for this in your software by saying all negative values should be threated as 0. You can also do offset calibration , or oversampling to average multiple samples and compensate for the noise.

Children
No Data
Related