I'm trying to read differential ADC input with inputs configured as:
NRF_SAADC_INPUT_AIN1 (P0.014) -> POSITIVE
NRF_SAADC_INPUT_AIN2 (P0.015) -> NEGATIVE (differential mode)
I'm also using 4x oversampling, gain of 1, +-0.6V reference, 12-bit ADC and 5us acquisition time.
Unfortunately, I seem to be getting very poor results.
By grounding both inputs, I'm receiving an output value of ~350, which equates to around 103mV, which is too poor for my use case.
Any advise would be appreciated.
For grounded inputs, for any given sample set (extra_samplings set to 399 - total samples = 400), there seems to be large alternating errors, such as:
Sample 368: 415Sample 369: 364Sample 370: 416Sample 371: 360Sample 372: 414Sample 373: 362Sample 374: 415Sample 375: 365Sample 376: 417Sample 377: 357Sample 378: 416Sample 379: 363Sample 380: 418Sample 381: 364
I'm also struggling to find documentation regarding the correct calibration procedure.
At current, I'm performing NRF_SAADC_NS->TASKS_CALIBRATEOFFSET = 1; before all sampling.
Considering the invalid result (errata) which comes from settting VDD_GPIO > 2.1V, I've changed the VDD_GPIO to 1.8V. The error in the samples now appears to have decreased, and the samples look something like this:
Sample 365: 209Sample 366: 304Sample 367: 211Sample 368: 303Sample 369: 213Sample 370: 302Sample 371: 213Sample 372: 304Sample 373: 213Sample 374: 305Sample 375: 210Sample 376: 303Sample 377: 212Sample 378: 302Sample 379: 213Sample 380: 300This is still not useful data for my use case.
The UART1 interface occupies the P0.14 and P0.15 pins by default on the DK, as shown here: https://infocenter.nordicsemi.com/topic/ug_nrf91_dk/UG/nrf91_DK/if_connector.html
Could you try to use AIN0 and AIN3 (https://infocenter.nordicsemi.com/topic/ps_nrf9160/pin.html?cp=2_0_0_9_0) instead and see if these give the expected result?
Hi, that has reduced the error to ~25, which is not ideal but usable. I'm still seeing wild oscillations between samples. For example:
Sample 609: -335Sample 610: 314Sample 611: -333Sample 612: 312Sample 613: -336Sample 614: 314Sample 615: -337Sample 616: 312Sample 617: -338Sample 618: 314Sample 619: -337Sample 620: 317Sample 621: -340Sample 622: 317Sample 623: -336
No matter the sampling parameters, the samples alternate in this way. Is there a reason for this?
Could you attach your configuration/sample so that I can try this at my end?