Skip to content

Commit 73f122b

Browse files
committed
boards: Add Arduino MKRZero
Built upon the existing SoC for Atmel's SAMD21 MCU but with support enabled for two newly added peripherals: - I2C port (SERCOM) - External Interrupt Controller Signed-off-by: Madani Lainani <[email protected]>
1 parent 9b0a625 commit 73f122b

File tree

14 files changed

+529
-1
lines changed

14 files changed

+529
-1
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2018 Madani Lainani.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
if(CONFIG_PINMUX_SAM0)
5+
zephyr_library()
6+
zephyr_library_sources(pinmux.c)
7+
endif()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Kconfig - Arduino MKRZero Board configuration
2+
#
3+
# Copyright (c) 2018 Madani Lainani.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
config BOARD_ARDUINO_MKRZERO
7+
bool "Arduino MKRZero"
8+
depends on SOC_PART_NUMBER_SAMD21G18A
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Kconfig - Arduino MKRZero board configuration
2+
#
3+
# Copyright (c) 2018 Madani Lainani.
4+
# SPDX-License-Identifier: Apache-2.0
5+
6+
if BOARD_ARDUINO_MKRZERO
7+
8+
config BOARD
9+
default "arduino_mkrzero"
10+
11+
endif # BOARD_ARDUINO_MKRZERO
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
/*
2+
* Copyright (c) 2018 Madani Lainani.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
/dts-v1/;
8+
#include <atmel/samd21.dtsi>
9+
#include <dt-bindings/i2c/i2c.h>
10+
11+
/ {
12+
model = "Arduino MKRZero";
13+
compatible = "arduino,mkrzero", "atmel,samd21g18a", "atmel,samd21";
14+
15+
chosen {
16+
zephyr,console = &sercom5;
17+
zephyr,sram = &sram0;
18+
zephyr,flash = &flash0;
19+
};
20+
21+
/* These aliases are provided for compatibility with samples */
22+
aliases {
23+
led0 = &led_builtin;
24+
};
25+
26+
leds {
27+
compatible = "gpio-leds";
28+
led_builtin: led_0 {
29+
gpios = <&portb 8 0>;
30+
label = "Built-in LED";
31+
};
32+
};
33+
};
34+
35+
&sercom0 {
36+
status = "ok";
37+
compatible = "atmel,sam0-i2c";
38+
clock-frequency = <I2C_BITRATE_STANDARD>;
39+
};
40+
41+
&sercom5 {
42+
status = "ok";
43+
compatible = "atmel,sam0-uart";
44+
current-speed = <115200>;
45+
rxpo = <3>;
46+
txpo = <1>;
47+
};
48+
49+
&portb {
50+
status = "ok";
51+
};
52+
53+
&flash0 {
54+
partitions {
55+
compatible = "fixed-partitions";
56+
#address-cells = <1>;
57+
#size-cells = <1>;
58+
59+
/*
60+
* The final 16 KiB is reserved for the application
61+
* and is used by NFFS if enabled.
62+
*/
63+
64+
#if defined(CONFIG_FS_FLASH_MAP_STORAGE)
65+
storage_partition: partition@3c000 {
66+
label = "storage";
67+
reg = <0x0003c000 0x00004000>;
68+
};
69+
#endif
70+
};
71+
};
72+
73+
&eic0 {
74+
status = "ok";
75+
};
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2018, Madani Lainani.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
identifier: arduino_mkrzero
5+
name: Arduino MKRZero
6+
type: mcu
7+
arch: arm
8+
ram: 32
9+
flash: 256
10+
toolchain:
11+
- zephyr
12+
- gccarmemb
13+
supported:
14+
- gpio
15+
- i2c
16+
- pinmux
17+
- uart
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright (c) 2018 Madani Lainani.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
CONFIG_ARM=y
5+
CONFIG_SOC_FAMILY_SAM0=y
6+
CONFIG_SOC_SERIES_SAMD21=y
7+
CONFIG_SOC_PART_NUMBER_SAMD21G18A=y
8+
CONFIG_BOARD_ARDUINO_MKRZERO=y
9+
CONFIG_CORTEX_M_SYSTICK=y
10+
CONFIG_CONSOLE=y
11+
CONFIG_UART_CONSOLE=y
12+
CONFIG_SERIAL=y
13+
CONFIG_UART_SAM0=y
14+
CONFIG_UART_INTERRUPT_DRIVEN=y
15+
CONFIG_GPIO=y
16+
CONFIG_GPIO_SAM0=y
17+
CONFIG_WATCHDOG=y
18+
CONFIG_WDT_SAM0=y
19+
CONFIG_SOC_ATMEL_SAMD_XOSC32K=y
20+
CONFIG_SOC_ATMEL_SAMD_XOSC32K_AS_MAIN=y
21+
# CONFIG_SPI=y
22+
# CONFIG_SPI_SAM0=y
23+
24+
# The below definition is not used in the SAM0 SERCOM SPI driver code. Its sole
25+
# purpose seems to be reflecting the board DTS configuration in the
26+
# configuration interface.
27+
# CONFIG_SPI_1=y
28+
CONFIG_I2C=y
29+
CONFIG_I2C_SAM0=y
30+
31+
# The below definition is not used in the SAM0 SERCOM I2C driver code. Its sole
32+
# purpose seems to be reflecting the board DTS configuration in the
33+
# configuration interface.
34+
CONFIG_I2C_0=y
35+
CONFIG_PINMUX=y
36+
CONFIG_PINMUX_SAM0=y
37+
# CONFIG_USB=y
38+
# CONFIG_USB_DC_SAM0=y
39+
40+
# External Interrupt Controller
41+
# CONFIG_EIC_SAM0=y
42+
43+
# Map External interrupt 2 to pin A1
44+
# CONFIG_GPIO_SAM0_PORTB_EXTINT_2=y
45+
# CONFIG_GPIO_SAM0_PORTB_EXTINT_2_PIN=2
46+
47+
# FXAS21002C gyroscope I2C address on the Adafruit Precision NXP 9-DOF breakout
48+
# board
49+
# CONFIG_FXAS21002_I2C_NAME="SERCOM0"
50+
# CONFIG_FXAS21002_I2C_ADDRESS=0x21
51+
# CONFIG_FXAS21002_RANGE=3
52+
53+
# CONFIG_FXAS21002_GPIO_NAME="PORTB"
54+
# CONFIG_FXAS21002_GPIO_PIN=2
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Copyright (c) 2018 Madani Lainani.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

boards/arm/arduino_mkrzero/board.h

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2018 Madani Lainani.
3+
*
4+
* SPDX-License-Identifier: Apache-2.0
5+
*/
6+
7+
#ifndef __INC_BOARD_H
8+
#define __INC_BOARD_H
9+
10+
#include <soc.h>
11+
12+
/* Default rise time in nanoseconds, based on 4.7K ohm pull up resistors */
13+
#define CONFIG_I2C_SAM0_SERCOM0_RISE_TIME_NS 125
14+
15+
#define CONFIG_SPI_SAM0_SERCOM1_PADS \
16+
(SERCOM_SPI_CTRLA_DIPO(3) | SERCOM_SPI_CTRLA_DOPO(0))
17+
18+
#define CONFIG_UART_SAM0_SERCOM5_PADS \
19+
(SERCOM_USART_CTRLA_RXPO(3) | SERCOM_USART_CTRLA_TXPO(1))
20+
21+
#endif /* __INC_BOARD_H */

0 commit comments

Comments
 (0)