Skip to content

Commit d9273ba

Browse files
Thinh Le Congduynguyenxa
authored andcommitted
samples: drivers: adc: Add tests support for ADC driver on EK-RA2A1 board
Add Renesas EK-RA2A1 board support for sample: - samples/drivers/adc/adc_dt Signed-off-by: Thinh Le Cong <[email protected]>
1 parent 74e3ed6 commit d9273ba

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* Copyright (c) 2025 Renesas Electronics Corporation
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/ {
8+
zephyr,user {
9+
io-channels = <&adc0 0>, <&adc0 1>;
10+
};
11+
};
12+
13+
&pinctrl {
14+
adc0_default: adc0_default {
15+
group1 {
16+
/* input */
17+
psels = <RA_PSEL(RA_PSEL_ADC, 5, 0)>,
18+
<RA_PSEL(RA_PSEL_ADC, 5, 1)>;
19+
renesas,analog-enable;
20+
};
21+
};
22+
};
23+
24+
&adc0 {
25+
status = "okay";
26+
#address-cells = <1>;
27+
#size-cells = <0>;
28+
interrupts = <31 1>;
29+
interrupt-names = "scanend";
30+
31+
/*
32+
* Channel 0 is used in single ended mode, with 15 bit resolution
33+
*/
34+
channel@0 {
35+
reg = <0>;
36+
zephyr,gain = "ADC_GAIN_1";
37+
zephyr,reference = "ADC_REF_EXTERNAL0";
38+
zephyr,resolution = <15>;
39+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
40+
zephyr,vref-mv = <3300>;
41+
};
42+
43+
/*
44+
* Channel 1 is used in single ended mode, with 15 bit resolution
45+
*/
46+
channel@1 {
47+
reg = <1>;
48+
zephyr,gain = "ADC_GAIN_1";
49+
zephyr,reference = "ADC_REF_EXTERNAL0";
50+
zephyr,resolution = <15>;
51+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
52+
zephyr,vref-mv = <3300>;
53+
};
54+
};

samples/drivers/adc/adc_dt/src/main.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ int main(void)
3838
.buffer = &buf,
3939
/* buffer size in bytes, not number of samples */
4040
.buffer_size = sizeof(buf),
41+
#if DT_HAS_COMPAT_STATUS_OKAY(renesas_ra_adc_16)
42+
.calibrate = true,
43+
#endif
4144
};
4245

4346
/* Configure channels individually prior to sampling. */

0 commit comments

Comments
 (0)