Init T114 without screen

This commit is contained in:
Steve Calvário committed 2026-05-15 19:04:14 +01:00
1 parent a3bfb1e4a3
commit 6dc86cc443
9 files changed
+384 -1

No files matched your search

+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 "promicro_sx1262" OR BOARD MATCHES "sensecap_solar" OR BOARD MATCHES "xiao_nrf52840" OR BOARD MATCHES "lilygo_techo")
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 "promicro_sx1262" OR BOARD MATCHES "sensecap_solar" OR BOARD MATCHES "xiao_nrf52840" OR BOARD MATCHES "lilygo_techo" OR BOARD MATCHES "heltec_t114")
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")
@@ -0,0 +1,6 @@
# Copyright (c) 2026 ZephCore
#
# SPDX-License-Identifier: Apache-2.0
config BOARD_HELTEC_T114
select SOC_NRF52840_QIAA
@@ -0,0 +1,14 @@
# Copyright (c) 2026 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,20 @@
# Heltec T114 — nRF52840 + SX1262
# Board-specific configuration
#
# Hardware:
# - SX1262 LoRa (22 dBm, DIO2 RF switch, TCXO 1.8V, RX boosted)
# - ATGM336H GPS on UART0 (9600 baud, enable P0.21, reset P1.06 active-LOW)
# - Battery AIN2 (P0.04), 4.9:1 voltage divider, enable P0.06
# - I2C0 (SDA=P0.07, SCL=P0.08) for sensors
# - ST7789 1.14" 240×135 TFT
# - LED: P1.03 (active-LOW, LoRa TX)
# - Button: P1.10 (active-LOW)
# Board identification (matches Arduino MeshCore variant name)
CONFIG_ZEPHCORE_BOARD_NAME="Heltec T114"
# Device Information Service model name
CONFIG_BT_DIS_MODEL_NUMBER_STR="Heltec T114"
# SoftDevice firmware ID (s140 v6.1.1, same as RAK4631)
CONFIG_ZEPHCORE_SD_FWID=0x00B6
@@ -0,0 +1,10 @@
# Copyright (c) 2026 ZephCore
#
# SPDX-License-Identifier: Apache-2.0
board:
name: heltec_t114
full_name: Heltec T114
vendor: heltec
socs:
- name: nrf52840
@@ -0,0 +1,62 @@
/*
* Heltec T114 pin control definitions
* Copyright (c) 2026 ZephCore
*
* SPDX-License-Identifier: Apache-2.0
*
* Pin mappings from MeshCore variants/heltec_t114 (variant.cpp, platformio.ini):
* - SPI2 (SX1262): SCK=P0.19, MOSI=P0.22, MISO=P0.23
* - I2C0 (Wire1, sensors): SDA=P0.07, SCL=P0.08
* - UART0 (GPS): TX=P1.07, RX=P1.05
* - SPI3 (ST7789 display): SCK=P1.08, MOSI=P1.09 (no MISO needed)
*/
&pinctrl {
spi2_default: spi2_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
<NRF_PSEL(SPIM_MOSI, 0, 22)>,
<NRF_PSEL(SPIM_MISO, 0, 23)>;
};
};
spi2_sleep: spi2_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 19)>,
<NRF_PSEL(SPIM_MOSI, 0, 22)>,
<NRF_PSEL(SPIM_MISO, 0, 23)>;
low-power-enable;
};
};
i2c0_default: i2c0_default {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 7)>,
<NRF_PSEL(TWIM_SCL, 0, 8)>;
};
};
i2c0_sleep: i2c0_sleep {
group1 {
psels = <NRF_PSEL(TWIM_SDA, 0, 7)>,
<NRF_PSEL(TWIM_SCL, 0, 8)>;
low-power-enable;
};
};
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 7)>,
<NRF_PSEL(UART_RX, 1, 5)>;
bias-pull-up;
};
};
uart0_sleep: uart0_sleep {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 7)>,
<NRF_PSEL(UART_RX, 1, 5)>;
low-power-enable;
};
};
};
@@ -0,0 +1,230 @@
/*
* Heltec T114 — nRF52840 + SX1262
* Copyright (c) 2026 ZephCore
*
* SPDX-License-Identifier: Apache-2.0
*
*/
/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 "heltec_t114_nrf52840-pinctrl.dtsi"
/* Delete default partitions from nrf52840_partition.dtsi */
/delete-node/ &boot_partition;
/delete-node/ &slot0_partition;
/delete-node/ &slot1_partition;
/delete-node/ &storage_partition;
/ {
model = "Heltec T114";
compatible = "heltec,t114";
chosen {
zephyr,code-partition = &code_partition;
zephyr,console = &cdc_acm_uart;
zephyr,shell-uart = &cdc_acm_uart;
};
leds {
compatible = "gpio-leds";
/* LED_BUILTIN on P1.03, active-LOW (LED_STATE_ON = LOW) */
tx_led: led_0 {
gpios = <&gpio1 3 GPIO_ACTIVE_LOW>;
label = "LoRa TX LED";
};
};
buttons: buttons {
compatible = "gpio-keys";
user_button: button_0 {
gpios = <&gpio1 10 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
zephyr,code = <INPUT_KEY_0>;
label = "User Button";
};
};
/* Input filter: user button long-press detection (1000ms) */
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>;
};
/* Input filter: user button multi-tap detection
* 1 tap (400ms wait) → KEY_1 = page next on OLED
* 2 taps (400ms wait) → KEY_B = flood advert
* 3 taps (400ms wait) → KEY_D = buzzer mute toggle
* 4 taps (400ms wait) → KEY_C = GPS on/off
* 5 taps (immediate) → KEY_E = LED heartbeat toggle */
user_btn_multitap {
compatible = "zephcore,input-multi-tap";
/* No 'input' phandle — listen to ALL devices.
* KEY_A is emitted by the longpress pseudo-device,
* not by &buttons, so we must not filter by device. */
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>;
};
/* GPS power enable — P0.21, HIGH = GPS powered on */
gps_en: gps-enable {
compatible = "gpio-leds";
gps_enable_pin: gps_enable {
gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
label = "GPS Enable";
};
};
/* GPS hardware reset — P1.06, active-LOW (PIN_GPS_RESET_ACTIVE=LOW) */
gps_rst: gps-reset {
compatible = "gpio-leds";
gps_reset_pin: gps_reset {
gpios = <&gpio1 6 GPIO_ACTIVE_LOW>;
label = "GPS Reset";
};
};
/*
* Battery ADC enable — P0.06, HIGH = enable divider for measurement.
* ZephyrBoard::getBattMilliVolts() calls regulator_{enable,disable}
* around each reading to save power.
*/
vbat_enable: vbat-enable {
compatible = "regulator-fixed";
regulator-name = "vbat-enable";
enable-gpios = <&gpio0 6 GPIO_ACTIVE_HIGH>;
};
zephyr,user {
io-channels = <&adc 2>;
/*
* Full-scale = 3600 mV (ADC_GAIN_1_6 + ADC_REF_INTERNAL),
* voltage divider ratio = 4.9 (ADC_MULTIPLIER from variant.h).
* multiplier = 3600 * 4.9 = 17640
*/
vbat-mv-multiplier = <17640>;
};
aliases {
led0 = &tx_led;
lora-tx-led = &tx_led;
sw0 = &user_button;
lora0 = &lora;
watchdog0 = &wdt0;
gps-enable = &gps_enable_pin;
gps-reset = &gps_reset_pin;
};
};
&reg0 {
status = "okay";
};
/* DC-DC converter (NRF52BoardDCDC) */
&reg1 {
regulator-initial-mode = <NRF5X_REG_MODE_DCDC>;
};
&adc {
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
/* Battery voltage on P0.04 (AIN2) — 4.9:1 divider, 3.0V ref in Arduino */
channel@2 {
reg = <2>;
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_AIN2>;
zephyr,resolution = <12>;
};
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&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"
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <9600>;
pinctrl-0 = <&uart0_default>;
pinctrl-1 = <&uart0_sleep>;
pinctrl-names = "default", "sleep";
gnss: gnss {
compatible = "gnss-nmea-generic";
};
};
&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
cs-gpios = <&gpio0 24 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 25 GPIO_ACTIVE_LOW>;
busy-gpios = <&gpio0 17 GPIO_ACTIVE_HIGH>;
dio1-gpios = <&gpio0 20 (GPIO_PULL_DOWN | 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 Flash (MX25R1635F 2MB) — DISABLED.
*/
&qspi {
status = "disabled";
};
zephyr_udc0: &usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
};
};
/* SoftDevice s140 v6.1.1 flash layout (app@0x26000, bootloader@0xF4000) */
#include "../../common/nrf52_partitions_sdv6.dtsi"
#include "../../common/nrf52_wakeup.dtsi"
@@ -0,0 +1,20 @@
identifier: heltec_t114/nrf52840
name: Heltec T114
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 256
flash: 1024
supported:
- adc
- ble
- gpio
- i2c
- spi
- usb_device
- lora
- gnss
vendor: heltec
@@ -0,0 +1,21 @@
# Copyright (c) 2026 ZephCore
# SPDX-License-Identifier: Apache-2.0
# Enable MPU
CONFIG_ARM_MPU=y
# Enable hardware stack protection
CONFIG_HW_STACK_PROTECTION=y
# Enable GPIO
CONFIG_GPIO=y
# Enable UART driver
CONFIG_SERIAL=y
# Enable console
CONFIG_CONSOLE=y
# Build UF2 by default
CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_USE_DT_CODE_PARTITION=y