Skip to content

Commit 93370f3

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 6c7e560 commit 93370f3

File tree

7 files changed

+127
-1
lines changed

7 files changed

+127
-1
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+
#include <zephyr/dt-bindings/dac/silabs-vdac.h>
8+
9+
&vdac0 {
10+
status = "okay";
11+
voltage-reference = "1.25V";
12+
13+
channel@0 {
14+
reg = <0>;
15+
aux-output = <VDAC_OUTPUT_AUX>;
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+
#include <zephyr/dt-bindings/dac/silabs-vdac.h>
8+
9+
&vdac0 {
10+
status = "okay";
11+
voltage-reference = "1.25V";
12+
13+
channel@0 {
14+
reg = <0>;
15+
aux-output = <VDAC_OUTPUT_AUX>;
16+
};
17+
};

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
#define DAC_RESOLUTION 12
115115
#define DAC_CHANNEL_ID 0
116116

117+
#elif defined(CONFIG_SOC_FAMILY_SILABS_S2)
118+
119+
#define DAC_DEVICE_NODE DT_NODELABEL(vdac0)
120+
#define DAC_RESOLUTION 12
121+
#define DAC_CHANNEL_ID 0
122+
117123
#else
118124
#error "Unsupported board."
119125
#endif
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/adc/silabs-adc.h>
8+
#include <zephyr/dt-bindings/dac/silabs-vdac.h>
9+
10+
&adc0 {
11+
#address-cells = <1>;
12+
#size-cells = <0>;
13+
status = "okay";
14+
15+
channel@0 {
16+
reg = <0>;
17+
zephyr,gain = "ADC_GAIN_1";
18+
zephyr,reference = "ADC_REF_VDD_1";
19+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
20+
zephyr,resolution = <12>;
21+
zephyr,input-positive = <IADC_INPUT_DAC0>;
22+
};
23+
};
24+
25+
&vdac0 {
26+
status = "okay";
27+
voltage-reference = "AVDD";
28+
29+
channel@0 {
30+
reg = <0>;
31+
aux-output = <VDAC_OUTPUT_AUX>;
32+
};
33+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2025 Silicon Laboratories Inc.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#include <zephyr/dt-bindings/adc/silabs-adc.h>
8+
#include <zephyr/dt-bindings/dac/silabs-vdac.h>
9+
10+
&adc0 {
11+
#address-cells = <1>;
12+
#size-cells = <0>;
13+
status = "okay";
14+
15+
channel@0 {
16+
reg = <0>;
17+
zephyr,gain = "ADC_GAIN_1";
18+
zephyr,reference = "ADC_REF_VDD_1";
19+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
20+
zephyr,resolution = <12>;
21+
zephyr,input-positive = <IADC_INPUT_DAC0>;
22+
};
23+
};
24+
25+
&vdac0 {
26+
status = "okay";
27+
voltage-reference = "AVDD";
28+
29+
channel@0 {
30+
reg = <0>;
31+
aux-output = <VDAC_OUTPUT_AUX>;
32+
};
33+
};

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,24 @@
184184
#define ADC_CHANNEL_ID 0
185185
#endif
186186

187+
#elif defined(CONFIG_SOC_FAMILY_SILABS_S2)
188+
189+
/* VDAC0CH0 output is internally available on IADC_INPUT_DAC0 */
190+
191+
#include <zephyr/dt-bindings/adc/silabs-adc.h>
192+
193+
#define DAC_DEVICE_NODE DT_NODELABEL(vdac0)
194+
#define DAC_RESOLUTION 12
195+
#define DAC_CHANNEL_ID 0
196+
197+
#define ADC_DEVICE_NODE DT_NODELABEL(adc0)
198+
#define ADC_RESOLUTION 12
199+
#define ADC_GAIN ADC_GAIN_1
200+
#define ADC_REFERENCE ADC_REF_VDD_1
201+
#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
202+
#define ADC_CHANNEL_ID 0
203+
#define ADC_1ST_CHANNEL_INPUT IADC_INPUT_DAC0
204+
187205
#else
188206
#error "Unsupported board."
189207
#endif
@@ -208,7 +226,8 @@ static const struct adc_channel_cfg adc_ch_cfg = {
208226
defined(CONFIG_BOARD_BL653_DVK) || \
209227
defined(CONFIG_BOARD_BL654_DVK) || \
210228
defined(CONFIG_BOARD_BL5340_DVK) || \
211-
defined(CONFIG_BOARD_LPCXPRESSO55S36)
229+
defined(CONFIG_BOARD_LPCXPRESSO55S36) || \
230+
defined(CONFIG_SOC_FAMILY_SILABS_S2)
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)