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

nRF52832 SAADC Occasionally returns 0xFFFF

I'm having a problem with the nRF52 SAADC. It's configured for

  • One shot operation on Channel 0 using pin Ain4.
  • Gain of 1/6
  • Tacq set to 40us
  • 8 bit resolution
  • Internal reference
  • Single ended (PSELN connected to ground)
  • No oversample
  • burst disabled.
  • Sample rate controlled from task

Here's the contents of my "read" function:

uint16_t sample;
NRF_SAADC->RESULT.PTR = uint32_t(&sample);
NRF_SAADC->RESULT.MAXCNT = sizeof(sample);

NRF_SAADC->EVENTS_STARTED = 0;
NRF_SAADC->TASKS_START = 1;
while(NRF_SAADC->EVENTS_STARTED ==0){nop();}

NRF_SAADC->EVENTS_DONE = 0;
NRF_SAADC->TASKS_SAMPLE = 1;
while(NRF_SAADC->EVENTS_DONE ==0){nop();}

NRF_SAADC->EVENTS_STOPPED = 0;
NRF_SAADC->TASKS_STOP = 1;
while(NRF_SAADC->EVENTS_STOPPED ==0){nop();}

I have the Ain4 pin connected to ground through a 200 ohm resistor. Is it possible for the ADC to return negative when it's configured for single ended and the analog input goes lower than ground?

Related