Add simple xiao nrf support

This commit is contained in:
liquidraver
2026-04-14 13:29:42 +02:00
parent 26eb4a3729
commit 3c2ba020c8
13 changed files with 374 additions and 1 deletions
+1
View File
@@ -16,6 +16,7 @@ nRF_boards=(
rak_wismesh_tag
ikoka_nano_30dbm
sensecap_solar
xiao_nrf52840
)
ESP32_boards=(
+1 -1
View File
@@ -222,7 +222,7 @@ set(ZEPHCORE_COMMON_CONF "${CMAKE_CURRENT_SOURCE_DIR}/boards/common/zephcore_com
# Detect platform from board name and add platform-specific common config
# For boards with qualifiers like "wio_tracker_l1/nrf52840", check both the full BOARD
# string and the BOARD_QUALIFIERS which contains just the qualifier (e.g., "nrf52840")
if(BOARD MATCHES ".*nrf52.*" OR BOARD MATCHES "rak4631" OR BOARD MATCHES "rak_wismesh_tag" OR BOARD MATCHES "rak3401_1watt" OR BOARD MATCHES "wio_tracker" OR BOARD MATCHES "ikoka_nano" OR BOARD MATCHES "t1000_e" OR BOARD MATCHES "thinknode_m1" OR BOARD MATCHES "thinknode_m3" OR BOARD MATCHES "thinknode_m6" OR BOARD MATCHES "promicro_lr2021" OR BOARD MATCHES "sensecap_solar")
if(BOARD MATCHES ".*nrf52.*" OR BOARD MATCHES "rak4631" OR BOARD MATCHES "rak_wismesh_tag" OR BOARD MATCHES "rak3401_1watt" OR BOARD MATCHES "wio_tracker" OR BOARD MATCHES "ikoka_nano" OR BOARD MATCHES "t1000_e" OR BOARD MATCHES "thinknode_m1" OR BOARD MATCHES "thinknode_m3" OR BOARD MATCHES "thinknode_m6" OR BOARD MATCHES "promicro_lr2021" OR BOARD MATCHES "sensecap_solar" OR BOARD MATCHES "xiao_nrf52840")
set(ZEPHCORE_PLATFORM_CONF "${CMAKE_CURRENT_SOURCE_DIR}/boards/common/nrf52_common.conf")
elseif(DEFINED BOARD_QUALIFIERS AND BOARD_QUALIFIERS MATCHES ".*nrf52.*")
set(ZEPHCORE_PLATFORM_CONF "${CMAKE_CURRENT_SOURCE_DIR}/boards/common/nrf52_common.conf")
+1
View File
@@ -13,6 +13,7 @@ Supported Boards
| RAK3401 1W | `west build -b rak3401_1watt zephcore` | UF2 drag-drop or `west flash` |
| Wio Tracker L1 | `west build -b wio_tracker_l1 zephcore` | UF2 drag-drop or `west flash` |
| SenseCAP Solar | `west build -b sensecap_solar zephcore` | UF2 drag-drop or `west flash` |
| XIAO nRF52840 | `west build -b xiao_nrf52840 zephcore` | UF2 drag-drop or `west flash` |
| T1000-E | `west build -b t1000_e zephcore` | UF2 drag-drop or `west flash` |
| ThinkNode M1 | `west build -b thinknode_m1 zephcore` | UF2 drag-drop or `west flash` |
| ThinkNode M3 | `west build -b thinknode_m3 zephcore` | UF2 drag-drop or `west flash` |
@@ -0,0 +1,5 @@
# Copyright (c) 2025 ZephCore
# SPDX-License-Identifier: Apache-2.0
config BOARD_XIAO_NRF52840
select SOC_NRF52840_QIAA
@@ -0,0 +1,13 @@
# Copyright (c) 2025 ZephCore
# SPDX-License-Identifier: Apache-2.0
board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
set(OPENOCD_NRF5_SUBFAMILY "nrf52")
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
@@ -0,0 +1,10 @@
# Seeed XIAO nRF52840 + Wio-SX1262 (headers)
# SPDX-License-Identifier: Apache-2.0
CONFIG_ZEPHCORE_BOARD_NAME="XIAO nRF52840"
CONFIG_BT_DIS_MODEL_NUMBER_STR="Seeed XIAO nRF52840"
CONFIG_ZEPHCORE_SD_FWID=0x0123
CONFIG_ZEPHCORE_MAX_CONTACTS=510
@@ -0,0 +1,6 @@
/*
* Seeed XIAO nRF52840 — QSPI /ext for contacts (no GPS aliases)
* SPDX-License-Identifier: Apache-2.0
*/
#include "../../common/qspi-ext.dtsi"
@@ -0,0 +1,9 @@
# Copyright (c) 2025 ZephCore
# SPDX-License-Identifier: Apache-2.0
board:
name: xiao_nrf52840
full_name: Seeed XIAO nRF52840 (Wio-SX1262)
vendor: seeed
socs:
- name: nrf52840
@@ -0,0 +1,66 @@
/*
* Seeed XIAO nRF52840 + Wio-SX1262 (headers) pin control
* SPDX-License-Identifier: Apache-2.0
*
* MeshCore variants/xiao_nrf52 variant.cpp + platformio.ini:
* - SPI2 (SX1262): SCK=P1.13, MOSI=P1.15, MISO=P1.14 (D8D10)
* - I2C0: SDA=P1.12, SCL=P1.11 (MeshCore PIN_WIRE_SDA=D7, PIN_WIRE_SCL=D6)
* - QSPI P25Q16H: same as other XIAO nRF52840 designs
*/
&pinctrl {
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>,
<NRF_PSEL(SPIM_MOSI, 1, 15)>,
<NRF_PSEL(SPIM_MISO, 1, 14)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 1, 13)>,
<NRF_PSEL(SPIM_MOSI, 1, 15)>,
<NRF_PSEL(SPIM_MISO, 1, 14)>;
low-power-enable;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 12)>,
<NRF_PSEL(TWIM_SCL, 1, 11)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 1, 12)>,
<NRF_PSEL(TWIM_SCL, 1, 11)>;
low-power-enable;
};
};
qspi_default: qspi_default {
group1 {
psels = <NRF_PSEL(QSPI_SCK, 0, 21)>,
<NRF_PSEL(QSPI_IO0, 0, 20)>,
<NRF_PSEL(QSPI_IO1, 0, 24)>,
<NRF_PSEL(QSPI_IO2, 0, 22)>,
<NRF_PSEL(QSPI_IO3, 0, 23)>,
<NRF_PSEL(QSPI_CSN, 0, 25)>;
};
};
qspi_sleep: qspi_sleep {
group1 {
psels = <NRF_PSEL(QSPI_SCK, 0, 21)>,
<NRF_PSEL(QSPI_IO0, 0, 20)>,
<NRF_PSEL(QSPI_IO1, 0, 24)>,
<NRF_PSEL(QSPI_IO2, 0, 22)>,
<NRF_PSEL(QSPI_IO3, 0, 23)>,
<NRF_PSEL(QSPI_CSN, 0, 25)>;
low-power-enable;
};
};
};
@@ -0,0 +1,231 @@
/*
* Seeed XIAO nRF52840 + Wio-SX1262 on headers
* SPDX-License-Identifier: Apache-2.0
*
* MeshCore variants/xiao_nrf52 (plain XIAO, no GPS):
* - SX1262: CS/RST/BUSY/DIO1/RXEN = P0.04/28/29/03/05 (D4D1, D5)
* - SPI: P1.13/14/15 (D8D10); DIO2 RF switch; TCXO 1.8V
* - LEDs: red P0.26 (D11, MeshCore P_LORA_TX_LED), blue P0.06 (D12), green P0.30 (D13), active-low
* - User button: D0 = P0.02
* - Battery: AIN7 P0.31, divider enable P0.14 (D14), active-low enable
* - I2C: P1.12 SDA / P1.11 SCL (MeshCore Wire on D7/D6 when LoRa uses D4/D5)
* - UART0 not used (pins shared with I2C in this layout)
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <nordic/nrf52840_partition.dtsi>
#include <zephyr/dt-bindings/lora/sx126x.h>
#include <zephyr/dt-bindings/adc/nrf-saadc.h>
#include <zephyr/dt-bindings/input/input-event-codes.h>
#include "xiao_nrf52840_nrf52840-pinctrl.dtsi"
/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;
/delete-node/ &storage_partition;
/ {
model = "Seeed XIAO nRF52840";
compatible = "seeed,xiao-nrf52840";
chosen {
zephyr,code-partition = &code_partition;
zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &cdc_acm_uart;
};
leds {
compatible = "gpio-leds";
/* MeshCore LED_STATE_ON 0 → active-low */
led_red: led_0 {
gpios = <&gpio0 26 GPIO_ACTIVE_LOW>;
label = "LED red (LoRa TX)";
};
led_blue: led_1 {
gpios = <&gpio0 6 GPIO_ACTIVE_LOW>;
label = "LED blue";
};
led_green: led_2 {
gpios = <&gpio0 30 GPIO_ACTIVE_LOW>;
label = "LED green";
};
};
buttons: buttons {
compatible = "gpio-keys";
user_button: button_0 {
gpios = <&gpio0 2 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_0>;
label = "User";
};
};
user_btn_longpress {
compatible = "zephyr,input-longpress";
input = <&buttons>;
input-codes = <INPUT_KEY_0>;
short-codes = <INPUT_KEY_A>;
long-codes = <INPUT_KEY_POWER>;
long-delay-ms = <1000>;
};
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
input-codes = <INPUT_KEY_A>;
tap-codes = <INPUT_KEY_1 INPUT_KEY_B INPUT_KEY_D INPUT_KEY_C INPUT_KEY_E>;
tap-delay-ms = <400>;
};
vbat_enable: vbat-enable {
compatible = "regulator-fixed";
regulator-name = "vbat-enable";
enable-gpios = <&gpio0 14 GPIO_ACTIVE_LOW>;
};
zephyr,user {
io-channels = <&adc 7>;
/* MeshCore: mV ≈ raw * 3 * 3 / 4096 at 12-bit internal 3.0V ref */
vbat-mv-multiplier = <9000>;
};
aliases {
led0 = &led_blue;
led1 = &led_green;
lora-tx-led = &led_red;
sw0 = &user_button;
lora0 = &lora;
watchdog0 = &wdt0;
};
};
&reg0 {
status = "okay";
};
&reg1 {
regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
channel@7 {
reg = <7>;
zephyr,gain = "ADC_GAIN_1_6";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME(ADC_ACQ_TIME_MICROSECONDS, 10)>;
zephyr,input-positive = <NRF_SAADC_AIN7>;
zephyr,resolution = <12>;
};
};
&uicr {
nfct-pins-as-gpios;
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
status = "disabled";
};
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
#include "../../common/sensors-i2c.dtsi"
};
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>;
pinctrl-0 = <&spi2_default>;
pinctrl-1 = <&spi2_sleep>;
pinctrl-names = "default", "sleep";
lora: lora@0 {
compatible = "semtech,sx1262";
reg = <0>;
reset-gpios = <&gpio0 28 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
dio1-gpios = <&gpio0 3 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
rx-enable-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>;
dio2-tx-enable;
dio3-tcxo-voltage = <SX126X_DIO3_TCXO_1V8>;
tcxo-power-startup-delay-ms = <5>;
spi-max-frequency = <8000000>;
rx-boosted;
};
};
&qspi {
status = "okay";
pinctrl-0 = <&qspi_default>;
pinctrl-1 = <&qspi_sleep>;
pinctrl-names = "default", "sleep";
qspi_flash: qspi_flash@0 {
compatible = "nordic,qspi-nor";
reg = <0>;
writeoc = "pp";
readoc = "fastread";
sck-frequency = <16000000>;
jedec-id = [85 60 15];
sfdp-bfp = [
e5 20 f1 ff ff ff ff 01 44 eb 08 6b 08 3b 04 bb
ee ff ff ff ff ff 00 ff ff ff 00 ff 0c 20 0f 52
10 d8 00 ff
];
size = <16777216>;
has-dpd;
t-enter-dpd = <3000>;
t-exit-dpd = <50000>;
};
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
#include "../../common/nrf52_partitions_sdv7.dtsi"
&qspi_flash {
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
qspi_storage_partition: partition@0 {
label = "qspi_storage";
reg = <0x00000000 0x00200000>;
};
};
};
#include "../../common/nrf52_wakeup.dtsi"
@@ -0,0 +1,20 @@
identifier: xiao_nrf52840/nrf52840
name: Seeed XIAO nRF52840
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 256
flash: 1024
supported:
- adc
- ble
- gpio
- i2c
- spi
- usb_device
- qspi
- lora
vendor: seeed
@@ -0,0 +1,10 @@
# Copyright (c) 2025 ZephCore
# SPDX-License-Identifier: Apache-2.0
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
CONFIG_GPIO=y
CONFIG_SERIAL=y
CONFIG_CONSOLE=y
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_USE_DT_CODE_PARTITION=y
+1
View File
@@ -15,6 +15,7 @@ thinknode_m6
rak_wismesh_tag
ikoka_nano_30dbm
sensecap_solar
xiao_nrf52840
```
> **RAK WisMesh Pocket** (WisBlock pocket): use `-b rak4631` — same board string and firmware as **RAK4631**.