samples/drivers/adc: Add support for nRF52840 DK and nRF51 DK boards

The overlay for the nRF52840 DK board uses ADC controller child nodes
for specifying channel configurations and it shows how to configure
a channel in differential input mode, so it can serve as an example
of how to use these new possibilities. The overlay for the nRF51 DK
board shows how to use a specific ADC resolution (the default 12 bit
setting is not supported by nRF51 SoCs).

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
This commit is contained in:
Andrzej Głąbek 2022-02-21 17:29:46 +01:00 committed by Marti Bolivar
commit 07b4362bac
3 changed files with 75 additions and 1 deletions

View file

@ -0,0 +1,26 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2022 Nordic Semiconductor ASA
*/
/ {
zephyr,user {
io-channels = <&adc 0>;
};
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_3";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_ADC_AIN2>; /* P0.01 */
zephyr,resolution = <10>;
};
};

View file

@ -0,0 +1,45 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2022 Nordic Semiconductor ASA
*/
/ {
zephyr,user {
io-channels = <&adc 0>, <&adc 1>, <&adc 7>;
};
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
channel@0 {
reg = <0>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN1>; /* P0.03 */
};
channel@1 {
reg = <1>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_VDD>;
zephyr,resolution = <14>;
zephyr,oversampling = <8>;
};
channel@7 {
reg = <7>;
zephyr,gain = "ADC_GAIN_1_5";
zephyr,reference = "ADC_REF_VDD_1_4";
zephyr,vref-mv = <750>;
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,input-positive = <NRF_SAADC_AIN6>; /* P0.30 */
zephyr,input-negative = <NRF_SAADC_AIN7>; /* P0.31 */
};
};

View file

@ -5,7 +5,10 @@ tests:
tags: ADC
depends_on: adc
platform_allow: nucleo_l073rz disco_l475_iot1 cc3220sf_launchxl
cc3235sf_launchxl stm32l496g_disco
cc3235sf_launchxl stm32l496g_disco nrf51dk_nrf51422 nrf52840dk_nrf52840
integration_platforms:
- nucleo_l073rz
- nrf52840dk_nrf52840
harness: console
timeout: 10
harness_config: