Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions boards/arm/atsamc21n_xpro/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SAM C21N Xplained Pro Board configuration

# Copyright (c) 2022 Kamil Serwus
# SPDX-License-Identifier: Apache-2.0

config BOARD_ATSAMC21N_XPRO
bool "SAM C21N Xplained Pro"
depends on SOC_PART_NUMBER_SAMC21N18A
8 changes: 8 additions & 0 deletions boards/arm/atsamc21n_xpro/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SAM C21N Xplained Pro board configuration

# Copyright (c) 2022 Kamil Serwus
# SPDX-License-Identifier: Apache-2.0

config BOARD
default "atsamc21n_xpro"
depends on BOARD_ATSAMC21N_XPRO
64 changes: 64 additions & 0 deletions boards/arm/atsamc21n_xpro/atsamc21n_xpro-pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
/*
* Copyright (c) 2022 Kamil Serwus
* SPDX-License-Identifier: Apache-2.0
*/

#include <dt-bindings/pinctrl/samc21n-pinctrl.h>

&pinctrl {

pwm_default: pwm_default {
group1 {
pinmux = <PC5F_TCC2_WO1>;
};
};

adc0_default: adc0_default {
group1 {
pinmux = <PB9B_ADC0_AIN3>;
};
};

adc1_default: adc1_default {
group1 {
pinmux = <PA8B_ADC1_AIN10>;
};
};

sercom0_uart_default: sercom0_uart_default {
group1 {
pinmux = <PB25C_SERCOM0_PAD1>,
<PB24C_SERCOM0_PAD0>;
};
};

sercom1_i2c_default: sercom1_i2c_default {
group1 {
pinmux = <PA16C_SERCOM1_PAD0>,
<PA17C_SERCOM1_PAD1>;
};
};

sercom2_uart_default: sercom1_uart_default {
group1 {
pinmux = <PA13C_SERCOM2_PAD1>,
<PA12C_SERCOM2_PAD0>;
};
};

sercom4_uart_default: sercom4_uart_default {
group1 {
pinmux = <PB11D_SERCOM4_PAD3>,
<PB10D_SERCOM4_PAD2>;
};
};

sercom5_spi_default: sercom5_spi_default {
group1 {
pinmux = <PB0D_SERCOM5_PAD2>,
<PB2D_SERCOM5_PAD0>,
<PB1D_SERCOM5_PAD3>;
};
};

};
153 changes: 153 additions & 0 deletions boards/arm/atsamc21n_xpro/atsamc21n_xpro.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* Copyright (c) 2022 Kamil Serwus
*
* SPDX-License-Identifier: Apache-2.0
*/

/dts-v1/;

#include <atmel/samc21x18.dtsi>
#include "atsamc21n_xpro-pinctrl.dtsi"

/ {
model = "SAM C21N Xplained Pro";
compatible = "atsamc21n,xpro", "atmel,samc21n18a", "atmel,samc21";

chosen {
zephyr,console = &sercom4;
zephyr,shell-uart = &sercom4;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
pwm-led0 = &pwm_led0;
sw0 = &user_button;
i2c-0 = &sercom1;
};

leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&portc 05 GPIO_ACTIVE_LOW>;
label = "Yellow LED";
};
};

pwmleds {
compatible = "pwm-leds";
pwm_led0: pwm_led_0 {
pwms = <&tcc2 1 PWM_MSEC(20)>;
};
};

buttons {
compatible = "gpio-keys";
user_button: button_0 {
gpios = <&portb 19 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "User Button";
};
};

};

&cpu0 {
clock-frequency = <48000000>;
};

&adc0 {
status = "okay";
pinctrl-0 = <&adc0_default>;
pinctrl-names = "default";
};

&adc1 {
pinctrl-0 = <&adc1_default>;
pinctrl-names = "default";
};

&tcc2 {
status = "okay";
compatible = "atmel,sam0-tcc-pwm";
prescaler = <256>;
#pwm-cells = <2>;

pinctrl-0 = <&pwm_default>;
pinctrl-names = "default";
};

&sercom0 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <9600>;
rxpo = <1>;
txpo = <0>;

pinctrl-0 = <&sercom0_uart_default>;
pinctrl-names = "default";
};

&sercom1 {
status = "okay";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;

pinctrl-0 = <&sercom1_i2c_default>;
pinctrl-names = "default";
};

&sercom2 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
rxpo = <1>;
txpo = <0>;

pinctrl-0 = <&sercom2_uart_default>;
pinctrl-names = "default";
};

&sercom4 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
rxpo = <3>;
txpo = <1>;

pinctrl-0 = <&sercom4_uart_default>;
pinctrl-names = "default";
};

&sercom5 {
status = "okay";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <2>;
#address-cells = <1>;
#size-cells = <0>;

pinctrl-0 = <&sercom5_spi_default>;
pinctrl-names = "default";
};

&flash0 {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

/*
* The final 16 KiB is reserved for the application.
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@3c000 {
label = "storage";
reg = <0x0003c000 0x00004000>;
};
};
};
18 changes: 18 additions & 0 deletions boards/arm/atsamc21n_xpro/atsamc21n_xpro.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright (c) 2022 Kamil Serwus
# SPDX-License-Identifier: Apache-2.0
identifier: atsamc21n_xpro
name: SAM C21N Xplained Pro
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- gpio
- i2c
- pwm
- spi
11 changes: 11 additions & 0 deletions boards/arm/atsamc21n_xpro/atsamc21n_xpro_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Copyright (c) 2022 Kamil Serwus
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_SAMC21=y
CONFIG_SOC_PART_NUMBER_SAMC21N18A=y
CONFIG_BOARD_ATSAMC21N_XPRO=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_GPIO=y
4 changes: 4 additions & 0 deletions boards/arm/atsamc21n_xpro/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2022 Kamil Serwus
# SPDX-License-Identifier: Apache-2.0

include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading