The .ref_internal field in the adc_driver_api
struct was previously unset.
Now it's set to the proper value, 1 V.
Signed-off-by: Julia Azziz <juliaazziz7@gmail.com>
ESP32S3 requires ESP_ADC_CAL_VAL_EFUSE_TP_FIT calibration
scheme. The use of ESP_ADC_CAL_VAL_EFUSE_TP is not supported
in the SoC..
Signed-off-by: Lucas Tamborrino <lucas.tamborrino@espressif.com>
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: Bjarki Arge Andreasen <bjarki.andreasen@nordicsemi.no>
Updated nxp lpadc driver, because the phandle type property
'nxp,reference-supply' was removed, and a new phandle-array
type property 'nxp,references' added.
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
During channel reads, zero is returned on CRC mismatches: the returned
error variable is not written to after a previous non-zero check. Return
-EIO to mirror other drivers' checksum validation behaviors.
Signed-off-by: Jared Kangas <kangas.jd@gmail.com>
For STM32H7, U5 and WBA, check the LDORDY bit of the ADC ISR register
after enabling the internal regulator. This method is safer than the
delay.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Burst mode enabled on an unused channel causes a freeze during a
conversion consisting of several channels (not including the one with
burst mode enabled).
Discovered on nRF52832 (nRF52-DK) using the following approach:
channels 0-3 are used for application purposes as a sequence
channel 4 is used for battery measurements with oversampling
After few successful conversions the sequence (channels 0-3) freezes the
thread while waiting for semaphore to end the conversion.
Signed-off-by: Maksim Salau <maksim.salau@gmail.com>
Removed PM device runtime support from drivers in PD_SYS domain.
Update the rest device drivers to call pm_device_runtime_get/put()
functions when CONFIG_PM_DEVICE_RUNTIME is enabled.
Signed-off-by: Ioannis Damigos <ioannis.damigos.uj@renesas.com>
Introduce the stm32h7RS serie to the ADC driver,
based on the stm32h7: two ADC 12 resolution
For stm32h7rs ADC calibration, the
LL_ADC_SetCalibrationFactor is not used.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Expands driver to cover nRF54L15 features like AIN as GPIO configuration,
new reference voltage, different set of supported gain options.
Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
The AD5593 conversion result also contains the channel read and not just a
value:
| adc channel (3 bits) | adc value (12 bits) |
This value was not removed from the result before using it as an adc value.
Reuse the AD5592 code to fix the issue.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.
Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.
Updated the includes path of in-tree sources accordingly.
Most of the changes here are scripted, check the PR for more
info.
Signed-off-by: Yong Cong Sin <ycsin@meta.com>
Support regulator output different voltage as reference to LPADC
the regulator output voltage can be set through property
zephyr,vref-mv
Signed-off-by: Zhaoxiang Jin <Zhaoxiang.Jin_1@nxp.com>
Expands driver to cover nRF54L15 features like AIN as GPIO configuration,
new reference voltage, different set of supported gain options.
Signed-off-by: Karol Lasończyk <karol.lasonczyk@nordicsemi.no>
Update m2l31x.dtsi for adc support and update adc_numaker.c
to support acquisition time in 0~255 ADC ticks.
Signed-off-by: cyliang tw <cyliang@nuvoton.com>
This fixes the problem that `adc_raw_to_millivolts` only returns half of
the actual voltage.
Signed-off-by: Caspar Friedrich <c.s.w.friedrich@gmail.com>
Found via static analyis. When `adc_kb1200_start_read` succeeds, no
value is set for `error` so it is still uninitialized when it is
returned.
Signed-off-by: François Baldassari <francois@memfault.com>
Use information encoded in conversion result value to validate it.
Check if MSB bit is set to zero.
Check if channel number included in the result matches channel
number selected for conversion.
Use bitmask to extract converted value instead of math calculations.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
k_thread_name_set() function returns an error if CONFIG_THREAD_NAME is
not enabled which may make the driver not functional.
Fix the issue by adding a check against CONFIG_THREAD_NAME avaliability
before calling k_thread_name_set() function so the driver can operate
properly with CONFIG_THREAD_NAME disabled.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
Add configuration of internal refference voltage value so raw ADC
readings can be converted to mV utilizing adc_raw_to_millivolts()
ADC API function.
Signed-off-by: Lukasz Madej <l.madej@grinn-global.com>
The adc_ads1119 driver is unable to overwrite the configuration register,
the chip therefore always works with its default settings. Register access
macros are fixed by this commit.
Fixes: #70091
Signed-off-by: Jan Kubiznak <jan.kubiznak@deveritec.com>
Rename ad5592 files in dts, driver and include to ad559x and add support
for I2C bus which is required for AD5593.
Signed-off-by: Jeppe Odgaard <jeppe.odgaard@prevas.dk>
Add a blank define for the case where DMA channels are defined in ADC node
of the dts but STM32_ADC_DMA is not enabled. Otherwise compilation fails.
Also fix the way the DMA channel is configured by using a standard DT
macro, otherwise it doesn't work for dma-v2bis DMA types.
Signed-off-by: Guillaume Gautier <guillaume.gautier-ext@st.com>
Added the STM32G0X SOC series to the list of SOC that need to disable the
ADC while setting the oversampling bits to prevent writing over the
CKMODE bits.
Signed-off-by: Alexandre Poizat <apoizat@kalrayinc.com>
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.
Fixes: #69129
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.
Fixes: #69133
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.
Fixes: #69132
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.
Fixes: #69131
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
Use K_KERNEL_STACK_SIZEOF() for calculating thread stack size, as this
takes K_KERNEL_STACK_RESERVED into account.
Fixes: #69130
Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>