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

saadc value affects next values

Hi, I'm developing custom board with nrf52832

The problem is that when saadc returns negative value, all values that saadc returns after are max possible values from config So the previous adc value affects all that goes after it. They stay at max until adc will return another negative value.

Things I tried that didn't help:

  • Checking gnd/0
  • Setting adc limits by nrf_drv_saadc_limits_set
  • Pin in single-ended mode
  • Calibrating adc  (different time intervals)
  • Bitmask to adc returned value (adc is configured with 12 bit, so i zero 4 top bits)
  • Different channel configs

Looking for help, I'm confused a lot

Parents
  • Hi,

    I'm not sure I understand what you mean by " max possible values from config". Can you give some examples of the values you are seeing? The samples from the SAADC are 16-bit signed integers.

    Best regards,
    Jørgen

  • Are you using single-ended or differential mode?

    What reference and gain settings are you using?

    What is the supply voltage of the chip? 

    What is the voltage level on the analog input that you are sampling?

  • That is true, but from the image it looks like you input a much higher voltage than that. 3V input with 14-bit mode and 1/6 GAIN/internal reference should give samples of ~13-14000. Is this the raw values in the buffer, or have this been transferred over BLE? Have you checked the voltage level on the analog input with a scope etc., to see that there is nothing else pulling the voltage low? Which analog input do you use? Have you tested with another pin?

  • I can't physically reconfigure connection to test with another pin right now. I use ain0(p0.02). The values you see are transferred over BLE, but they are the same as raw values as I can see in debug mode

  • Are you able to scope the pin, to check that the input is what you expect? Do you have a nRF52 DK that you can reproduce this on, to rule out any board-related issues?

  • I'm going to check all the hardware a bit later. But first, is there any chance this bug is a software problem? 
    Anyway, thank you Jørgen for answering my questions. I'm very glad that I can get help from specialist. Huge respect to Nordic tech support.

  • I can't think of anything in particular, but if you could post your code I can have a look at it to see if I can spot anything.

Reply Children