-
Notifications
You must be signed in to change notification settings - Fork 2.1k
board/arduino-nano-33-ble: add initial support #13194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fjmolinas
merged 4 commits into
RIOT-OS:master
from
aabadie:pr/board/arduino-nano-33-ble
Apr 8, 2020
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
6d38a23
boards/arduino-nano-33-ble: initial support
aabadie 1aa6ce9
dist/tools: add bossa version for nrf52
aabadie 1f9ff9e
makefiles/bossa: only use ROM_OFFSET with version 1.9
aabadie 239e080
examples/default: add arduino-nano-33-ble to netif list
aabadie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| MODULE = board | ||
|
|
||
| include $(RIOTBASE)/Makefile.base |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| ifneq (,$(filter saul_default,$(USEMODULE))) | ||
| USEMODULE += saul_gpio | ||
| endif | ||
|
|
||
| # use arduino-bootloader only if no other stdio_% other than stdio_cdc_acm | ||
| # is requested | ||
| ifeq (,$(filter-out stdio_cdc_acm,$(filter stdio_% slipdev_stdio,$(USEMODULE)))) | ||
| # Provide stdio over USB by default | ||
| USEMODULE += stdio_cdc_acm | ||
|
|
||
| # This board requires support for Arduino bootloader. | ||
| FEATURES_REQUIRED += bootloader_arduino | ||
| USEMODULE += usb_board_reset | ||
| endif | ||
|
|
||
| # include common nrf52 dependencies | ||
| include $(RIOTBOARD)/common/nrf52/Makefile.dep |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| CPU_MODEL = nrf52840xxaa | ||
|
|
||
| # Put defined MCU peripherals here (in alphabetical order) | ||
| FEATURES_PROVIDED += periph_i2c | ||
| FEATURES_PROVIDED += periph_spi | ||
| FEATURES_PROVIDED += periph_uart | ||
| FEATURES_PROVIDED += periph_usbdev | ||
|
|
||
| # Various other features (if any) | ||
| FEATURES_PROVIDED += radio_nrf802154 | ||
| FEATURES_PROVIDED += bootloader_arduino | ||
|
|
||
| include $(RIOTBOARD)/common/nrf52/Makefile.features |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Bossa is the default programmer | ||
| PROGRAMMER ?= bossa | ||
|
|
||
| ifeq ($(PROGRAMMER),bossa) | ||
| # The preinstalled Arduino bootloader must also be taken into account so | ||
| # ROM_OFFSET skips the space taken by such bootloader. | ||
| ROM_OFFSET ?= 0x10000 | ||
|
|
||
| # This board requires a BOSSA version from arduino's fork and adapted to | ||
| # nrf52. | ||
| BOSSA_VERSION = nrf52 | ||
| BOSSA_ARDUINO_PREFLASH = yes | ||
| PREFLASH_DELAY = 1 | ||
|
|
||
| ifneq (,$(filter reset flash flash-only, $(MAKECMDGOALS))) | ||
| # Add 2 seconds delay before opening terminal: this is required when opening | ||
| # the terminal right after flashing. In this case, the stdio over USB needs | ||
| # some time after reset before being ready. | ||
| TERM_DELAY = 2 | ||
| TERMDEPS += term-delay | ||
| endif | ||
|
|
||
| include $(RIOTMAKE)/tools/bossa.inc.mk | ||
| endif | ||
|
|
||
| term-delay: | ||
| sleep $(TERM_DELAY) | ||
|
|
||
| TESTRUNNER_CONNECT_DELAY ?= 2 | ||
| $(call target-export-variables,test,TESTRUNNER_CONNECT_DELAY) | ||
|
|
||
| include $(RIOTBOARD)/common/nrf52/Makefile.include |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright (C) 2020 Inria | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_arduino-nano-33-ble | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Board initialization for the Arduino Nano 33 BLE | ||
| * | ||
| * @author Alexandre Abadie <alexandre.abadie@inria.fr> | ||
| * | ||
| * @} | ||
| */ | ||
|
|
||
| #include "cpu.h" | ||
| #include "board.h" | ||
|
|
||
| #include "periph/gpio.h" | ||
|
|
||
| void board_init(void) | ||
| { | ||
| /* initialize the CPU */ | ||
| cpu_init(); | ||
|
|
||
| /* initialize the boards LEDs */ | ||
| gpio_init(LED0_PIN, GPIO_OUT); /* Orange LED */ | ||
| gpio_init(LED1_PIN, GPIO_OUT); /* Red LED */ | ||
| gpio_set(LED1_PIN); | ||
| gpio_init(LED2_PIN, GPIO_OUT); /* Green LED */ | ||
| gpio_set(LED2_PIN); | ||
| gpio_init(LED3_PIN, GPIO_OUT); /* Blue LED */ | ||
| gpio_set(LED3_PIN); | ||
| gpio_init(LED4_PIN, GPIO_OUT); /* PWR LED */ | ||
| gpio_clear(LED4_PIN); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| /** | ||
| @defgroup boards_arduino-nano-33-ble Arduino Nano 33 BLE | ||
| @ingroup boards | ||
| @brief Support for the Arduino Nano 33 BLE | ||
|
|
||
| ### General information | ||
|
|
||
| The [Arduino Nano 33 BLE](https://store.arduino.cc/arduino-nano-33-ble) board | ||
| is an opensource, micro development kit using the nRF52840 SoC. | ||
| This board provides 802.15.4 and BLE connectivity. | ||
|
|
||
| ### Pinout | ||
|
|
||
| <img src="https://content.arduino.cc/assets/Pinout-NANOble_latest.png" | ||
| alt="pinout" style="height:800px;"/> | ||
|
|
||
| ### Flash the board | ||
|
|
||
| Use `BOARD=arduino-nano-33-ble` with the `make` command.<br/> | ||
| Example with `hello-world` application: | ||
| ``` | ||
| make BOARD=arduino-nano-33-ble -C examples/hello-world flash | ||
| ``` | ||
|
|
||
| ### Accessing STDIO via UART | ||
|
|
||
| The STDIO is directly accessible via the USB port. On a Linux host, it's | ||
| generally mapped to `/dev/ttyACM0`. | ||
|
|
||
| Use the `term` target to connect to the board serial port<br/> | ||
| ``` | ||
| make BOARD=arduino-nano-33-ble -C examples/hello-world term | ||
| ``` | ||
| */ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright (C) 2020 Inria | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_arduino-nano-33-ble | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Board specific configuration for the Arduino Nano 33 BLE | ||
| * | ||
| * @author Alexandre Abadie <alexandre.abadie@inria.fr> | ||
| */ | ||
|
|
||
| #ifndef BOARD_H | ||
| #define BOARD_H | ||
|
|
||
| #include "cpu.h" | ||
| #include "board_common.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| /** | ||
| * @name LEDs pin configuration | ||
| * @{ | ||
| */ | ||
| #define LED0_PIN GPIO_PIN(0, 13) | ||
| #define LED0_MASK (1 << 13) | ||
| #define LED0_ON (NRF_P0->OUTCLR = LED0_MASK) | ||
| #define LED0_OFF (NRF_P0->OUTSET = LED0_MASK) | ||
| #define LED0_TOGGLE (NRF_P0->OUT ^= LED0_MASK) | ||
|
|
||
| #define LED1_PIN GPIO_PIN(0, 24) | ||
| #define LED1_MASK (1 << 24) | ||
| #define LED1_ON (NRF_P0->OUTCLR = LED1_MASK) | ||
| #define LED1_OFF (NRF_P0->OUTSET = LED1_MASK) | ||
| #define LED1_TOGGLE (NRF_P0->OUT ^= LED1_MASK) | ||
|
|
||
| #define LED2_PIN GPIO_PIN(0, 16) | ||
| #define LED2_MASK (1 << 16) | ||
| #define LED2_ON (NRF_P0->OUTCLR = LED2_MASK) | ||
| #define LED2_OFF (NRF_P0->OUTSET = LED2_MASK) | ||
| #define LED2_TOGGLE (NRF_P0->OUT ^= LED2_MASK) | ||
|
|
||
| #define LED3_PIN GPIO_PIN(0, 6) | ||
| #define LED3_MASK (1 << 6) | ||
| #define LED3_ON (NRF_P0->OUTCLR = LED3_MASK) | ||
| #define LED3_OFF (NRF_P0->OUTSET = LED3_MASK) | ||
| #define LED3_TOGGLE (NRF_P0->OUT ^= LED3_MASK) | ||
|
|
||
| #define LED4_PIN GPIO_PIN(1, 9) | ||
| #define LED4_MASK (1 << 9) | ||
| #define LED4_ON (NRF_P1->OUTCLR = LED4_MASK) | ||
| #define LED4_OFF (NRF_P1->OUTSET = LED4_MASK) | ||
| #define LED4_TOGGLE (NRF_P1->OUT ^= LED4_MASK) | ||
| /** @} */ | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* BOARD_H */ | ||
| /** @} */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| /* | ||
| * Copyright (C) 2020 Inria | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_arduino-nano-33-ble | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Configuration of SAUL mapped GPIO pins | ||
| * | ||
| * @author Alexandre Abadie <alexandre.abadie@inria.fr> | ||
| */ | ||
|
|
||
| #ifndef GPIO_PARAMS_H | ||
| #define GPIO_PARAMS_H | ||
|
|
||
| #include "board.h" | ||
| #include "saul/periph.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| /** | ||
| * @brief LED configuration | ||
| */ | ||
| static const saul_gpio_params_t saul_gpio_params[] = | ||
| { | ||
| { | ||
| .name = "LED0 (Orange)", | ||
| .pin = LED0_PIN, | ||
| .mode = GPIO_OUT, | ||
| }, | ||
| { | ||
| .name = "LED1 (RED)", | ||
| .pin = LED1_PIN, | ||
| .mode = GPIO_OUT, | ||
| .flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR), | ||
| }, | ||
| { | ||
| .name = "LED2 (GREEN)", | ||
| .pin = LED2_PIN, | ||
| .mode = GPIO_OUT, | ||
| .flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR), | ||
| }, | ||
| { | ||
| .name = "LED3 (BLUE)", | ||
| .pin = LED3_PIN, | ||
| .mode = GPIO_OUT, | ||
| .flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR), | ||
| }, | ||
| { | ||
| .name = "LED4 (PWR)", | ||
| .pin = LED4_PIN, | ||
| .mode = GPIO_OUT, | ||
| }, | ||
| }; | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* GPIO_PARAMS_H */ | ||
| /** @} */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| /* | ||
| * Copyright (C) 2020 Inria | ||
| * | ||
| * This file is subject to the terms and conditions of the GNU Lesser | ||
| * General Public License v2.1. See the file LICENSE in the top level | ||
| * directory for more details. | ||
| */ | ||
|
|
||
| /** | ||
| * @ingroup boards_arduino-nano-33-ble | ||
| * @{ | ||
| * | ||
| * @file | ||
| * @brief Peripheral configuration for the Arduino Nano 33 BLE | ||
| * | ||
| * @author Alexandre Abadie <alexandre.abadie@inria.fr> | ||
| * | ||
| */ | ||
|
|
||
| #ifndef PERIPH_CONF_H | ||
| #define PERIPH_CONF_H | ||
|
|
||
| #include "periph_cpu.h" | ||
| #include "cfg_clock_32_1.h" | ||
| #include "cfg_rtt_default.h" | ||
| #include "cfg_timer_default.h" | ||
|
|
||
| #ifdef __cplusplus | ||
| extern "C" { | ||
| #endif | ||
|
|
||
| /** | ||
| * @name UART configuration | ||
| * @{ | ||
| */ | ||
| static const uart_conf_t uart_config[] = { | ||
| { | ||
| .dev = NRF_UARTE0, | ||
| .rx_pin = GPIO_PIN(1, 10), | ||
| .tx_pin = GPIO_PIN(1, 3), | ||
| #ifdef MODULE_PERIPH_UART_HW_FC | ||
| .rts_pin = GPIO_UNDEF, | ||
| .cts_pin = GPIO_UNDEF, | ||
| #endif | ||
| .irqn = UARTE0_UART0_IRQn, | ||
| }, | ||
| }; | ||
|
|
||
| #define UART_0_ISR (isr_uart0) | ||
|
|
||
| #define UART_NUMOF ARRAY_SIZE(uart_config) | ||
| /** @} */ | ||
|
|
||
| /** | ||
| * @name I2C configuration | ||
| * @{ | ||
| */ | ||
| static const i2c_conf_t i2c_config[] = { | ||
| { | ||
| .dev = NRF_TWIM0, | ||
| .scl = GPIO_PIN(0, 2), | ||
| .sda = GPIO_PIN(0, 31), | ||
| .speed = I2C_SPEED_NORMAL | ||
| }, | ||
| }; | ||
|
|
||
| #define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0])) | ||
| /** @} */ | ||
|
|
||
| /** | ||
| * @name SPI configuration | ||
| * @{ | ||
| */ | ||
| static const spi_conf_t spi_config[] = { | ||
| { | ||
| .dev = NRF_SPI0, | ||
| .sclk = GPIO_PIN(0, 13), | ||
| .mosi = GPIO_PIN(1, 1), | ||
| .miso = GPIO_PIN(1, 8), | ||
| } | ||
| }; | ||
|
|
||
| #define SPI_NUMOF ARRAY_SIZE(spi_config) | ||
| /** @} */ | ||
|
|
||
| #ifdef __cplusplus | ||
| } | ||
| #endif | ||
|
|
||
| #endif /* PERIPH_CONF_H */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.