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

SAADC pins switch

Hi,

I use the SAADC to sample 2 pins. I use the nrf_drv_saadc, and a timer to call the sample task.

I was trying out several gains for SAADC and I noticed that for gains 1 and 2 (4 not tested), the output buffer switched around the results of the 2 pins.

Can anyone think of a reason for this to happen?

Note: starting at gain 1, the input gets clipped because the input signal goes above 0.6V

Config:

NRF_SAADC_RESOLUTION_12BIT
NRF_SAADC_OVERSAMPLE_DISABLED
NRF_SAADC_RESISTOR_DISABLED
NRF_SAADC_REFERENCE_INTERNAL
NRF_SAADC_ACQTIME_10US
NRF_SAADC_MODE_SINGLE_ENDED
Parents
  • Update

    Answered here.

    Update

    Looks like it's fixed by defining NRF52_PAN_28, even though i'm on a PCA10040, which doesn't have that PAN listed in the docs as far as i know.

    Note: The first sample in the batch is sometimes still incorrect.

    Old answer

    I may have found the bug: I used the pin number also as channel number, so in my case i initialized channel 1 and 2. So it was probably luck that it worked at all. nrf_drv_saadc_channel_init(pinNum, &channelConfig); should've been nrf_drv_saadc_channel_init(channelNum, &channelConfig);

  • The SAADC uses EasyDMA to store the sampled values in RAM so SoftDevice activity should not affect the measurements. When do you see the issue when the PAN 28 workaround is disabled? Just sporadically?

Reply Children
No Data
Related