mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards: initial import of Adafruit Feather nRF52840 Express
This provides support initial support for the [Adafruit Feather nRF52840 Express][feather-nrf52840]. The current feature set includes: - Default flashing via Segger J-Link - UART, SPI, and I2C exposed in accordance to the Feather [pinout] - SAUL support for on-board LEDs and button [feather-nrf52840]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/ [pinout]: https://cdn-learn.adafruit.com/assets/assets/000/046/243/original/adafruit_products_Feather_M0_Adalogger_v2.2-1.png [pid.codes]: http://pid.codes/1209/7D00/
This commit is contained in:
parent
18d15b6f27
commit
78b5c1ee5c
3
boards/feather-nrf52840/Makefile
Normal file
3
boards/feather-nrf52840/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
9
boards/feather-nrf52840/Makefile.dep
Normal file
9
boards/feather-nrf52840/Makefile.dep
Normal file
@ -0,0 +1,9 @@
|
||||
# Use Segger's RTT by default for stdio on this board
|
||||
DEFAULT_MODULE += stdio_rtt
|
||||
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
12
boards/feather-nrf52840/Makefile.features
Normal file
12
boards/feather-nrf52840/Makefile.features
Normal file
@ -0,0 +1,12 @@
|
||||
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
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
10
boards/feather-nrf52840/Makefile.include
Normal file
10
boards/feather-nrf52840/Makefile.include
Normal file
@ -0,0 +1,10 @@
|
||||
# HACK: replicate dependency resolution in Makefile.dep, only works
|
||||
# if `USEMODULE` or `DEFAULT_MODULE` is set by the command line or in the
|
||||
# application Makefile.
|
||||
ifeq (,$(filter stdio_%,$(DISABLE_MODULE) $(USEMODULE)))
|
||||
RIOT_TERMINAL ?= jlink
|
||||
endif
|
||||
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.include
|
33
boards/feather-nrf52840/board.c
Normal file
33
boards/feather-nrf52840/board.c
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Freie Universität Berlin
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @author Martine Lenders <m.lenders@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
#include "board.h"
|
||||
|
||||
#include "periph/gpio.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs */
|
||||
gpio_init(LED0_PIN, GPIO_OUT);
|
||||
gpio_clear(LED0_PIN);
|
||||
gpio_init(LED1_PIN, GPIO_OUT);
|
||||
gpio_clear(LED1_PIN);
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
||||
|
||||
/** @} */
|
42
boards/feather-nrf52840/doc.txt
Normal file
42
boards/feather-nrf52840/doc.txt
Normal file
@ -0,0 +1,42 @@
|
||||
/**
|
||||
@defgroup boards_feather-nrf52840 Adafruit Feather nRF52840 Express
|
||||
@ingroup boards
|
||||
@brief Support for the Adafruit Feather nRF52840 Express
|
||||
|
||||
### General information
|
||||
|
||||
[The Feather nRF52840 Express][feather-nrf52840] is a development board
|
||||
from Adafruits Feather board family. It provides native USB support, Bluetooth
|
||||
Low Energy and IEEE 802.15.4 support via the nRF52840 MCU.
|
||||
|
||||
![top-down view on feather-nrf52840][top-down view]
|
||||
|
||||
[feather-nrf52840]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/
|
||||
[top-down view]: https://cdn-learn.adafruit.com/assets/assets/000/068/578/medium800/circuitpython_Screenshot_2019-01-02_at_12.04.27.png
|
||||
|
||||
### Flash the board
|
||||
|
||||
See the **Flashing** section in @ref boards_common_nrf52. The easiest way is to
|
||||
use an external Segger J-Link Progammer connected to the [SWD Connector].
|
||||
|
||||
[SWD Connector]: https://learn.adafruit.com/introducing-the-adafruit-nrf52840-feather/pinouts#swd-connector-3-12
|
||||
|
||||
### Terminal
|
||||
To connect a terminal to the Feather, RIOT chooses Segger RTT per default.
|
||||
This lets you use the Segger J-Link Programmer as a serial interface to the
|
||||
device.
|
||||
|
||||
You have several alternative possibilities to connect to the board.
|
||||
|
||||
1. With
|
||||
~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
||||
USEMODULE += stdio_uart
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
and an FTDI adapter connected to the Feather's RX and TX ports you can use
|
||||
UART-based terminals to connect to the feather
|
||||
2. With
|
||||
~~~~~~~~~~~~~~~~~~~~~ {.mk}
|
||||
USEMODULE += stdio_cdc_acm
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
you can access the Feather with a terminal directly over USB.
|
||||
*/
|
65
boards/feather-nrf52840/include/board.h
Normal file
65
boards/feather-nrf52840/include/board.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Freie Universität Berlin
|
||||
*
|
||||
* 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_feather-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the Adafruit Feather nRF52840
|
||||
* Express
|
||||
*
|
||||
* @author Martine S. Lenders <m.lenders@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "board_common.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LED pin configuration
|
||||
* @{
|
||||
*/
|
||||
#define LED0_PIN GPIO_PIN(1, 15)
|
||||
#define LED1_PIN GPIO_PIN(1, 10)
|
||||
|
||||
#define LED_PORT (NRF_P1)
|
||||
#define LED0_MASK (1 << 15)
|
||||
#define LED1_MASK (1 << 10)
|
||||
#define LED_MASK (LED0_MASK | LED1_MASK)
|
||||
|
||||
#define LED0_ON (LED_PORT->OUTCLR = LED0_MASK)
|
||||
#define LED0_OFF (LED_PORT->OUTSET = LED0_MASK)
|
||||
#define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK)
|
||||
|
||||
#define LED1_ON (LED_PORT->OUTCLR = LED1_MASK)
|
||||
#define LED1_OFF (LED_PORT->OUTSET = LED1_MASK)
|
||||
#define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Button pin configuration
|
||||
* @{
|
||||
*/
|
||||
#define BTN0_PIN GPIO_PIN(1, 2)
|
||||
#define BTN0_MODE GPIO_IN_PU
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
59
boards/feather-nrf52840/include/gpio_params.h
Normal file
59
boards/feather-nrf52840/include/gpio_params.h
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Freie Universität Berlin
|
||||
*
|
||||
* 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_feather-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Configuration of SAUL mapped GPIO pins
|
||||
*
|
||||
* @author Martine S. Lenders <m.lenders@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#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 = "LED Red (D3)",
|
||||
.pin = LED0_PIN,
|
||||
.mode = GPIO_OUT,
|
||||
.flags = (SAUL_GPIO_INIT_CLEAR),
|
||||
},
|
||||
{
|
||||
.name = "LED Blue (Conn)",
|
||||
.pin = LED1_PIN,
|
||||
.mode = GPIO_OUT,
|
||||
.flags = (SAUL_GPIO_INIT_CLEAR),
|
||||
},
|
||||
{
|
||||
.name = "UserSw",
|
||||
.pin = BTN0_PIN,
|
||||
.mode = BTN0_MODE,
|
||||
.flags = SAUL_GPIO_INVERTED,
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GPIO_PARAMS_H */
|
||||
/** @} */
|
88
boards/feather-nrf52840/include/periph_conf.h
Normal file
88
boards/feather-nrf52840/include/periph_conf.h
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
* Copyright (C) 2020 Freie Universität Berlin
|
||||
*
|
||||
* 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_feather-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral configuration for the Adafruit Feather nRF52840
|
||||
* Express
|
||||
*
|
||||
* @author Martine S. Lenders <m.lenders@fu-berlin.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#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(0,24),
|
||||
.tx_pin = GPIO_PIN(0,25),
|
||||
.rts_pin = (uint8_t)GPIO_UNDEF,
|
||||
.cts_pin = (uint8_t)GPIO_UNDEF,
|
||||
.irqn = UARTE0_UART0_IRQn,
|
||||
},
|
||||
};
|
||||
|
||||
#define UART_0_ISR (isr_uart0)
|
||||
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
static const spi_conf_t spi_config[] = {
|
||||
{
|
||||
.dev = NRF_SPI0,
|
||||
.sclk = 14,
|
||||
.mosi = 13,
|
||||
.miso = 15
|
||||
}
|
||||
};
|
||||
|
||||
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name I2C configuration
|
||||
* @{
|
||||
*/
|
||||
static const i2c_conf_t i2c_config[] = {
|
||||
{
|
||||
.dev = NRF_TWIM1,
|
||||
.scl = 11,
|
||||
.sda = 12,
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
}
|
||||
};
|
||||
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
Loading…
Reference in New Issue
Block a user