mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-25 14:33:52 +01:00
Merge pull request #21332 from crasbe/pr/xiao-nrf52-sense
boards/seeedstudio-xiao-nrf52840-sense: Add Initial Support
This commit is contained in:
commit
0afe99ce29
@ -6,5 +6,8 @@ DIRS += $(RIOTBOARD)/common/init
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
DIRS += $(RIOTBOARD)/common/adafruit-nrf52-bootloader
|
||||
endif
|
||||
ifneq (,$(filter boards_common_seeedstudio-xiao-nrf52840,$(USEMODULE)))
|
||||
DIRS += $(RIOTBOARD)/common/seeedstudio-xiao-nrf52840
|
||||
endif
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
|
||||
@ -2,3 +2,6 @@
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.dep
|
||||
endif
|
||||
ifneq (,$(filter boards_common_seeedstudio-xiao-nrf52840,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/seeedstudio-xiao-nrf52840/Makefile.dep
|
||||
endif
|
||||
|
||||
@ -1 +1,4 @@
|
||||
# SORT THIS ALPHABETICALLY BY COMMON BOARD NAME!
|
||||
ifneq (,$(filter boards_common_seeedstudio-xiao-nrf52840,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/seeedstudio-xiao-nrf52840/Makefile.features
|
||||
endif
|
||||
|
||||
@ -2,3 +2,6 @@
|
||||
ifneq (,$(filter boards_common_adafruit-nrf52-bootloader,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/adafruit-nrf52-bootloader/Makefile.include
|
||||
endif
|
||||
ifneq (,$(filter boards_common_seeedstudio-xiao-nrf52840,$(USEMODULE)))
|
||||
include $(RIOTBOARD)/common/seeedstudio-xiao-nrf52840/Makefile.include
|
||||
endif
|
||||
|
||||
3
boards/common/seeedstudio-xiao-nrf52840/Makefile
Normal file
3
boards/common/seeedstudio-xiao-nrf52840/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = boards_common_seeedstudio-xiao-nrf52840
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
18
boards/common/seeedstudio-xiao-nrf52840/Makefile.dep
Normal file
18
boards/common/seeedstudio-xiao-nrf52840/Makefile.dep
Normal file
@ -0,0 +1,18 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
ifneq (,$(filter mtd,$(USEMODULE)))
|
||||
USEMODULE += mtd_spi_nor
|
||||
endif
|
||||
|
||||
# default to using littlefs2 on the external flash
|
||||
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||
USEPKG += littlefs2
|
||||
USEMODULE += mtd
|
||||
endif
|
||||
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||
14
boards/common/seeedstudio-xiao-nrf52840/Makefile.features
Normal file
14
boards/common/seeedstudio-xiao-nrf52840/Makefile.features
Normal file
@ -0,0 +1,14 @@
|
||||
# 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 += arduino_analog
|
||||
FEATURES_PROVIDED += arduino_i2c
|
||||
FEATURES_PROVIDED += arduino_pins
|
||||
FEATURES_PROVIDED += arduino_spi
|
||||
FEATURES_PROVIDED += arduino_uart
|
||||
FEATURES_PROVIDED += highlevel_stdio
|
||||
FEATURES_PROVIDED += xiao_shield
|
||||
2
boards/common/seeedstudio-xiao-nrf52840/Makefile.include
Normal file
2
boards/common/seeedstudio-xiao-nrf52840/Makefile.include
Normal file
@ -0,0 +1,2 @@
|
||||
# add the common header files to the include path
|
||||
INCLUDES += -I$(RIOTBOARD)/common/seeedstudio-xiao-nrf52840/include
|
||||
132
boards/common/seeedstudio-xiao-nrf52840/include/arduino_iomap.h
Normal file
132
boards/common/seeedstudio-xiao-nrf52840/include/arduino_iomap.h
Normal file
@ -0,0 +1,132 @@
|
||||
/*
|
||||
* Copyright (C) 2024 TU Dresden
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ARDUINO_IOMAP_H
|
||||
#define ARDUINO_IOMAP_H
|
||||
/**
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Mapping from MCU pins to Arduino pins
|
||||
*
|
||||
* You can use the defines in this file for simplified interaction with the
|
||||
* Arduino specific pin numbers.
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*/
|
||||
|
||||
#include "periph/gpio.h"
|
||||
#include "periph/adc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name XIAO's UART devices
|
||||
* @{
|
||||
* @brief Arduino's Serial uses USB-CDC-ACM stdio by default
|
||||
*/
|
||||
#define ARDUINO_UART_DEV UART_UNDEF /**< The Xiao nRF52840 uses USB-CDC-ACM by default */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's SPI buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_SPI_DEV SPI_DEV(0) /**< Standard SPI bus for general purpose use */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's I2C buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_I2C_DEV I2C_DEV(0) /**< Standard I2C bus for general purpose use */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's on-board LED (LED_BUILTIN)
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_LED (11) /**< Use the Red LED */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of MCU pins to Arduino pins
|
||||
* @{
|
||||
*/
|
||||
/* Left pins */
|
||||
#define ARDUINO_PIN_0 GPIO_PIN(0, 2) /**< Pin Definition for D0 */
|
||||
#define ARDUINO_PIN_1 GPIO_PIN(0, 3) /**< Pin Definition for D1 */
|
||||
#define ARDUINO_PIN_2 GPIO_PIN(0, 28) /**< Pin Definition for D2 */
|
||||
#define ARDUINO_PIN_3 GPIO_PIN(0, 29) /**< Pin Definition for D3 */
|
||||
#define ARDUINO_PIN_4 GPIO_PIN(0, 4) /**< Pin Definition for D4 */
|
||||
#define ARDUINO_PIN_5 GPIO_PIN(0, 5) /**< Pin Definition for D5 */
|
||||
#define ARDUINO_PIN_6 GPIO_PIN(1, 11) /**< Pin Definition for D6 */
|
||||
|
||||
/* Right side */
|
||||
#define ARDUINO_PIN_7 GPIO_PIN(1, 12) /**< Pin Definition for D7 */
|
||||
#define ARDUINO_PIN_8 GPIO_PIN(1, 13) /**< Pin Definition for D8 */
|
||||
#define ARDUINO_PIN_9 GPIO_PIN(1, 14) /**< Pin Definition for D9 */
|
||||
#define ARDUINO_PIN_10 GPIO_PIN(1, 15) /**< Pin Definition for D10 */
|
||||
|
||||
/* Internal (LEDs) */
|
||||
#define ARDUINO_PIN_11 GPIO_PIN(0, 26) /**< Pin Definition for Red LED */
|
||||
#define ARDUINO_PIN_12 GPIO_PIN(0, 6) /**< Pin Definition for Blue LED */
|
||||
#define ARDUINO_PIN_13 GPIO_PIN(0, 30) /**< Pin Definition for Green LED */
|
||||
|
||||
#define ARDUINO_PIN_LAST 13 /**< Last Arduino Pin */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Aliases for analog pins
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_PIN_A0 ARDUINO_PIN_0 /**< Pin Definition for A0 */
|
||||
#define ARDUINO_PIN_A1 ARDUINO_PIN_1 /**< Pin Definition for A1 */
|
||||
#define ARDUINO_PIN_A2 ARDUINO_PIN_2 /**< Pin Definition for A2 */
|
||||
#define ARDUINO_PIN_A3 ARDUINO_PIN_3 /**< Pin Definition for A3 */
|
||||
#define ARDUINO_PIN_A4 ARDUINO_PIN_4 /**< Pin Definition for A4 */
|
||||
#define ARDUINO_PIN_A5 ARDUINO_PIN_5 /**< Pin Definition for A5 */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of Arduino analog pins to RIOT ADC lines
|
||||
* @{
|
||||
*/
|
||||
/* The Seeed Studio XIAO nRF52840 has a fixed ADC to GPIO mapping:
|
||||
*
|
||||
* nRF | MCU pin | Exposed as Arduino pin
|
||||
* -----|-----------|-----------------------
|
||||
* AIN0 | P0.02 | A0 (D0)
|
||||
* AIN1 | P0.03 | A1 (D1)
|
||||
* AIN2 | P0.04 | A4 (D4)
|
||||
* AIN3 | P0.05 | A5 (D5)
|
||||
* AIN4 | P0.28 | A2 (D2)
|
||||
* AIN5 | P0.29 | A3 (D3)
|
||||
* AIN6 | P0.30 | - (D13)
|
||||
* AIN7 | P0.31 | - (-)
|
||||
*/
|
||||
#define ARDUINO_A0 ADC_LINE(0) /**< ADC Channel 0 for A0 */
|
||||
#define ARDUINO_A1 ADC_LINE(1) /**< ADC Channel 1 for A1 */
|
||||
#define ARDUINO_A2 ADC_LINE(4) /**< ADC Channel 4 for A2 */
|
||||
#define ARDUINO_A3 ADC_LINE(5) /**< ADC Channel 5 for A3 */
|
||||
#define ARDUINO_A4 ADC_LINE(2) /**< ADC Channel 2 for A4 */
|
||||
#define ARDUINO_A5 ADC_LINE(3) /**< ADC Channel 3 for A5 */
|
||||
|
||||
#define ARDUINO_ANALOG_PIN_LAST 5 /**< Last Analog Input Pin */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif /* ARDUINO_IOMAP_H */
|
||||
115
boards/common/seeedstudio-xiao-nrf52840/include/board.h
Normal file
115
boards/common/seeedstudio-xiao-nrf52840/include/board.h
Normal file
@ -0,0 +1,115 @@
|
||||
/*
|
||||
* Copyright (C) 2024 TU Dresden
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
/**
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the Seeed Studio XIAO nRF52840
|
||||
* and Seeed Studio XIAO nRF52840 Sense
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
#include "board_common.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name LED pin configuration
|
||||
* @brief The Seeedstudio Xiao nRF52840 boards have an RGB LED next to the
|
||||
* USB-C connector.
|
||||
* @{
|
||||
*/
|
||||
#define LED0_PIN GPIO_PIN(0, 26) /**< Pin Definition for the Red LED */
|
||||
#define LED1_PIN GPIO_PIN(0, 30) /**< Pin Definition for the Green LED */
|
||||
#define LED2_PIN GPIO_PIN(0, 6) /**< Pin Definition for the Blue LED */
|
||||
|
||||
#define LED_PORT (NRF_P0) /**< GPIO Port of the LED GPIOs */
|
||||
#define LED0_MASK (1 << 26) /**< Bit position of the Red LED GPIO Output Bit */
|
||||
#define LED1_MASK (1 << 30) /**< Bit position of the Green LED GPIO Output Bit */
|
||||
#define LED2_MASK (1 << 6) /**< Bit position of the Blue LED GPIO Output Bit */
|
||||
#define LED_MASK (LED0_MASK | LED1_MASK | LED2_MASK) /**< Bit position of all LED
|
||||
GPIO Output Bits */
|
||||
|
||||
#define LED0_ON (LED_PORT->OUTCLR = LED0_MASK) /**< Turn the Red LED on */
|
||||
#define LED0_OFF (LED_PORT->OUTSET = LED0_MASK) /**< Turn the Red LED off */
|
||||
#define LED0_TOGGLE (LED_PORT->OUT ^= LED0_MASK) /**< Toggle the Red LED */
|
||||
|
||||
#define LED1_ON (LED_PORT->OUTCLR = LED1_MASK) /**< Turn the Green LED on */
|
||||
#define LED1_OFF (LED_PORT->OUTSET = LED1_MASK) /**< Turn the Green LED off */
|
||||
#define LED1_TOGGLE (LED_PORT->OUT ^= LED1_MASK) /**< Toggle the Green LED */
|
||||
|
||||
#define LED2_ON (LED_PORT->OUTCLR = LED2_MASK) /**< Turn the Blue LED on */
|
||||
#define LED2_OFF (LED_PORT->OUTSET = LED2_MASK) /**< Turn the Blue LED off */
|
||||
#define LED2_TOGGLE (LED_PORT->OUT ^= LED2_MASK) /**< Toggle the Blue LED */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI NOR flash hardware configuration
|
||||
*
|
||||
* A 2MB P25Q16H flash is present on the board.
|
||||
*
|
||||
* @see https://files.seeedstudio.com/wiki/github_weiruanexample/Flash_P25Q16H-UXH-IR_Datasheet.pdf
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define XIAO_NRF52840_NOR_PAGE_SIZE (256) /**< Page Size of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_PAGES_PER_SECTOR (16) /**< Page Count per Sector of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SECTOR_COUNT (512) /**< Sector Count of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_FLAGS \
|
||||
(SPI_NOR_F_SECT_4K | \
|
||||
SPI_NOR_F_SECT_32K | \
|
||||
SPI_NOR_F_SECT_64K) /**< Supported Modes of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SPI_DEV SPI_DEV(1) /**< SPI Bus of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SPI_CLK SPI_CLK_10MHZ /**< SPI Clock Frequency */
|
||||
#define XIAO_NRF52840_NOR_SPI_CS GPIO_PIN(0, 25) /**< Chip Select Pin of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SPI_WP GPIO_PIN(0, 22) /**< Write Protect Pin of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SPI_HOLD GPIO_PIN(0, 23) /**< Hold Pin of the P25Q16H flash */
|
||||
#define XIAO_NRF52840_NOR_SPI_MODE SPI_MODE_0 /**< SPI Clock Mode of the P25Q16H flash */
|
||||
/** @} */
|
||||
|
||||
/** Default MTD device */
|
||||
#define MTD_0 mtd_dev_get(0)
|
||||
|
||||
#ifdef BOARD_SEEEDSTUDIO_XIAO_NRF52840_SENSE
|
||||
/**
|
||||
* @name LSM6DS3TR-C IMU sensor configuration
|
||||
*
|
||||
* The IMU is directly supplied by GPIO Pin P1.08
|
||||
* @{
|
||||
*/
|
||||
#define LSM6DSXX_PARAM_I2C I2C_DEV(1) /**< I2C device of the IMU */
|
||||
#define LSM6DSXX_PARAM_ADDR (0x6A) /**< I2C address of the IMU */
|
||||
|
||||
#define LSM6DS3_PWR_PIN GPIO_PIN(1, 8) /**< Pin of the IMU supply pin */
|
||||
/** @} */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name ztimer configuration values
|
||||
* @{
|
||||
*/
|
||||
#define CONFIG_ZTIMER_USEC_ADJUST_SET 7 /**< overhead for the ztimer_set function in us */
|
||||
#define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 22 /**< overhead for the ztimer_sleep function in us */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
/** @} */
|
||||
#endif /* BOARD_H */
|
||||
@ -6,8 +6,11 @@
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#ifndef GPIO_PARAMS_H
|
||||
#define GPIO_PARAMS_H
|
||||
/**
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
@ -16,9 +19,6 @@
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*/
|
||||
|
||||
#ifndef GPIO_PARAMS_H
|
||||
#define GPIO_PARAMS_H
|
||||
|
||||
#include "board.h"
|
||||
#include "saul/periph.h"
|
||||
|
||||
@ -55,5 +55,5 @@ static const saul_gpio_params_t saul_gpio_params[] =
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GPIO_PARAMS_H */
|
||||
/** @} */
|
||||
#endif /* GPIO_PARAMS_H */
|
||||
@ -6,20 +6,21 @@
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
/**
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral configuration for the Seeed Studio XIAO nRF52840
|
||||
* and Seeed Studio XIAO nRF52840 Sense
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
|
||||
#include "periph_cpu.h"
|
||||
#include "cfg_clock_32_1.h"
|
||||
#include "cfg_rtt_default.h"
|
||||
@ -44,11 +45,11 @@ static const uart_conf_t uart_config[] = {
|
||||
#endif
|
||||
.irqn = UARTE0_UART0_IRQn,
|
||||
},
|
||||
};
|
||||
}; /**< UART Peripheral Configuration Structure */
|
||||
|
||||
#define UART_0_ISR (isr_uart0)
|
||||
#define UART_0_ISR (isr_uart0) /**< Interrupt Service Routing for UART 0 */
|
||||
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config) /**< Number of (preconfigured) UARTs */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@ -68,9 +69,9 @@ static const spi_conf_t spi_config[] = {
|
||||
.mosi = GPIO_PIN(0, 20),
|
||||
.miso = GPIO_PIN(0, 24),
|
||||
}
|
||||
};
|
||||
}; /**< SPI Peripheral Configuration Structure */
|
||||
|
||||
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
||||
#define SPI_NUMOF ARRAY_SIZE(spi_config) /**< Number of (preconfigured) SPI Buses */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
@ -83,14 +84,23 @@ static const i2c_conf_t i2c_config[] = {
|
||||
.scl = GPIO_PIN(0, 5),
|
||||
.sda = GPIO_PIN(0, 4),
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
},
|
||||
#ifdef BOARD_SEEEDSTUDIO_XIAO_NRF52840_SENSE
|
||||
{ /* internal I2C bus for the IMU */
|
||||
.dev = NRF_TWIM0,
|
||||
.scl = GPIO_PIN(0, 27),
|
||||
.sda = GPIO_PIN(0, 7),
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
}
|
||||
};
|
||||
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
||||
#endif
|
||||
}; /**< I2C Peripheral Configuration Structure */
|
||||
|
||||
#define I2C_NUMOF ARRAY_SIZE(i2c_config) /**< Number of (preconfigured) I2C Buses */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
||||
/** @} */
|
||||
#endif /* PERIPH_CONF_H */
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
/**
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840
|
||||
* @ingroup boards_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
16
boards/seeedstudio-xiao-nrf52840-sense/Kconfig
Normal file
16
boards/seeedstudio-xiao-nrf52840-sense/Kconfig
Normal file
@ -0,0 +1,16 @@
|
||||
# Copyright (c) 2024 TU Dresden
|
||||
#
|
||||
# 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 "seeedstudio-xiao-nrf52840-sense" if BOARD_SEEEDSTUDIO_XIAO_NRF52840_SENSE
|
||||
|
||||
config BOARD_SEEEDSTUDIO_XIAO_NRF52840_SENSE
|
||||
bool
|
||||
default y
|
||||
select BOARD_COMMON_NRF52
|
||||
select CPU_MODEL_NRF52840XXAA
|
||||
|
||||
source "$(RIOTBOARD)/common/nrf52/Kconfig"
|
||||
3
boards/seeedstudio-xiao-nrf52840-sense/Makefile
Normal file
3
boards/seeedstudio-xiao-nrf52840-sense/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = board
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
5
boards/seeedstudio-xiao-nrf52840-sense/Makefile.dep
Normal file
5
boards/seeedstudio-xiao-nrf52840-sense/Makefile.dep
Normal file
@ -0,0 +1,5 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += lsm6dsxx
|
||||
endif
|
||||
|
||||
USEMODULE += boards_common_seeedstudio-xiao-nrf52840
|
||||
6
boards/seeedstudio-xiao-nrf52840-sense/Makefile.features
Normal file
6
boards/seeedstudio-xiao-nrf52840-sense/Makefile.features
Normal file
@ -0,0 +1,6 @@
|
||||
CPU_MODEL = nrf52840xxaa
|
||||
|
||||
# the board initialization requires low level GPIO configuration
|
||||
FEATURES_REQUIRED += periph_gpio_ll
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
||||
1
boards/seeedstudio-xiao-nrf52840-sense/Makefile.include
Normal file
1
boards/seeedstudio-xiao-nrf52840-sense/Makefile.include
Normal file
@ -0,0 +1 @@
|
||||
UF2_SOFTDEV ?= SD730
|
||||
41
boards/seeedstudio-xiao-nrf52840-sense/board.c
Normal file
41
boards/seeedstudio-xiao-nrf52840-sense/board.c
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (C) 2025 Technische Universität Hamburg
|
||||
*
|
||||
* 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_seeedstudio-xiao-nrf52840-sense
|
||||
* @{
|
||||
*
|
||||
* @file board.c
|
||||
* @brief Board specific implementations for the Seeedstudio Xiao
|
||||
* nRF52840 Sense board
|
||||
*
|
||||
*
|
||||
* @author Christopher Büchse <christopher.buechse@tuhh.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "periph/gpio.h"
|
||||
#include "periph/gpio_ll.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* The IMU is supplied through a GPIO Pin (P1.08), so it has to be set
|
||||
* to high power mode. */
|
||||
gpio_conf_t lsm6ds3_pwr_pin_conf;
|
||||
|
||||
lsm6ds3_pwr_pin_conf.state = GPIO_OUTPUT_PUSH_PULL; /* Set the output to push pull */
|
||||
lsm6ds3_pwr_pin_conf.drive_strength = GPIO_DRIVE_STRONG; /* enable high drive strength H0H1 */
|
||||
lsm6ds3_pwr_pin_conf.initial_value = 1; /* enable the power for the IMU */
|
||||
|
||||
gpio_ll_init(gpio_get_port(LSM6DS3_PWR_PIN),
|
||||
gpio_get_pin_num(LSM6DS3_PWR_PIN), lsm6ds3_pwr_pin_conf);
|
||||
}
|
||||
36
boards/seeedstudio-xiao-nrf52840-sense/doc.md
Normal file
36
boards/seeedstudio-xiao-nrf52840-sense/doc.md
Normal file
@ -0,0 +1,36 @@
|
||||
@defgroup boards_seeedstudio-xiao-nrf52840-sense Seeed Studio XIAO nRF52840 Sense
|
||||
@ingroup boards
|
||||
@brief Support for the Seeed Studio XIAO nRF52840 Sense
|
||||
|
||||
### General information
|
||||
|
||||
The [XIAO nRF52840 Sense][seeedstudio-xiao-nrf52840-sense]
|
||||
is a development board from Seeed Studio's XIAO board family.
|
||||
|
||||
It provides native USB support, Bluetooth
|
||||
Low Energy and IEEE 802.15.4 support via the nRF52840 MCU.
|
||||
Compared to the [XIAO nRF52840](@ref boards_seeedstudio-xiao-nrf52840) it
|
||||
features an ST LSM6DS3TR-C IMU and a PDM Microphone (not supported yet).
|
||||
|
||||
<img src="https://files.seeedstudio.com/wiki/XIAO-BLE/pinout2.png"
|
||||
alt="top-down view on seeedstudio-xiao-nrf52840" width="50%"/>
|
||||
|
||||
[seeedstudio-xiao-nrf52840-sense]: https://wiki.seeedstudio.com/XIAO_BLE/
|
||||
|
||||
### Using the LSM6DS3TR-C IMU
|
||||
|
||||
You can test the built-in IMU with the test provided in `tests/drivers/lsm6dsxx`:
|
||||
|
||||
```shell
|
||||
make BOARD=seeedstudio-xiao-nrf52840-sense -C tests/drivers/lsm6dsxx flash term
|
||||
```
|
||||
|
||||
### Flashing, Bootloader, and Terminal
|
||||
|
||||
Refer to the [Adafruit nRF52 Bootloader](@ref boards_common_adafruit-nrf52-bootloader)
|
||||
documentation for further details on the flashing process.
|
||||
|
||||
Example with `hello-world` application:
|
||||
```shell
|
||||
make BOARD=seeedstudio-xiao-nrf52840-sense -C examples/basic/hello-world flash term
|
||||
```
|
||||
@ -5,9 +5,9 @@
|
||||
# directory for more details.
|
||||
|
||||
config BOARD
|
||||
default "seeedstudio-xiao-nrf52840" if BOARD_XIAO_NRF52840
|
||||
default "seeedstudio-xiao-nrf52840" if BOARD_SEEEDSTUDIO_XIAO_NRF52840
|
||||
|
||||
config BOARD_XIAO_NRF52840
|
||||
config BOARD_SEEEDSTUDIO_XIAO_NRF52840
|
||||
bool
|
||||
default y
|
||||
select BOARD_COMMON_NRF52
|
||||
|
||||
@ -1,18 +1 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
ifneq (,$(filter mtd,$(USEMODULE)))
|
||||
USEMODULE += mtd_spi_nor
|
||||
endif
|
||||
|
||||
# default to using littlefs2 on the external flash
|
||||
ifneq (,$(filter vfs_default,$(USEMODULE)))
|
||||
USEPKG += littlefs2
|
||||
USEMODULE += mtd
|
||||
endif
|
||||
|
||||
USEMODULE += boards_common_adafruit-nrf52-bootloader
|
||||
|
||||
# include common nrf52 dependencies
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.dep
|
||||
USEMODULE += boards_common_seeedstudio-xiao-nrf52840
|
||||
|
||||
@ -1,18 +1,3 @@
|
||||
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 += arduino_analog
|
||||
FEATURES_PROVIDED += arduino_i2c
|
||||
FEATURES_PROVIDED += arduino_pins
|
||||
FEATURES_PROVIDED += arduino_spi
|
||||
FEATURES_PROVIDED += arduino_uart
|
||||
FEATURES_PROVIDED += highlevel_stdio
|
||||
FEATURES_PROVIDED += xiao_shield
|
||||
|
||||
include $(RIOTBOARD)/common/nrf52/Makefile.features
|
||||
|
||||
@ -17,9 +17,8 @@ Low Energy and IEEE 802.15.4 support via the nRF52840 MCU.
|
||||
|
||||
### Flashing, Bootloader, and Terminal
|
||||
|
||||
Refer to the [Feather nRF52840 Express
|
||||
documentation](https://doc.riot-os.org/group__boards__feather-nrf52840.html) for further details.
|
||||
Both use the same flasher, bootloader, and terminal settings.
|
||||
Refer to the [Adafruit nRF52 Bootloader](@ref boards_common_adafruit-nrf52-bootloader)
|
||||
documentation for further details on the flashing process.
|
||||
|
||||
Example with `hello-world` application:
|
||||
```shell
|
||||
|
||||
@ -1,132 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 TU Dresden
|
||||
*
|
||||
* 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_seeedstudio-xiao-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Mapping from MCU pins to Arduino pins
|
||||
*
|
||||
* You can use the defines in this file for simplified interaction with the
|
||||
* Arduino specific pin numbers.
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.de>
|
||||
*/
|
||||
|
||||
#ifndef ARDUINO_IOMAP_H
|
||||
#define ARDUINO_IOMAP_H
|
||||
|
||||
#include "periph/gpio.h"
|
||||
#include "periph/adc.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name XIAO's UART devices
|
||||
* @{
|
||||
* @brief Arduino's Serial uses USB-CDC-ACM stdio by default
|
||||
*/
|
||||
#define ARDUINO_UART_DEV UART_UNDEF
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's SPI buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_SPI_DEV SPI_DEV(0)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's I2C buses
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_I2C_DEV I2C_DEV(0)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name XIAO's on-board LED (LED_BUILTIN)
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_LED (11)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of MCU pins to Arduino pins
|
||||
* @{
|
||||
*/
|
||||
/* Left pins */
|
||||
#define ARDUINO_PIN_0 GPIO_PIN(0, 2)
|
||||
#define ARDUINO_PIN_1 GPIO_PIN(0, 3)
|
||||
#define ARDUINO_PIN_2 GPIO_PIN(0, 28)
|
||||
#define ARDUINO_PIN_3 GPIO_PIN(0, 29)
|
||||
#define ARDUINO_PIN_4 GPIO_PIN(0, 4)
|
||||
#define ARDUINO_PIN_5 GPIO_PIN(0, 5)
|
||||
#define ARDUINO_PIN_6 GPIO_PIN(1, 11)
|
||||
|
||||
/* Right side */
|
||||
#define ARDUINO_PIN_7 GPIO_PIN(1, 12)
|
||||
#define ARDUINO_PIN_8 GPIO_PIN(1, 13)
|
||||
#define ARDUINO_PIN_9 GPIO_PIN(1, 14)
|
||||
#define ARDUINO_PIN_10 GPIO_PIN(1, 15)
|
||||
|
||||
/* Internal (LEDs) */
|
||||
#define ARDUINO_PIN_11 GPIO_PIN(0, 26)
|
||||
#define ARDUINO_PIN_12 GPIO_PIN(0, 6)
|
||||
#define ARDUINO_PIN_13 GPIO_PIN(0, 30)
|
||||
|
||||
#define ARDUINO_PIN_LAST 13
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Aliases for analog pins
|
||||
* @{
|
||||
*/
|
||||
#define ARDUINO_PIN_A0 ARDUINO_PIN_0
|
||||
#define ARDUINO_PIN_A1 ARDUINO_PIN_1
|
||||
#define ARDUINO_PIN_A2 ARDUINO_PIN_2
|
||||
#define ARDUINO_PIN_A3 ARDUINO_PIN_3
|
||||
#define ARDUINO_PIN_A4 ARDUINO_PIN_4
|
||||
#define ARDUINO_PIN_A5 ARDUINO_PIN_5
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Mapping of Arduino analog pins to RIOT ADC lines
|
||||
* @{
|
||||
*/
|
||||
/* The Seeed Studio XIAO nRF52840 has a fixed ADC to GPIO mapping:
|
||||
*
|
||||
* nRF | MCU pin | Exposed as Arduino pin
|
||||
* -----|-----------|-----------------------
|
||||
* AIN0 | P0.02 | A0 (D0)
|
||||
* AIN1 | P0.03 | A1 (D1)
|
||||
* AIN2 | P0.04 | A4 (D4)
|
||||
* AIN3 | P0.05 | A5 (D5)
|
||||
* AIN4 | P0.28 | A2 (D2)
|
||||
* AIN5 | P0.29 | A3 (D3)
|
||||
* AIN6 | P0.30 | - (D13)
|
||||
* AIN7 | P0.31 | - (-)
|
||||
*/
|
||||
#define ARDUINO_A0 ADC_LINE(0)
|
||||
#define ARDUINO_A1 ADC_LINE(1)
|
||||
#define ARDUINO_A2 ADC_LINE(4)
|
||||
#define ARDUINO_A3 ADC_LINE(5)
|
||||
#define ARDUINO_A4 ADC_LINE(2)
|
||||
#define ARDUINO_A5 ADC_LINE(3)
|
||||
|
||||
#define ARDUINO_ANALOG_PIN_LAST 5
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARDUINO_IOMAP_H */
|
||||
/** @} */
|
||||
@ -1,95 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2024 TU Dresden
|
||||
*
|
||||
* 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_seeedstudio-xiao-nrf52840
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the Seeed Studio XIAO nRF52840
|
||||
*
|
||||
* @author Mikolai Gütschow <mikolai.guetschow@tu-dresden.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(0, 26)
|
||||
#define LED1_PIN GPIO_PIN(0, 30)
|
||||
#define LED2_PIN GPIO_PIN(0, 6)
|
||||
|
||||
#define LED_PORT (NRF_P0)
|
||||
#define LED0_MASK (1 << 26)
|
||||
#define LED1_MASK (1 << 30)
|
||||
#define LED2_MASK (1 << 6)
|
||||
#define LED_MASK (LED0_MASK | LED1_MASK | LED2_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)
|
||||
|
||||
#define LED2_ON (LED_PORT->OUTCLR = LED2_MASK)
|
||||
#define LED2_OFF (LED_PORT->OUTSET = LED2_MASK)
|
||||
#define LED2_TOGGLE (LED_PORT->OUT ^= LED2_MASK)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI NOR flash hardware configuration
|
||||
*
|
||||
* A 2MB P25Q16H flash is present on the board.
|
||||
*
|
||||
* @see https://files.seeedstudio.com/wiki/github_weiruanexample/Flash_P25Q16H-UXH-IR_Datasheet.pdf
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define XIAO_NRF52840_NOR_PAGE_SIZE (256)
|
||||
#define XIAO_NRF52840_NOR_PAGES_PER_SECTOR (16)
|
||||
#define XIAO_NRF52840_NOR_SECTOR_COUNT (512)
|
||||
#define XIAO_NRF52840_NOR_FLAGS \
|
||||
(SPI_NOR_F_SECT_4K | SPI_NOR_F_SECT_32K | SPI_NOR_F_SECT_64K)
|
||||
#define XIAO_NRF52840_NOR_SPI_DEV SPI_DEV(1)
|
||||
#define XIAO_NRF52840_NOR_SPI_CLK SPI_CLK_10MHZ
|
||||
#define XIAO_NRF52840_NOR_SPI_CS GPIO_PIN(0, 25)
|
||||
#define XIAO_NRF52840_NOR_SPI_WP GPIO_PIN(0, 22)
|
||||
#define XIAO_NRF52840_NOR_SPI_HOLD GPIO_PIN(0, 23)
|
||||
#define XIAO_NRF52840_NOR_SPI_MODE SPI_MODE_0
|
||||
/** @} */
|
||||
|
||||
/** Default MTD device */
|
||||
#define MTD_0 mtd_dev_get(0)
|
||||
|
||||
/**
|
||||
* @name ztimer configuration values
|
||||
* @{
|
||||
*/
|
||||
#define CONFIG_ZTIMER_USEC_ADJUST_SET 7
|
||||
#define CONFIG_ZTIMER_USEC_ADJUST_SLEEP 22
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
||||
Loading…
x
Reference in New Issue
Block a user