Skip to content

Commit 3b8feca

Browse files
committed
boards: arduino: add ADC support for the Nano Matter
Adds ADC capability to the A0-A7 pins on the board. Signed-off-by: Tamas Jozsi <tamas.jozsi@silabs.com>
1 parent 91b1b84 commit 3b8feca

File tree

2 files changed

+131
-0
lines changed

2 files changed

+131
-0
lines changed

boards/arduino/nano_matter/arduino_nano_matter-pinctrl.dtsi

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,28 @@
3636
};
3737
};
3838

39+
iadc0_default: iadc0_default {
40+
group0 {
41+
silabs,analog-bus = <ABUS_AEVEN0_IADC0>;
42+
};
43+
44+
group1 {
45+
silabs,analog-bus = <ABUS_AODD0_IADC0>;
46+
};
47+
48+
group2 {
49+
silabs,analog-bus = <ABUS_BEVEN0_IADC0>;
50+
};
51+
52+
group3 {
53+
silabs,analog-bus = <ABUS_BODD0_IADC0>;
54+
};
55+
56+
group4 {
57+
silabs,analog-bus = <ABUS_CDEVEN0_IADC0>;
58+
};
59+
};
60+
3961
i2c0_default: i2c0_default {
4062
group0 {
4163
pins = <I2C0_SCL_PA7>, <I2C0_SDA_PA6>;

boards/arduino/nano_matter/arduino_nano_matter.dts

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/dts-v1/;
99
#include <silabs/xg24/mgm240sd22vna.dtsi>
1010
#include <zephyr/dt-bindings/input/input-event-codes.h>
11+
#include <dt-bindings/adc/silabs-adc.h>
1112
#include <zephyr/dt-bindings/pwm/pwm.h>
1213
#include "arduino_nano_matter-pinctrl.dtsi"
1314
#include "arduino_nano_matter_connector.dtsi"
@@ -36,6 +37,7 @@
3637
pwm-led2 = &blue_pwm_led;
3738
sw0 = &button0;
3839
watchdog0 = &wdog0;
40+
adc0 = &adc0;
3941
};
4042

4143
leds {
@@ -84,6 +86,17 @@
8486
zephyr,code = <INPUT_KEY_0>;
8587
};
8688
};
89+
90+
zephyr,user {
91+
io-channels = <&adc0 0>,
92+
<&adc0 1>,
93+
<&adc0 2>,
94+
<&adc0 3>,
95+
<&adc0 4>,
96+
<&adc0 5>,
97+
<&adc0 6>,
98+
<&adc0 7>;
99+
};
87100
};
88101

89102
&timer0 {
@@ -203,6 +216,102 @@
203216
status = "okay";
204217
};
205218

219+
&adc0 {
220+
pinctrl-0 = <&iadc0_default>;
221+
pinctrl-names = "default";
222+
#address-cells = <1>;
223+
#size-cells = <0>;
224+
status = "okay";
225+
226+
// A0 - PB0
227+
channel@0 {
228+
reg = <0>;
229+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
230+
zephyr,gain = "ADC_GAIN_1";
231+
zephyr,input-positive = <IADC_INPUT_PB0>;
232+
zephyr,reference = "ADC_REF_VDD_1";
233+
zephyr,resolution = <12>;
234+
zephyr,vref-mv = <3300>;
235+
};
236+
237+
// A1 - PB2
238+
channel@1 {
239+
reg = <1>;
240+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
241+
zephyr,gain = "ADC_GAIN_1";
242+
zephyr,input-positive = <IADC_INPUT_PB2>;
243+
zephyr,reference = "ADC_REF_VDD_1";
244+
zephyr,resolution = <12>;
245+
zephyr,vref-mv = <3300>;
246+
};
247+
248+
// A2 - PB5
249+
channel@2 {
250+
reg = <2>;
251+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
252+
zephyr,gain = "ADC_GAIN_1";
253+
zephyr,input-positive = <IADC_INPUT_PB5>;
254+
zephyr,reference = "ADC_REF_VDD_1";
255+
zephyr,resolution = <12>;
256+
zephyr,vref-mv = <3300>;
257+
};
258+
259+
// A3 - PC0
260+
channel@3 {
261+
reg = <3>;
262+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
263+
zephyr,gain = "ADC_GAIN_1";
264+
zephyr,input-positive = <IADC_INPUT_PC0>;
265+
zephyr,reference = "ADC_REF_VDD_1";
266+
zephyr,resolution = <12>;
267+
zephyr,vref-mv = <3300>;
268+
};
269+
270+
// A4 - PA6
271+
channel@4 {
272+
reg = <4>;
273+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
274+
zephyr,gain = "ADC_GAIN_1";
275+
zephyr,input-positive = <IADC_INPUT_PA6>;
276+
zephyr,reference = "ADC_REF_VDD_1";
277+
zephyr,resolution = <12>;
278+
zephyr,vref-mv = <3300>;
279+
};
280+
281+
// A5 - PA7
282+
channel@5 {
283+
reg = <5>;
284+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
285+
zephyr,gain = "ADC_GAIN_1";
286+
zephyr,input-positive = <IADC_INPUT_PA7>;
287+
zephyr,reference = "ADC_REF_VDD_1";
288+
zephyr,resolution = <12>;
289+
zephyr,vref-mv = <3300>;
290+
};
291+
292+
// A6 - PB1
293+
channel@6 {
294+
reg = <6>;
295+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
296+
zephyr,gain = "ADC_GAIN_1";
297+
zephyr,input-positive = <IADC_INPUT_PB1>;
298+
zephyr,reference = "ADC_REF_VDD_1";
299+
zephyr,resolution = <12>;
300+
zephyr,vref-mv = <3300>;
301+
};
302+
303+
// A7 - PB3
304+
channel@7 {
305+
reg = <7>;
306+
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
307+
zephyr,gain = "ADC_GAIN_1";
308+
zephyr,input-positive = <IADC_INPUT_PB3>;
309+
zephyr,reference = "ADC_REF_VDD_1";
310+
zephyr,resolution = <12>;
311+
zephyr,vref-mv = <3300>;
312+
};
313+
};
314+
206315
&flash0 {
207316
partitions {
208317
compatible = "fixed-partitions";

0 commit comments

Comments
 (0)