Skip to content

Commit be7d5bd

Browse files
committed
tests: samples: drivers: adc: add support for L20 and L09
Based on zephyr. Signed-off-by: Piotr Kosycarz <[email protected]>
1 parent 7b079c3 commit be7d5bd

34 files changed

+500
-0
lines changed

.github/test-spec.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@
624624
- "include/drivers/gpio/**/*"
625625
- "include/event_manager_proxy.h"
626626
- "subsys/event_manager_proxy/**/*"
627+
- "samples/zephyr/drivers/adc/**/*"
627628
- "samples/zephyr/drivers/audio/**/*"
628629
- "samples/zephyr/drivers/i2c/**/*"
629630
- "samples/zephyr/drivers/watchdog/**/*"
@@ -644,6 +645,7 @@
644645
- "tests/drivers/spi/**/*"
645646
- "tests/drivers/uart/**/*"
646647
- "tests/subsys/event_manager_proxy/**/*"
648+
- "tests/zephyr/drivers/adc/**/*"
647649
- "tests/zephyr/drivers/comparator/**/*"
648650
- "tests/zephyr/drivers/gpio/**/*"
649651
- "tests/zephyr/drivers/flash/**/*"

CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,7 @@
667667
/samples/zigbee/**/*.rst @nrfconnect/ncs-terahertz-doc
668668
/samples/zephyr/basic/blinky/ @nrfconnect/ncs-low-level-test @nrfconnect/ncs-ll-ursus
669669
/samples/zephyr/boards/nordic/system_off/ @nrfconnect/ncs-low-level-test
670+
/samples/zephyr/drivers/adc/ @nrfconnect/ncs-low-level-test
670671
/samples/zephyr/drivers/audio/dmic/ @nrfconnect/ncs-low-level-test
671672
/samples/zephyr/drivers/i2c/rtio_loopback/ @nrfconnect/ncs-low-level-test
672673
/samples/zephyr/drivers/watchdog/ @nrfconnect/ncs-low-level-test
@@ -919,6 +920,7 @@
919920
/tests/tfm/ @nrfconnect/ncs-aegir @stephen-nordic @magnev
920921
/tests/unity/ @nordic-krch
921922
/tests/subsys/zigbee/ @nrfconnect/ncs-zigbee
923+
/tests/zephyr/drivers/adc/ @nrfconnect/ncs-low-level-test
922924
/tests/zephyr/drivers/comparator/ @nrfconnect/ncs-low-level-test
923925
/tests/zephyr/drivers/flash/common/ @nrfconnect/ncs-low-level-test @nrfconnect/ncs-ll-ursus
924926
/tests/zephyr/drivers/gpio/ @nrfconnect/ncs-low-level-test
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(ADC)
11+
12+
FILE(GLOB app_sources ${ZEPHYR_BASE}/samples/drivers/adc/adc_dt/src/*.c)
13+
target_sources(app PRIVATE ${app_sources})
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
This sample extends the same-named Zephyr sample to verify it
2+
with Nordic development kits.
3+
4+
Source code and basic configuration files can be found in the corresponding folder structure in zephyr/samples/drivers/adc/adc_dt.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/ {
2+
zephyr,user {
3+
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>;
4+
};
5+
};
6+
7+
&adc {
8+
#address-cells = <1>;
9+
#size-cells = <0>;
10+
status = "okay";
11+
12+
channel@0 {
13+
reg = <0>;
14+
zephyr,gain = "ADC_GAIN_1";
15+
zephyr,reference = "ADC_REF_INTERNAL";
16+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
17+
zephyr,input-positive = <NRF_SAADC_AIN4>; /* P1.11 */
18+
zephyr,resolution = <10>;
19+
};
20+
21+
channel@1 {
22+
reg = <1>;
23+
zephyr,gain = "ADC_GAIN_1";
24+
zephyr,reference = "ADC_REF_INTERNAL";
25+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
26+
zephyr,input-positive = <NRF_SAADC_AIN2>; /* P1.06 */
27+
zephyr,resolution = <12>;
28+
zephyr,oversampling = <8>;
29+
};
30+
31+
channel@2 {
32+
reg = <2>;
33+
zephyr,gain = "ADC_GAIN_1";
34+
zephyr,reference = "ADC_REF_INTERNAL";
35+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
36+
zephyr,input-positive = <NRF_SAADC_VDD>;
37+
zephyr,resolution = <12>;
38+
zephyr,oversampling = <8>;
39+
};
40+
41+
channel@7 {
42+
reg = <7>;
43+
zephyr,gain = "ADC_GAIN_1";
44+
zephyr,reference = "ADC_REF_INTERNAL";
45+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
46+
zephyr,input-positive = <NRF_SAADC_AIN6>; /* P1.13 */
47+
zephyr,input-negative = <NRF_SAADC_AIN7>; /* P1.14 */
48+
zephyr,resolution = <12>;
49+
};
50+
};
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/ {
2+
zephyr,user {
3+
io-channels = <&adc 0>, <&adc 1>, <&adc 2>, <&adc 7>;
4+
};
5+
};
6+
7+
&adc {
8+
#address-cells = <1>;
9+
#size-cells = <0>;
10+
status = "okay";
11+
12+
channel@0 {
13+
reg = <0>;
14+
zephyr,gain = "ADC_GAIN_1";
15+
zephyr,reference = "ADC_REF_INTERNAL";
16+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
17+
zephyr,input-positive = <NRF_SAADC_AIN4>; /* P1.11 */
18+
zephyr,resolution = <10>;
19+
};
20+
21+
channel@1 {
22+
reg = <1>;
23+
zephyr,gain = "ADC_GAIN_1";
24+
zephyr,reference = "ADC_REF_INTERNAL";
25+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
26+
zephyr,input-positive = <NRF_SAADC_AIN2>; /* P1.06 */
27+
zephyr,resolution = <12>;
28+
zephyr,oversampling = <8>;
29+
};
30+
31+
channel@2 {
32+
reg = <2>;
33+
zephyr,gain = "ADC_GAIN_1";
34+
zephyr,reference = "ADC_REF_INTERNAL";
35+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
36+
zephyr,input-positive = <NRF_SAADC_VDD>;
37+
zephyr,resolution = <12>;
38+
zephyr,oversampling = <8>;
39+
};
40+
41+
channel@7 {
42+
reg = <7>;
43+
zephyr,gain = "ADC_GAIN_1";
44+
zephyr,reference = "ADC_REF_INTERNAL";
45+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
46+
zephyr,input-positive = <NRF_SAADC_AIN6>; /* P1.13 */
47+
zephyr,input-negative = <NRF_SAADC_AIN7>; /* P1.14 */
48+
zephyr,resolution = <12>;
49+
};
50+
};
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CONFIG_ADC=y
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
sample:
2+
name: ADC devicetree driver sample
3+
tests:
4+
nrf.extended.sample.drivers.adc.adc_dt:
5+
tags:
6+
- adc
7+
- ci_samples_zephyr_drivers_adc
8+
# depends_on: adc
9+
integration_platforms:
10+
- nrf54l09pdk/nrf54l09/cpuapp
11+
- nrf54l20pdk/nrf54l20/cpuapp
12+
platform_allow:
13+
- nrf54l09pdk/nrf54l09/cpuapp
14+
- nrf54l20pdk/nrf54l20/cpuapp
15+
harness: console
16+
timeout: 10
17+
harness_config:
18+
type: multi_line
19+
regex:
20+
- "ADC reading\\[\\d+\\]:"
21+
- "- .+, channel \\d+: -?\\d+"
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#
2+
# Copyright (c) 2025 Nordic Semiconductor ASA
3+
#
4+
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
5+
#
6+
7+
cmake_minimum_required(VERSION 3.20.0)
8+
9+
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
10+
project(ADC)
11+
12+
FILE(GLOB app_sources ${ZEPHYR_BASE}/samples/drivers/adc/adc_sequence/src/*.c)
13+
target_sources(app PRIVATE ${app_sources})
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
source "samples/drivers/adc/adc_sequence/Kconfig"

0 commit comments

Comments
 (0)