Skip to content

Commit 07b4362

Browse files
ananglmbolivar-nordic
authored andcommitted
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 <[email protected]>
1 parent f5ffd05 commit 07b4362

File tree

3 files changed

+75
-1
lines changed

3 files changed

+75
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Copyright (c) 2022 Nordic Semiconductor ASA
5+
*/
6+
7+
8+
/ {
9+
zephyr,user {
10+
io-channels = <&adc 0>;
11+
};
12+
};
13+
14+
&adc {
15+
#address-cells = <1>;
16+
#size-cells = <0>;
17+
18+
channel@0 {
19+
reg = <0>;
20+
zephyr,gain = "ADC_GAIN_1_3";
21+
zephyr,reference = "ADC_REF_INTERNAL";
22+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
23+
zephyr,input-positive = <NRF_ADC_AIN2>; /* P0.01 */
24+
zephyr,resolution = <10>;
25+
};
26+
};
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* SPDX-License-Identifier: Apache-2.0
3+
*
4+
* Copyright (c) 2022 Nordic Semiconductor ASA
5+
*/
6+
7+
8+
/ {
9+
zephyr,user {
10+
io-channels = <&adc 0>, <&adc 1>, <&adc 7>;
11+
};
12+
};
13+
14+
&adc {
15+
#address-cells = <1>;
16+
#size-cells = <0>;
17+
18+
channel@0 {
19+
reg = <0>;
20+
zephyr,gain = "ADC_GAIN_1_6";
21+
zephyr,reference = "ADC_REF_INTERNAL";
22+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
23+
zephyr,input-positive = <NRF_SAADC_AIN1>; /* P0.03 */
24+
};
25+
26+
channel@1 {
27+
reg = <1>;
28+
zephyr,gain = "ADC_GAIN_1_6";
29+
zephyr,reference = "ADC_REF_INTERNAL";
30+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
31+
zephyr,input-positive = <NRF_SAADC_VDD>;
32+
zephyr,resolution = <14>;
33+
zephyr,oversampling = <8>;
34+
};
35+
36+
channel@7 {
37+
reg = <7>;
38+
zephyr,gain = "ADC_GAIN_1_5";
39+
zephyr,reference = "ADC_REF_VDD_1_4";
40+
zephyr,vref-mv = <750>;
41+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
42+
zephyr,input-positive = <NRF_SAADC_AIN6>; /* P0.30 */
43+
zephyr,input-negative = <NRF_SAADC_AIN7>; /* P0.31 */
44+
};
45+
};

samples/drivers/adc/sample.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ tests:
55
tags: ADC
66
depends_on: adc
77
platform_allow: nucleo_l073rz disco_l475_iot1 cc3220sf_launchxl
8-
cc3235sf_launchxl stm32l496g_disco
8+
cc3235sf_launchxl stm32l496g_disco nrf51dk_nrf51422 nrf52840dk_nrf52840
9+
integration_platforms:
10+
- nucleo_l073rz
11+
- nrf52840dk_nrf52840
912
harness: console
1013
timeout: 10
1114
harness_config:

0 commit comments

Comments
 (0)