Skip to content

Commit 191f38b

Browse files
Merge pull request #6881 from aabadie/mkrzero
boards/arduino-mkrzero: add initial support
2 parents 7f14e15 + 0163815 commit 191f38b

File tree

22 files changed

+224
-90
lines changed

22 files changed

+224
-90
lines changed

boards/arduino-mkr-common/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
MODULE = arduino-mkr-common
2+
3+
include $(RIOTBASE)/Makefile.base
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ifneq (,$(filter saul_default,$(USEMODULE)))
2+
USEMODULE += saul_gpio
3+
endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Put defined MCU peripherals here (in alphabetical order)
2+
FEATURES_PROVIDED += periph_adc
3+
FEATURES_PROVIDED += periph_cpuid
4+
FEATURES_PROVIDED += periph_gpio
5+
FEATURES_PROVIDED += periph_i2c
6+
FEATURES_PROVIDED += periph_pwm
7+
FEATURES_PROVIDED += periph_rtc
8+
FEATURES_PROVIDED += periph_rtt
9+
FEATURES_PROVIDED += periph_spi
10+
FEATURES_PROVIDED += periph_timer
11+
FEATURES_PROVIDED += periph_uart
12+
13+
# Various other features (if any)
14+
FEATURES_PROVIDED += cpp
15+
FEATURES_PROVIDED += arduino
16+
17+
# The board MPU family (used for grouping by the CI system)
18+
FEATURES_MCU_GROUP = cortex_m0_2
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# define the cpu used by Arduino/Genuino MKR1000 board
2+
export CPU = samd21
3+
export CPU_MODEL = samd21g18a
4+
5+
#export needed for flash rule
6+
export PORT_LINUX ?= /dev/ttyACM0
7+
export PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
8+
9+
# setup serial terminal
10+
include $(RIOTMAKE)/tools/serial.inc.mk
11+
12+
# setup the flash tool used
13+
ifeq ($(PROGRAMMER),jlink)
14+
# in case J-Link is attached to SWD pins, use a plain CPU memory model
15+
export JLINK_DEVICE := ${MKR_JLINK_DEVICE}
16+
include $(RIOTMAKE)/tools/jlink.inc.mk
17+
else
18+
# on default, we use BOSSA to flash this board
19+
export LINKER_SCRIPT ?= $(RIOTCPU)/sam0_common/ldscripts/$(CPU_MODEL)_mkr.ld
20+
include $(RIOTMAKE)/tools/bossa.inc.mk
21+
endif
22+
23+
INCLUDES += -I$(RIOTBOARD)/arduino-mkr-common/include
24+
25+
# setup the boards dependencies
26+
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,20 @@
11
/*
22
* Copyright (C) 2016 Freie Universität Berlin
3-
* 2016 Inria
3+
* 2016-2017 Inria
44
*
55
* This file is subject to the terms and conditions of the GNU Lesser
66
* General Public License v2.1. See the file LICENSE in the top level
77
* directory for more details.
88
*/
99

1010
/**
11-
* @ingroup boards_arduino-mkr1000
12-
* @{
11+
* @ingroup boards_arduino-mkr-common
1312
*
1413
* @file
15-
* @brief Board specific implementations for the Arduino MKR1000 board
14+
* @brief Board common implementations for the Arduino MKR boards
1615
*
17-
* @author Hauke Pertersen <hauke.pertersen@fu-berlin.de>
16+
* @author Hauke Pertersen <hauke.pertersen@fu-berlin.de>
1817
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
19-
*
2018
* @}
2119
*/
2220

@@ -28,6 +26,6 @@ void board_init(void)
2826
{
2927
/* initialize the CPU */
3028
cpu_init();
31-
/* initialize the on-board Green "L" LED on pin PA20 */
29+
/* initialize the on-board Amber "L" LED */
3230
gpio_init(LED0_PIN, GPIO_OUT);
3331
}

boards/arduino-mkr1000/include/arduino_board.h renamed to boards/arduino-mkr-common/include/arduino_board.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (C) 2016 Freie Universität Berlin
3-
* 2016 Inria
3+
* 2016-2017 Inria
44
*
55
* This file is subject to the terms and conditions of the GNU Lesser
66
* General Public License v2.1. See the file LICENSE in the top level
@@ -27,11 +27,6 @@
2727
extern "C" {
2828
#endif
2929

30-
/**
31-
* @brief The on-board LED is connected to pin 6 on this board
32-
*/
33-
#define ARDUINO_LED (6)
34-
3530
/**
3631
* @brief Look-up table for the Arduino's digital pins
3732
*/

boards/arduino-mkr1000/include/arduino_pinmap.h renamed to boards/arduino-mkr-common/include/arduino_pinmap.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
2-
* Copyright (C) 2016 Inria
2+
* Copyright (C) 2016-2017 Inria
33
*
44
* This file is subject to the terms and conditions of the GNU Lesser
55
* General Public License v2.1. See the file LICENSE in the top level
66
* directory for more details.
77
*/
88

99
/**
10-
* @ingroup boards_arduino-mkr1000
10+
* @ingroup boards_arduino-mkr-common
1111
* @{
1212
*
1313
* @file
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (C) 2016-2017 Inria
3+
*
4+
* This file is subject to the terms and conditions of the GNU Lesser
5+
* General Public License v2.1. See the file LICENSE in the top level
6+
* directory for more details.
7+
*/
8+
9+
/**
10+
* @defgroup boards_arduino-mkr-common Arduino MKR Common
11+
* @ingroup boards
12+
* @brief Support for the Arduino MKR boards type.
13+
* @{
14+
*
15+
* @file
16+
* @brief Board specific definitions for the Arduino MKR
17+
* board
18+
*
19+
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
20+
*/
21+
22+
#ifndef BOARD_COMMON_H
23+
#define BOARD_COMMON_H
24+
25+
#include "cpu.h"
26+
#include "periph_conf.h"
27+
#include "arduino_pinmap.h"
28+
29+
#ifdef __cplusplus
30+
extern "C" {
31+
#endif
32+
33+
/**
34+
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
35+
*/
36+
void board_init(void);
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
#endif /* BOARD_COMMON_H */
43+
/** @} */

boards/arduino-mkr1000/include/gpio_params.h renamed to boards/arduino-mkr-common/include/gpio_params.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
/*
2-
* Copyright (C) 2016 Freie Universität Berlin
3-
* 2016 Inria
2+
* Copyright (C) 2016-2017 Inria
3+
* 2016 Freie Universität Berlin
44
*
55
* This file is subject to the terms and conditions of the GNU Lesser
66
* General Public License v2.1. See the file LICENSE in the top level
77
* directory for more details.
88
*/
99

1010
/**
11-
* @ingroup boards_arduino-mkr1000
11+
* @ingroup boards_arduino-mkr-common
1212
* @{
1313
*
1414
* @file
1515
* @brief Board specific configuration of direct mapped GPIOs
1616
*
17-
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
1817
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
18+
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
1919
*/
2020

2121
#ifndef GPIO_PARAMS_H

boards/arduino-mkr1000/include/periph_conf.h renamed to boards/arduino-mkr-common/include/periph_conf.h

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
/*
22
* Copyright (C) 2016 Freie Universität Berlin
3-
* 2016 Inria
3+
* 2016-2017 Inria
44
*
55
* This file is subject to the terms and conditions of the GNU Lesser
66
* General Public License v2.1. See the file LICENSE in the top level
77
* directory for more details.
88
*/
99

1010
/**
11-
* @ingroup boards_arduino-mkr1000
11+
* @ingroup boards_arduino-mkr-common
1212
* @{
1313
*
1414
* @file
15-
* @brief Configuration of CPU peripherals for Arduino MKR1000 board
15+
* @brief Configuration of CPU peripherals for Arduino MKR boards
1616
*
1717
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de>
1818
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
@@ -24,17 +24,14 @@
2424
#ifndef PERIPH_CONF_H
2525
#define PERIPH_CONF_H
2626

27-
#include <stdint.h>
28-
29-
#include "cpu.h"
3027
#include "periph_cpu.h"
3128

3229
#ifdef __cplusplus
3330
extern "C" {
3431
#endif
3532

3633
/**
37-
* @brief External oscillator and clock configuration
34+
* @name External oscillator and clock configuration
3835
*
3936
* For selection of the used CORECLOCK, we have implemented two choices:
4037
*
@@ -127,32 +124,23 @@ static const uart_conf_t uart_config[] = {
127124
* @{
128125
*/
129126
#define PWM_0_EN 1
130-
#define PWM_1_EN 1
131-
#define PWM_MAX_CHANNELS 2
127+
#define PWM_MAX_CHANNELS (2U)
132128
/* for compatibility with test application */
133129
#define PWM_0_CHANNELS PWM_MAX_CHANNELS
134-
#define PWM_1_CHANNELS PWM_MAX_CHANNELS
135130

136131
/* PWM device configuration */
137132
static const pwm_conf_t pwm_config[] = {
138133
#if PWM_0_EN
139134
{TCC0, {
140135
/* GPIO pin, MUX value, TCC channel */
141-
{ GPIO_PIN(PA, 8), GPIO_MUX_E, 0 },
142-
{ GPIO_PIN(PA, 9), GPIO_MUX_E, 1 },
143-
}},
144-
#endif
145-
#if PWM_1_EN
146-
{TCC1, {
147-
/* GPIO pin, MUX value, TCC channel */
148-
{ GPIO_PIN(PA, 6), GPIO_MUX_E, 0 },
149-
{ GPIO_PIN(PA, 7), GPIO_MUX_E, 1 },
150-
}},
136+
{ GPIO_PIN(PA, 10), GPIO_MUX_F, 2 }, /* ~2 */
137+
{ GPIO_PIN(PA, 11), GPIO_MUX_F, 3 }, /* ~3 */
138+
}}
151139
#endif
152140
};
153141

154142
/* number of devices that are actually defined */
155-
#define PWM_NUMOF (2U)
143+
#define PWM_NUMOF (sizeof(pwm_config) / sizeof(pwm_config[0]))
156144
/** @} */
157145

158146
/**
@@ -204,7 +192,7 @@ static const spi_conf_t spi_config[] = {
204192
.miso_pad = SPI_PAD_MISO_3,
205193
.mosi_pad = SPI_PAD_MOSI_0_SCK_1
206194
},
207-
{ /* SPI Pins connected to WINC1500 wifi module */
195+
{
208196
.dev = &SERCOM2->SPI,
209197
.miso_pin = GPIO_PIN(PA, 15),
210198
.mosi_pin = GPIO_PIN(PA, 12),

0 commit comments

Comments
 (0)