Skip to content

Commit 3eabb38

Browse files
committed
board: samc21: add support for SAMC21N Xplained Pro Board
Add basic support board with SAMC21N soc including SPI, UART, I2C, ADC, Flash, Leds. Signed-off-by: Kamil Serwus <[email protected]>
1 parent 4bd94f5 commit 3eabb38

File tree

12 files changed

+513
-0
lines changed

12 files changed

+513
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SAM C21N Xplained Pro Board configuration
2+
3+
# Copyright (c) 2022 Kamil Serwus
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ATSAMC21N_XPRO
7+
bool "SAM C21N Xplained Pro"
8+
depends on SOC_PART_NUMBER_SAMC21N18A
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# SAM C21N Xplained Pro board configuration
2+
3+
# Copyright (c) 2022 Kamil Serwus
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD
7+
default "atsamc21n_xpro"
8+
depends on BOARD_ATSAMC21N_XPRO
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2022 Kamil Serwus
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <dt-bindings/pinctrl/samc21n-pinctrl.h>
7+
8+
&pinctrl {
9+
10+
pwm_default: pwm_default {
11+
group1 {
12+
pinmux = <PC5F_TCC2_WO1>;
13+
};
14+
};
15+
16+
adc0_default: adc0_default {
17+
group1 {
18+
pinmux = <PB9B_ADC0_AIN3>;
19+
};
20+
};
21+
22+
adc1_default: adc1_default {
23+
group1 {
24+
pinmux = <PA8B_ADC1_AIN10>;
25+
};
26+
};
27+
28+
sercom0_uart_default: sercom0_uart_default {
29+
group1 {
30+
pinmux = <PB25C_SERCOM0_PAD1>,
31+
<PB24C_SERCOM0_PAD0>;
32+
};
33+
};
34+
35+
sercom1_i2c_default: sercom1_i2c_default {
36+
group1 {
37+
pinmux = <PA16C_SERCOM1_PAD0>,
38+
<PA17C_SERCOM1_PAD1>;
39+
};
40+
};
41+
42+
sercom2_uart_default: sercom1_uart_default {
43+
group1 {
44+
pinmux = <PA13C_SERCOM2_PAD1>,
45+
<PA12C_SERCOM2_PAD0>;
46+
};
47+
};
48+
49+
sercom4_uart_default: sercom4_uart_default {
50+
group1 {
51+
pinmux = <PB11D_SERCOM4_PAD3>,
52+
<PB10D_SERCOM4_PAD2>;
53+
};
54+
};
55+
56+
sercom5_spi_default: sercom5_spi_default {
57+
group1 {
58+
pinmux = <PB0D_SERCOM5_PAD2>,
59+
<PB2D_SERCOM5_PAD0>,
60+
<PB1D_SERCOM5_PAD3>;
61+
};
62+
};
63+
64+
};
Lines changed: 153 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,153 @@
1+
/*
2+
* Copyright (c) 2022 Kamil Serwus
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
9+
#include <atmel/samc21x18.dtsi>
10+
#include "atsamc21n_xpro-pinctrl.dtsi"
11+
12+
/ {
13+
model = "SAM C21N Xplained Pro";
14+
compatible = "atsamc21n,xpro", "atmel,samc21n18a", "atmel,samc21";
15+
16+
chosen {
17+
zephyr,console = &sercom4;
18+
zephyr,shell-uart = &sercom4;
19+
zephyr,sram = &sram0;
20+
zephyr,flash = &flash0;
21+
};
22+
23+
/* These aliases are provided for compatibility with samples */
24+
aliases {
25+
led0 = &led0;
26+
pwm-led0 = &pwm_led0;
27+
sw0 = &user_button;
28+
i2c-0 = &sercom1;
29+
};
30+
31+
leds {
32+
compatible = "gpio-leds";
33+
led0: led_0 {
34+
gpios = <&portc 05 GPIO_ACTIVE_LOW>;
35+
label = "Yellow LED";
36+
};
37+
};
38+
39+
pwmleds {
40+
compatible = "pwm-leds";
41+
pwm_led0: pwm_led_0 {
42+
pwms = <&tcc2 1 PWM_MSEC(20)>;
43+
};
44+
};
45+
46+
buttons {
47+
compatible = "gpio-keys";
48+
user_button: button_0 {
49+
gpios = <&portb 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
50+
label = "User Button";
51+
};
52+
};
53+
54+
};
55+
56+
&cpu0 {
57+
clock-frequency = <48000000>;
58+
};
59+
60+
&adc0 {
61+
status = "okay";
62+
pinctrl-0 = <&adc0_default>;
63+
pinctrl-names = "default";
64+
};
65+
66+
&adc1 {
67+
pinctrl-0 = <&adc1_default>;
68+
pinctrl-names = "default";
69+
};
70+
71+
&tcc2 {
72+
status = "okay";
73+
compatible = "atmel,sam0-tcc-pwm";
74+
prescaler = <256>;
75+
#pwm-cells = <2>;
76+
77+
pinctrl-0 = <&pwm_default>;
78+
pinctrl-names = "default";
79+
};
80+
81+
&sercom0 {
82+
status = "okay";
83+
compatible = "atmel,sam0-uart";
84+
current-speed = <9600>;
85+
rxpo = <1>;
86+
txpo = <0>;
87+
88+
pinctrl-0 = <&sercom0_uart_default>;
89+
pinctrl-names = "default";
90+
};
91+
92+
&sercom1 {
93+
status = "okay";
94+
compatible = "atmel,sam0-i2c";
95+
clock-frequency = <I2C_BITRATE_FAST>;
96+
#address-cells = <1>;
97+
#size-cells = <0>;
98+
99+
pinctrl-0 = <&sercom1_i2c_default>;
100+
pinctrl-names = "default";
101+
};
102+
103+
&sercom2 {
104+
status = "okay";
105+
compatible = "atmel,sam0-uart";
106+
current-speed = <115200>;
107+
rxpo = <1>;
108+
txpo = <0>;
109+
110+
pinctrl-0 = <&sercom2_uart_default>;
111+
pinctrl-names = "default";
112+
};
113+
114+
&sercom4 {
115+
status = "okay";
116+
compatible = "atmel,sam0-uart";
117+
current-speed = <115200>;
118+
rxpo = <3>;
119+
txpo = <1>;
120+
121+
pinctrl-0 = <&sercom4_uart_default>;
122+
pinctrl-names = "default";
123+
};
124+
125+
&sercom5 {
126+
status = "okay";
127+
compatible = "atmel,sam0-spi";
128+
dipo = <0>;
129+
dopo = <2>;
130+
#address-cells = <1>;
131+
#size-cells = <0>;
132+
133+
pinctrl-0 = <&sercom5_spi_default>;
134+
pinctrl-names = "default";
135+
};
136+
137+
&flash0 {
138+
partitions {
139+
compatible = "fixed-partitions";
140+
#address-cells = <1>;
141+
#size-cells = <1>;
142+
143+
/*
144+
* The final 16 KiB is reserved for the application.
145+
* Storage partition will be used by FCB/LittleFS/NVS
146+
* if enabled.
147+
*/
148+
storage_partition: partition@3c000 {
149+
label = "storage";
150+
reg = <0x0003c000 0x00004000>;
151+
};
152+
};
153+
};
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2022 Kamil Serwus
2+
# SPDX-License-Identifier: Apache-2.0
3+
identifier: atsamc21n_xpro
4+
name: SAM C21N Xplained Pro
5+
type: mcu
6+
arch: arm
7+
ram: 32
8+
flash: 256
9+
toolchain:
10+
- zephyr
11+
- gnuarmemb
12+
- xtools
13+
supported:
14+
- adc
15+
- gpio
16+
- i2c
17+
- pwm
18+
- spi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2022 Kamil Serwus
2+
# SPDX-License-Identifier: Apache-2.0
3+
CONFIG_SOC_SERIES_SAMC21=y
4+
CONFIG_SOC_PART_NUMBER_SAMC21N18A=y
5+
CONFIG_BOARD_ATSAMC21N_XPRO=y
6+
CONFIG_BUILD_OUTPUT_HEX=y
7+
CONFIG_CONSOLE=y
8+
CONFIG_UART_CONSOLE=y
9+
CONFIG_SERIAL=y
10+
CONFIG_UART_INTERRUPT_DRIVEN=y
11+
CONFIG_GPIO=y
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2022 Kamil Serwus
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
29 KB
Loading

0 commit comments

Comments
 (0)