Skip to content

Commit bc44d3c

Browse files
tests: drivers: dac: add xg24 boards to dac_api and dac_loopback tests
Add board overlays and defines to the test sources files to execute the dac_api and dac_loopback tests on xg24_dk2601b and xg24_rb4187c. Signed-off-by: Bastien Beauchamp <[email protected]>
1 parent 7cf65c0 commit bc44d3c

File tree

7 files changed

+131
-2
lines changed

7 files changed

+131
-2
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&vdac0 {
8+
status = "okay";
9+
voltage-reference = "1.25V";
10+
11+
channel0 {
12+
aux-output;
13+
aux-output-port = "None";
14+
aux-output-pin = <0>;
15+
low-power-mode;
16+
};
17+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
&vdac0 {
8+
status = "okay";
9+
voltage-reference = "1.25V";
10+
11+
channel0 {
12+
aux-output;
13+
aux-output-port = "None";
14+
aux-output-pin = <0>;
15+
low-power-mode;
16+
};
17+
};

tests/drivers/dac/dac_api/src/test_dac.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,14 @@
110110

111111
#elif defined(CONFIG_BOARD_MIMXRT1170_EVK)
112112

113-
#define DAC_DEVICE_NODE DT_NODELABEL(dac)
113+
#define DAC_DEVICE_NODE DT_NODELABEL(dac0)
114+
#define DAC_RESOLUTION 12
115+
#define DAC_CHANNEL_ID 0
116+
117+
#elif defined(CONFIG_BOARD_XG24_DK2601B) || \
118+
defined(CONFIG_BOARD_XG24_RB4187C)
119+
120+
#define DAC_DEVICE_NODE DT_NODELABEL(vdac0)
114121
#define DAC_RESOLUTION 12
115122
#define DAC_CHANNEL_ID 0
116123

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "dt-bindings/adc/silabs-adc.h"
8+
9+
&adc0 {
10+
#address-cells = <1>;
11+
#size-cells = <0>;
12+
status = "okay";
13+
14+
channel@0 {
15+
reg = <0>;
16+
zephyr,gain = "ADC_GAIN_1";
17+
zephyr,reference = "ADC_REF_EXTERNAL0";
18+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
19+
zephyr,resolution = <12>;
20+
zephyr,input-positive = <IADC_INPUT_DAC0>;
21+
};
22+
};
23+
24+
&vdac0 {
25+
status = "okay";
26+
voltage-reference = "1.25V";
27+
28+
channel0 {
29+
aux-output;
30+
aux-output-port = "None";
31+
aux-output-pin = <0>;
32+
low-power-mode;
33+
};
34+
};
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include "dt-bindings/adc/silabs-adc.h"
8+
9+
&adc0 {
10+
#address-cells = <1>;
11+
#size-cells = <0>;
12+
status = "okay";
13+
14+
channel@0 {
15+
reg = <0>;
16+
zephyr,gain = "ADC_GAIN_1";
17+
zephyr,reference = "ADC_REF_VDD_1";
18+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
19+
zephyr,resolution = <12>;
20+
zephyr,input-positive = <IADC_INPUT_DAC0>;
21+
};
22+
};
23+
24+
&vdac0 {
25+
status = "okay";
26+
voltage-reference = "AVDD";
27+
28+
channel0 {
29+
aux-output;
30+
aux-output-port = "None";
31+
aux-output-pin = <0>;
32+
low-power-mode;
33+
};
34+
};

tests/drivers/dac/dac_loopback/src/test_dac.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,23 @@
184184
#define ADC_CHANNEL_ID 0
185185
#endif
186186

187+
#elif defined(CONFIG_BOARD_XG24_DK2601B) || \
188+
defined(CONFIG_BOARD_XG24_RB4187C)
189+
190+
/* VDAC0CH0 output is internally available on IADC_INPUT_DAC0 */
191+
192+
#define DAC_DEVICE_NODE DT_NODELABEL(vdac0)
193+
#define DAC_RESOLUTION 12
194+
#define DAC_CHANNEL_ID 0
195+
196+
#define ADC_DEVICE_NODE DT_NODELABEL(adc0)
197+
#define ADC_RESOLUTION 12
198+
#define ADC_GAIN ADC_GAIN_1
199+
#define ADC_REFERENCE ADC_REF_VDD_1
200+
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
201+
#define ADC_CHANNEL_ID 0
202+
#define ADC_1ST_CHANNEL_INPUT 0x20 /* IADC_INPUT_DAC0 */
203+
187204
#else
188205
#error "Unsupported board."
189206
#endif
@@ -208,7 +225,9 @@ static const struct adc_channel_cfg adc_ch_cfg = {
208225
defined(CONFIG_BOARD_BL653_DVK) || \
209226
defined(CONFIG_BOARD_BL654_DVK) || \
210227
defined(CONFIG_BOARD_BL5340_DVK) || \
211-
defined(CONFIG_BOARD_LPCXPRESSO55S36)
228+
defined(CONFIG_BOARD_LPCXPRESSO55S36) || \
229+
defined(CONFIG_BOARD_XG24_DK2601B) || \
230+
defined(CONFIG_BOARD_XG24_RB4187C)
212231
.input_positive = ADC_1ST_CHANNEL_INPUT,
213232
#endif
214233
};

tests/drivers/dac/dac_loopback/testcase.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ tests:
2929
- nucleo_g071rb
3030
- nucleo_wl55jc
3131
- lpcxpresso55s36
32+
- xg24_dk2601b
3233
integration_platforms:
3334
- nucleo_f207zg

0 commit comments

Comments
 (0)