Skip to content
Commit 13658a66 authored by Bjarki Arge Andreasen's avatar Bjarki Arge Andreasen Committed by Alberto Escolar
Browse files

drivers: adc: adc_nrfx_saadc: Patch neg single ended readings



The NRF SAADC produces negative values in single ended mode if the
positive input is below 0V (ground). This behavior does not match
the ADC device driver API, which states that in single ended mode,
the readings must be positive [0 .. 2^resolution - 1].

This commit extends the adc_nrfx_saadc device driver to track which
channels in a sequence are configured to be single ended, to then
corrects negative readings for these channels to 0.

This patch only works if the ADC resolution is lower than the sample
bit size. This is the case for 8, 10, 12 and 14 bit resolutions for
the nRF 52, 53 and 91 series which store readings in a int16_t.

The nRF 54H and 54L series store 8-bit resolution readings in a 8-bit
sample size. A check has been added to start_read() to prevent single
ended mode readings if the resolution is 8-bit for these platforms.

Signed-off-by: default avatarBjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
parent 7f420049
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment