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

Saadc over BLE sanity check

Hi,

I merge saadc and ble_uart together in order to send send sensor output(now just analog voltage) to mobile app. I want to check weather the ADC is working properly or not. Digital values for same voltage are very different from each other and it seems changing voltage does have impact on digital value. How can I check adc's functionality?

Best regards,

Kosar

  • Hi Kosar,

    The simplest sanity check is to ground the pin, you are measuring. If you get something other than 0, you have a DC offset and should calibrate the SAADC (by calling nrf_drv_saadc_calibrate_offset() if you are using the SDK driver). If you get different measurement results depending on supply voltage, that indicates to me that you are using VDD as reference. You should probably use the internal 0.6 V reference instead to make the measurement results independent of the VDD voltage.

  • Hi Einar, Thank you for your reply.

    I apply the changes you recommend but still results are different for same voltage. For example here is the result for ground pin.

  • Hi,

    It looks like the samples are around 0 (remember that it is integers), so if you have a DC offset or a bit of noise when measuring 0 V, then you can get negative numbers. You should calibrate to correct any DC offset (difficult to say if there is any or not), and you could teak measures to reduce the noise. Both in HW if possible, and also by using oversampling (essentially just averaging of multiple samples).

  • Thank you for your suggestions, I will try that. also when pin is connected to VDD the highest value after conversion is FF0F and it is not changing. shouldn't it be FFFF?

  • No, it can never be FFFF. It looks a bit strange for a few reasons:

    • It is a signed integer, so if the most significant bit was 1, this would be a negative number (and that will only happen with low values samples when there is a DC offset)
    • The highest bit is in the second byte (reading from the left), due to endianness
    • The sample is not 16 bit, so the upper bits (except for the last sign bit), are not used (depending on configuration, can be 8, 10 or 12 bits).