port RAK3401 1W

This commit is contained in:
liquidraver
2026-03-26 22:02:11 +01:00
parent 00101d60f3
commit 31f0901606
12 changed files with 367 additions and 1 deletions
+1
View File
@@ -22,6 +22,7 @@ Other benefits:
| **Wio Tracker L1** | SX1262 | GPS (L76KB), OLED (SH1106), joystick, buzzer, QSPI flash |
| **Seeed T1000-E** | LR1110 | GPS (AG3335), LEDs, button |
| **RAK4631** | SX1262 | GPS (u-blox MAX-7Q), I2C sensors (SHTC3, LPS22HB, BME680) |
| **RAK3401 1W** | SX1262 + SKY66122 (30 dBm) | GPS (u-blox MAX-7Q, optional), I2C sensors |
| **RAK WisMesh Tag** | SX1262 | GPS (AT6558R), accelerometer, RGB LEDs, buzzer |
| **ThinkNode M1** | SX1262 | GPS, e-paper display (SSD1681), QSPI flash, buzzer, RGB LEDs |
| **Ikoka Nano 30dBm** | SX1262 (E22-900M30S, 30dBm PA) | RGB LEDs |
+1
View File
@@ -512,6 +512,7 @@ prj.conf (base: console, logging)
| Board | SoC | Radio | GPS | Display | Buzzer | Buttons | QSPI | Max Contacts |
|-------|-----|-------|-----|---------|--------|---------|------|-------------|
| RAK4631 | nRF52840 | SX1262 | gnss-nmea | - | - | - | - | 350 |
| RAK3401 1W | nRF52840 | SX1262+SKY66122 (30dBm) | gnss-nmea (opt) | - | - | - | - | 350 |
| WisMesh Tag | nRF52840 | SX1262 | Air530Z | - | Yes | 1+multitap | - | 350 |
| T1000-E | nRF52840 | **LR1110** | AG3335 | - | Yes | 1+multitap | - | 350 |
| ThinkNode M1 | nRF52840 | SX1262 | Air530Z | EPD 200x200 | Yes | 2+multitap | 2MB | 510 |
+1 -1
View File
@@ -214,7 +214,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 "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")
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")
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
@@ -10,6 +10,7 @@ Supported Boards
| Board | Build string | Flash |
|----------------------|-------------------------------------------|-------------------------------|
| RAK4631 | `west build -b rak4631 zephcore` | UF2 drag-drop or `west flash` |
| 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` |
| 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` |
@@ -0,0 +1,6 @@
# RAK3401 1W board configuration
# Copyright (c) 2025 ZephCore
# SPDX-License-Identifier: Apache-2.0
config BOARD_RAK3401_1WATT
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,21 @@
# RAK3401 1W (nRF52840 + SX1262 + SKY66122 1W PA)
# Board-specific configuration
#
# Hardware:
# - nRF52840 SoC, SX1262 LoRa via RAK13302 IO-slot module (30 dBm)
# - SKY66122 1W PA/LNA FEM, enabled via SX126X_POWER_EN on P0.21
# - RAK1910 GPS on UART0 (Slot A) - u-blox MAX-7Q at 9600 baud (optional)
# - Battery ADC on AIN3 (P0.05)
# - I2C0 for WisBlock sensors (auto-detected)
# - LEDs: GREEN=P1.03 (TX), BLUE=P1.04 (status)
# - No display, QSPI disabled (conflicts with LoRa SPI)
# - SoftDevice s140 v6.1.1, UF2 bootloader
# Board identification (matches Arduino MeshCore variant name)
CONFIG_ZEPHCORE_BOARD_NAME="RAK 3401"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="RAK3401 1W"
# SoftDevice firmware ID (s140 v6.1.1)
CONFIG_ZEPHCORE_SD_FWID=0x00B6
@@ -0,0 +1,6 @@
board:
name: rak3401_1watt
full_name: RAK3401 1W (nRF52840 + SX1262 + SKY66122 PA)
vendor: rakwireless
socs:
- name: nrf52840
@@ -0,0 +1,68 @@
/*
* RAK3401 1W pin control definitions
* Copyright (c) 2025 ZephCore
*
* SPDX-License-Identifier: Apache-2.0
*
* Pin mappings (from Meshtastic/MeshCore variant.h):
*
* SPI1 (LoRa SX1262): SCK=P0.03, MISO=P0.29, MOSI=P0.30, CS=P0.26
* NOTE: These pins are shared with QSPI flash QSPI must be disabled.
* I2C0 (WisBlock sensors): SDA=P0.13, SCL=P0.14
* UART0 (GPS 9600): TX=P0.16 (GPS RX), RX=P0.15 (GPS TX)
*/
&pinctrl {
/* UART0 for GPS module (RAK1910 u-blox MAX-7Q) at 9600 baud */
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 16)>; /* P0.16 → GPS RX */
};
group2 {
psels = <NRF_PSEL(UART_RX, 0, 15)>; /* P0.15 ← GPS TX */
bias-pull-up;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 0, 16)>,
<NRF_PSEL(UART_RX, 0, 15)>;
low-power-enable;
};
};
/* I2C0 for WisBlock sensors */
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 13)>, /* P0.13 WB_I2C1_SDA */
<NRF_PSEL(TWIM_SCL, 0, 14)>; /* P0.14 WB_I2C1_SCL */
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 13)>,
<NRF_PSEL(TWIM_SCL, 0, 14)>;
low-power-enable;
};
};
/* SPI1 for LoRa SX1262 (IO-slot SPI bus) */
spi1_default: spi1_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>, /* P0.03 PIN_SPI1_SCK */
<NRF_PSEL(SPIM_MOSI, 0, 30)>, /* P0.30 PIN_SPI1_MOSI */
<NRF_PSEL(SPIM_MISO, 0, 29)>; /* P0.29 PIN_SPI1_MISO */
};
};
spi1_sleep: spi1_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 3)>,
<NRF_PSEL(SPIM_MOSI, 0, 30)>,
<NRF_PSEL(SPIM_MISO, 0, 29)>;
low-power-enable;
};
};
};
@@ -0,0 +1,219 @@
/*
* RAK3401 1W nRF52840 + SX1262 + SKY66122 1W PA (WisMesh Booster)
* Copyright (c) 2025 ZephCore
*
* SPDX-License-Identifier: Apache-2.0
*
* Hardware:
* - nRF52840 SoC with BLE 5
* - SX1262 LoRa radio on RAK13302 IO-slot module (30 dBm, SKY66122 FEM)
* DIO2 as RF switch, TCXO 1.8V via DIO3
* - RAK1910 GPS module (optional) on UART0 at 9600 baud
* - Battery ADC on AIN3 (P0.05)
* - I2C0 for WisBlock sensors (auto-detected)
* - LEDs: GREEN=P1.03 (TX, active HIGH), BLUE=P1.04 (status, active HIGH)
* - QSPI flash disabled (pins conflict with LoRa SPI bus)
* - SoftDevice s140 v6.1.1, UF2 bootloader
*
* Pin mappings (from Meshtastic/MeshCore variant.h):
* - LoRa SPI: SCK=P0.03, MOSI=P0.30, MISO=P0.29, CS=P0.26
* - LoRa ctl: DIO1=P0.10 (NFC2), BUSY=P0.09 (NFC1), RESET=P0.04
* - FEM: SX126X_POWER_EN=P0.21 (SKY66122 CSD+CPS)
* - 3V3_S: WB_IO2=P1.02 (3V3_S rail, powers GPS + PA boost)
* - I2C: SDA=P0.13, SCL=P0.14
* - GPS: TX=P0.16, RX=P0.15
* - Battery: AIN3=P0.05
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "rak3401_1watt-pinctrl.dtsi"
#include <zephyr/dt-bindings/lora/sx126x.h>
#include <zephyr/dt-bindings/adc/nrf-saadc.h>
/ {
model = "RAK3401 1W";
compatible = "rak,rak3401-1watt";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,code-partition = &code_partition;
zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &cdc_acm_uart;
};
aliases {
lora0 = &lora;
led0 = &led_green;
led1 = &led_blue;
lora-tx-led = &led_green;
watchdog0 = &wdt0;
};
/* ---- LEDs (active HIGH per variant.h LED_STATE_ON=HIGH) ---- */
leds {
compatible = "gpio-leds";
led_green: led_0 {
gpios = <&gpio1 3 GPIO_ACTIVE_HIGH>;
label = "Green LED";
};
led_blue: led_1 {
gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
/* ---- Power control ---- */
/* 3V3_S rail must be HIGH for GPS and IO-slot peripherals.
* WB_IO2 (P1.02) doubles as GPS_RESET on the RAK1910 slot,
* so it must remain HIGH when GPS is active. */
v3v3s_enable: v3v3s-enable {
compatible = "regulator-fixed";
regulator-name = "v3v3s-enable";
enable-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
};
/* SKY66122 FEM enable must be HIGH before SX1262 can transmit.
* SX126X_POWER_EN = P0.21 (IO3 on WisBlock base). */
lora_pwr_enable: lora-pwr-enable {
compatible = "regulator-fixed";
regulator-name = "lora-pwr-enable";
enable-gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
regulator-boot-on;
startup-delay-us = <10000>;
};
/* ---- Battery ADC ---- */
/* P0.05 (AIN3), 150K+150K divider same circuit as RAK4631.
* Arduino ADC_MULTIPLIER=1.73, AREF=3.0V:
* vbat-mv-multiplier = round(3 * 1.73 * 1.187 * 1000) = 6161 */
zephyr,user {
io-channels = <&adc 3>;
vbat-mv-multiplier = <6161>;
};
};
/* ---- SoC configuration ---- */
&reg0 {
status = "okay";
};
&reg1 {
regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
/* Battery voltage on P0.05 (AIN3) */
channel@3 {
reg = <3>;
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_AIN3>;
zephyr,resolution = <12>;
};
};
/* Enable NFC1 (P0.09) and NFC2 (P0.10) as plain GPIOs.
* P0.09 SX1262 BUSY, P0.10 SX1262 DIO1. */
&uicr {
nfct-pins-as-gpios;
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
/* ---- GPS on UART0 (RAK1910 u-blox MAX-7Q, 9600 baud) ---- */
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <9600>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
gnss: gnss-nmea-generic {
compatible = "gnss-nmea-generic";
};
};
/* ---- I2C0 for WisBlock sensors ---- */
&i2c0 {
compatible = "nordic,nrf-twim";
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
pinctrl-0 = <&i2c0_default>;
pinctrl-1 = <&i2c0_sleep>;
pinctrl-names = "default", "sleep";
/* All supported environment & power sensors — auto-detected at runtime */
#include "../../common/sensors-i2c.dtsi"
};
/* ---- SPI1 for LoRa SX1262 (RAK13302 IO-slot module) ---- */
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
pinctrl-0 = <&spi1_default>;
pinctrl-1 = <&spi1_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 26 GPIO_ACTIVE_LOW>; /* P0.26 LORA_CS */
lora: lora@0 {
compatible = "semtech,sx1262";
reg = <0>;
spi-max-frequency = <8000000>;
/* LoRa control pins */
reset-gpios = <&gpio0 4 GPIO_ACTIVE_LOW>; /* P0.04 WB_IO4 */
busy-gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>; /* P0.09 NFC1 */
dio1-gpios = <&gpio0 10 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>; /* P0.10 NFC2 */
/* DIO2 drives SKY66122 CTX (TX/RX switch) */
dio2-tx-enable;
/* TCXO 1.8V reference via DIO3 */
dio3-tcxo-voltage = <SX126X_DIO3_TCXO_1V8>;
tcxo-power-startup-delay-ms = <5>;
/* RX boosted LNA for improved sensitivity */
rx-boosted;
};
};
/* ---- QSPI flash — disabled (pins shared with LoRa SPI) ---- */
&qspi {
status = "disabled";
};
/* ---- USB CDC for console/CLI ---- */
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
/* ---- Flash partitions (SoftDevice v6, app@0x26000) ---- */
#include "../../common/nrf52_partitions_sdv6.dtsi"
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: Apache-2.0
# RAK3401 1W default configuration
# Enable MPU
CONFIG_ARM_MPU=y
CONFIG_HW_STACK_PROTECTION=y
# Enable GPIO
CONFIG_GPIO=y
# Enable console on USB CDC
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_LINE_CTRL=y
# Enable flash/NVS storage
CONFIG_FLASH=y
CONFIG_FLASH_MAP=y
CONFIG_NVS=y
# Pinctrl
CONFIG_PINCTRL=y
# SPI for LoRa
CONFIG_SPI=y
# ADC for battery
CONFIG_ADC=y
+1
View File
@@ -6,6 +6,7 @@ Board strings for use with `west build -b <board> zephcore`.
```
rak4631
rak3401_1watt
wio_tracker_l1
t1000_e
thinknode_m1