mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards: add initial support for microbit v2
This commit is contained in:
parent
d7f3e92c30
commit
13ca17ff24
46
boards/common/nrf52/include/cfg_clock_32_0.h
Normal file
46
boards/common/nrf52/include/cfg_clock_32_0.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_common_nrf52
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Common clock configuration for the nRF52 based boards
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef CFG_CLOCK_32_0_H
|
||||
#define CFG_CLOCK_32_0_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Clock configuration
|
||||
*
|
||||
* @note The radio will not work with the internal RC oscillator!
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_HFCLK (32U) /* set to 0: internal RC oscillator
|
||||
* 32: 32MHz crystal */
|
||||
#define CLOCK_LFCLK (0) /* set to 0: internal RC oscillator
|
||||
* 1: 32.768 kHz crystal
|
||||
* 2: derived from HFCLK */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CFG_CLOCK_32_0_H */
|
||||
/** @} */
|
20
boards/microbit-v2/Kconfig
Normal file
20
boards/microbit-v2/Kconfig
Normal file
@ -0,0 +1,20 @@
|
||||
# Copyright (c) 2021 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.
|
||||
|
||||
config BOARD
|
||||
default "microbit-v2" if BOARD_MICROBIT_V2
|
||||
|
||||
config BOARD_MICROBIT_V2
|
||||
bool
|
||||
default y
|
||||
select BOARD_COMMON_NRF52
|
||||
select CPU_MODEL_NRF52833XXAA
|
||||
select HAS_PERIPH_I2C
|
||||
select HAS_PERIPH_PWM
|
||||
select HAS_PERIPH_SPI
|
||||
select HAS_PERIPH_UART
|
||||
|
||||
source "$(RIOTBOARD)/common/nrf52/Kconfig"
|
3
boards/microbit-v2/Makefile
Normal file
3
boards/microbit-v2/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
5
boards/microbit-v2/Makefile.dep
Normal file
5
boards/microbit-v2/Makefile.dep
Normal file
@ -0,0 +1,5 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
10
boards/microbit-v2/Makefile.features
Normal file
10
boards/microbit-v2/Makefile.features
Normal file
@ -0,0 +1,10 @@
|
||||
CPU_MODEL = nrf52833xxaa
|
||||
|
||||
# Put defined MCU peripherals here (in alphabetical order)
|
||||
FEATURES_PROVIDED += periph_i2c
|
||||
FEATURES_PROVIDED += periph_pwm
|
||||
FEATURES_PROVIDED += periph_spi
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
|
||||
# include common nrf52 based boards features
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
6
boards/microbit-v2/Makefile.include
Normal file
6
boards/microbit-v2/Makefile.include
Normal file
@ -0,0 +1,6 @@
|
||||
# for this board we support flashing via openocd
|
||||
PROGRAMMER ?= openocd
|
||||
DEBUG_ADAPTER = dap
|
||||
|
||||
# include nrf52 boards common configuration
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.include
|
32
boards/microbit-v2/board.c
Normal file
32
boards/microbit-v2/board.c
Normal file
@ -0,0 +1,32 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_microbit_v2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board initialization code for the BBC micro:bit v2
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
||||
/* initialize the on board buttons */
|
||||
gpio_init(BTN0_PIN, GPIO_IN);
|
||||
gpio_init(BTN1_PIN, GPIO_IN);
|
||||
}
|
35
boards/microbit-v2/doc.txt
Normal file
35
boards/microbit-v2/doc.txt
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
@defgroup boards_microbit_v2 BBC micro:bit v2
|
||||
@ingroup boards
|
||||
@brief Support for the BBC micro:bit v2
|
||||
|
||||
## Overview
|
||||
|
||||
The [micro:bit v2](https://www.microbit.co.uk/) was designed by the BBC and
|
||||
released in 2020.
|
||||
|
||||
The board is based on the Nordic nRF52833 SoC, featuring 128KiB of RAM, 512KiB
|
||||
of ROM, and a 2.4GHz radio, that supports Bluetooth Low Energy (BLE), 802.15.4
|
||||
as well as a Nordic proprietary radio mode.
|
||||
|
||||
Additionally the boards features 2 buttons, a 5x5 LED matrix, a speaker, a
|
||||
microphone, an accelerometer and a magnetometer.
|
||||
|
||||
## Flashing and Debugging
|
||||
|
||||
The board can be flashed using OpenOCD. Debugger is also available with OpenOCD.
|
||||
|
||||
```
|
||||
BOARD=microbit make flash
|
||||
```
|
||||
|
||||
## STDIO
|
||||
|
||||
The programmer chip provides access to STDIO via USB. On Linux, stdio is
|
||||
usually available on /dev/ttyACM0. Use the `term` target to access stdio:
|
||||
|
||||
```
|
||||
BOARD=microbit make term
|
||||
```
|
||||
|
||||
*/
|
82
boards/microbit-v2/include/board.h
Normal file
82
boards/microbit-v2/include/board.h
Normal file
@ -0,0 +1,82 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_microbit_v2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the BBC micro:bit v2
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "board_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LED matrix pin configuration
|
||||
* @{
|
||||
*/
|
||||
#define MICROBIT_LED_COL1 GPIO_PIN(0, 28)
|
||||
#define MICROBIT_LED_COL2 GPIO_PIN(0, 11)
|
||||
#define MICROBIT_LED_COL3 GPIO_PIN(0, 31)
|
||||
#define MICROBIT_LED_COL4 GPIO_PIN(1, 5)
|
||||
#define MICROBIT_LED_COL5 GPIO_PIN(0, 30)
|
||||
#define MICROBIT_LED_ROW1 GPIO_PIN(0, 21)
|
||||
#define MICROBIT_LED_ROW2 GPIO_PIN(0, 22)
|
||||
#define MICROBIT_LED_ROW3 GPIO_PIN(0, 15)
|
||||
#define MICROBIT_LED_ROW4 GPIO_PIN(0, 24)
|
||||
#define MICROBIT_LED_ROW5 GPIO_PIN(0, 19)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Button configuration
|
||||
* @{
|
||||
*/
|
||||
#define BTN0_PIN GPIO_PIN(0, 14)
|
||||
#define BTN0_MODE GPIO_IN
|
||||
#define BTN1_PIN GPIO_PIN(0, 23)
|
||||
#define BTN1_MODE GPIO_IN
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Microphone
|
||||
* @{
|
||||
*/
|
||||
#define RUN_MIC_PIN GPIO_PIN(0, 20)
|
||||
#define MIC_IN_PIN GPIO_PIN(0, 5)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Speaker
|
||||
* @{
|
||||
*/
|
||||
#define SPEAKER_PIN GPIO_PIN(0, 0)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LSM303AGR accelerometer/magnetometer
|
||||
* @{
|
||||
*/
|
||||
#define LSM303AGR_PARAM_ACC_ADDR 0x19
|
||||
#define LSM303AGR_PARAM_MAG_ADDR 0x1E
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
53
boards/microbit-v2/include/gpio_params.h
Normal file
53
boards/microbit-v2/include/gpio_params.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_microbit_v2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration of direct mapped GPIOs
|
||||
*
|
||||
* @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 GPIO pin configuration
|
||||
*/
|
||||
static const saul_gpio_params_t saul_gpio_params[] =
|
||||
{
|
||||
{
|
||||
.name = "Button A",
|
||||
.pin = BTN0_PIN,
|
||||
.mode = BTN0_MODE,
|
||||
.flags = SAUL_GPIO_INVERTED,
|
||||
},
|
||||
{
|
||||
.name = "Button B",
|
||||
.pin = BTN1_PIN,
|
||||
.mode = BTN1_MODE,
|
||||
.flags = SAUL_GPIO_INVERTED,
|
||||
},
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GPIO_PARAMS_H */
|
||||
/** @} */
|
122
boards/microbit-v2/include/periph_conf.h
Normal file
122
boards/microbit-v2/include/periph_conf.h
Normal file
@ -0,0 +1,122 @@
|
||||
/*
|
||||
* Copyright (C) 2021 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_microbit_v2
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral configuration for the BBC micro:bit v2
|
||||
*
|
||||
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
|
||||
#include "board.h"
|
||||
#include "periph_cpu.h"
|
||||
#include "cfg_clock_32_0.h"
|
||||
#include "cfg_timer_default.h"
|
||||
#include "cfg_rtt_default.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Enable the internal DC/DC converter
|
||||
*/
|
||||
#define NRF5X_ENABLE_DCDC
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
static const uart_conf_t uart_config[] = {
|
||||
{ /* Mapped to USB virtual COM port */
|
||||
.dev = NRF_UARTE0,
|
||||
.rx_pin = GPIO_PIN(1, 8),
|
||||
.tx_pin = GPIO_PIN(0, 6),
|
||||
#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 PWM configuration
|
||||
* @{
|
||||
*/
|
||||
static const pwm_conf_t pwm_config[] = {
|
||||
{
|
||||
NRF_PWM0,
|
||||
{
|
||||
SPEAKER_PIN, /* configure Speaker pin as PWM */
|
||||
GPIO_UNDEF,
|
||||
GPIO_UNDEF,
|
||||
GPIO_UNDEF,
|
||||
}
|
||||
},
|
||||
};
|
||||
#define PWM_NUMOF ARRAY_SIZE(pwm_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name I2C configuration
|
||||
* @{
|
||||
*/
|
||||
static const i2c_conf_t i2c_config[] = {
|
||||
{ /* Internal I2C */
|
||||
.dev = NRF_TWIM1,
|
||||
.scl = GPIO_PIN(0, 8),
|
||||
.sda = GPIO_PIN(0, 16),
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
},
|
||||
{ /* External I2C */
|
||||
.dev = NRF_TWIM0,
|
||||
.scl = GPIO_PIN(0, 26), /* P19 */
|
||||
.sda = GPIO_PIN(1, 0), /* P20 */
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
},
|
||||
};
|
||||
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
static const spi_conf_t spi_config[] = {
|
||||
{
|
||||
.dev = NRF_SPIM0,
|
||||
.sclk = GPIO_PIN(0, 17), /* P13 */
|
||||
.mosi = GPIO_PIN(0, 13), /* P15 */
|
||||
.miso = GPIO_PIN(0, 1), /* P14 */
|
||||
#ifdef ERRATA_SPI_SINGLE_BYTE_WORKAROUND
|
||||
.ppi = 0,
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
||||
/** @} */
|
Loading…
Reference in New Issue
Block a user