Skip to content

Commit 2d19154

Browse files
Thinh Le Congduynguyenxa
authored andcommitted
samples: drivers: adc: Add samples config for ADC 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 883b07f commit 2d19154

File tree

2 files changed

+59
-0
lines changed

2 files changed

+59
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
pinctrl-0 = <&adc0_default>;
26+
pinctrl-names = "default";
27+
status = "okay";
28+
#address-cells = <1>;
29+
#size-cells = <0>;
30+
interrupts = <31 1>;
31+
interrupt-names = "scanend";
32+
33+
/*
34+
* Channel 0 is used in single ended mode, with 15 bit resolution
35+
*/
36+
channel@0 {
37+
reg = <0>;
38+
zephyr,gain = "ADC_GAIN_1";
39+
zephyr,reference = "ADC_REF_EXTERNAL0";
40+
zephyr,resolution = <15>;
41+
zephyr,acquisition-time = <0>;
42+
zephyr,vref-mv = <3300>;
43+
};
44+
45+
/*
46+
* Channel 1 is used in single ended mode, with 15 bit resolution
47+
*/
48+
channel@1 {
49+
reg = <1>;
50+
zephyr,gain = "ADC_GAIN_1";
51+
zephyr,reference = "ADC_REF_EXTERNAL0";
52+
zephyr,resolution = <15>;
53+
zephyr,acquisition-time = <0>;
54+
zephyr,vref-mv = <3300>;
55+
};
56+
};

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)
42+
.calibrate = true,
43+
#endif
4144
};
4245

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

0 commit comments

Comments
 (0)