feat(boards): add EBYTE E22P F103 KISS modem

New stm32_base variant for the EBYTE E22P-915MBH-SC eval kit
(STM32F103C8 + external SX1262), built as a minimal KISS_NO_CRYPTO TNC.
UART and USB CDC KISS envs; the USB env carries a 16-packet CDC receive
queue to avoid a hardware-observed HardFault when a large host->modem
KISS burst overruns the default 3-packet ring. F103 has no SubGHz
peripheral, so the variant drops the SubGhz lib stm32_base otherwise
pulls in for STM32WL boards.

Adds both envs to the PR build CI matrix.
This commit is contained in:
agessaman
2026-08-15 09:22:46 -07:00
parent fd2693eb99
commit 2b06c09d78
4 changed files with 142 additions and 0 deletions
+2
View File
@@ -40,6 +40,8 @@ jobs:
- PicoW_repeater
# STM32
- wio-e5-mini_repeater
- ebyte_e22p_f103_kiss_modem_uart
- ebyte_e22p_f103_kiss_modem_usb
# ESP32-C6
- LilyGo_Tlora_C6_repeater_
# LR1110 (nRF52)
+69
View File
@@ -0,0 +1,69 @@
; EBYTE E22P-915MBH-SC evaluation kit: STM32F103C8T6 + E22P-915M30S (SX1262, 30 dBm PA).
; Minimal KISS TNC, no crypto/identity/filesystem.
; Pin map taken directly from the kit schematic (E22(220)-400(900)MBH-SC).
[ebyte_e22p_f103]
extends = stm32_base
board = genericSTM32F103C8
build_flags = ${stm32_base.build_flags}
-D RADIO_CLASS=CustomSX1262
-D WRAPPER_CLASS=CustomSX1262Wrapper
-D KISS_NO_CRYPTO=1
; --- SX1262 wiring (SPI1: SCK PA5 / MISO PA6 / MOSI PA7) ---
-D P_LORA_NSS=PA4
-D P_LORA_DIO_1=PA3
-D P_LORA_BUSY=PB1
-D P_LORA_RESET=PB0
; --- RF switch: E22 PA/LNA controlled by TXEN (DIO2 NOT used as switch) ---
; PB13 is the E22P EN line: forced HIGH in EByteE22PF103Board::begin(), NOT driven by
; RadioLib. SX126X_RXEN is intentionally left undefined so RadioLib doesn't fight it;
; CustomSX1262::std_init() supplies RADIOLIB_NC for RXEN when only TXEN is set.
-D SX126X_TXEN=PB12
; --- E22 module has a TCXO on DIO3 ---
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
; --- TXD LED = PA15 (JTDI), active-low. EByteE22PF103Board::begin() does the SWJ
; NOJTAG remap to free the pin (SWD flashing/debug unaffected). ---
-D P_LORA_TX_LED=PA15
; --- 915 MHz module (US band); tune to taste ---
-D LORA_FREQ=915.0
; WARNING: this is a 30 dBm (1W) PA module. LORA_TX_POWER sets the *SX1262*
; drive level, which the external PA amplifies. Set per Ebyte's PA spec;
; over-driving can exceed legal limits / overheat the module.
-D LORA_TX_POWER=22
-I variants/ebyte_e22p_f103
build_src_filter = ${stm32_base.build_src_filter}
+<../variants/ebyte_e22p_f103>
; STM32F1 has no SHUTDOWN-mode flash FS; KISS_NO_CRYPTO never uses it, and its flash
; program path (FLASH_TYPEPROGRAM_DOUBLEWORD) isn't F1-safe anyway.
-<helpers/stm32/InternalFileSystem.cpp>
; F103 has no SubGHz radio peripheral (that's an STM32WL-only block); stm32_base pulls
; the SubGhz lib in for those boards, so drop it here or it fails to compile.
lib_ignore = SubGhz
; ---- KISS over the broken-out USART1 header (PA9 TX / PA10 RX) ----
[env:ebyte_e22p_f103_kiss_modem_uart]
extends = ebyte_e22p_f103
build_src_filter = ${ebyte_e22p_f103.build_src_filter}
+<../examples/kiss_modem/>
; ---- KISS over the Type-C native USB (CDC); fit is tighter ----
[env:ebyte_e22p_f103_kiss_modem_usb]
extends = ebyte_e22p_f103
build_flags = ${ebyte_e22p_f103.build_flags}
-D USBCON
-D USBD_USE_CDC
-D USBD_VID=0x0483
-D USBD_PID=0x5740
; The default 3-packet (192B) CDC receive ring fills mid-burst on a large host->modem
; KISS frame (~5 back-to-back 64B USB packets), forcing pause/resume of reception from
; the MAIN thread, which races the USB ISR in CDC_ReceiveQueue_ReserveBlock and can hand
; the endpoint a torn block pointer -> USB_ReadPMA writes out of bounds -> HardFault
; (hardware-observed: imprecise bus fault, pc in USB_ReadPMA, lr in USB IRQ handler).
; 16 packets (1024B) holds the largest single-flight KISS exchange, so the queue never
; fills and the racy resume-from-main-thread path never runs. (#ifndef-guarded.)
-D CDC_RECEIVE_QUEUE_BUFFER_PACKET_NUMBER=16
-flto
build_unflags = -fno-lto
build_src_filter = ${ebyte_e22p_f103.build_src_filter}
+<../examples/kiss_modem/>
+22
View File
@@ -0,0 +1,22 @@
#include <Arduino.h>
#include "target.h"
EByteE22PF103Board board;
// External SX1262 on the default SPI bus. NSS / DIO1 / RESET / BUSY are wired
// to GPIOs; SCLK/MISO/MOSI use the F103's default SPI1 pins (PA5/PA6/PA7).
RADIO_CLASS radio = new Module(P_LORA_NSS, P_LORA_DIO_1, P_LORA_RESET, P_LORA_BUSY);
WRAPPER_CLASS radio_driver(radio, board);
VolatileRTCClock rtc_clock;
SensorManager sensors;
bool radio_init() {
return radio.std_init();
}
mesh::LocalIdentity radio_new_identity() {
RadioNoiseListener rng(radio);
return mesh::LocalIdentity(&rng); // create new random identity
}
+49
View File
@@ -0,0 +1,49 @@
#pragma once
#define RADIOLIB_STATIC_ONLY 1
#include <RadioLib.h>
#include <helpers/radiolib/RadioLibWrappers.h>
#include <helpers/stm32/STM32Board.h>
#include <helpers/radiolib/CustomSX1262Wrapper.h>
#include <helpers/ArduinoHelpers.h>
#include <helpers/SensorManager.h>
// EBYTE E22P-915MBH-SC evaluation kit: STM32F103C8T6 ("Blue Pill"-class MCU,
// Cortex-M3, 64KB flash, 20KB SRAM) + E22P-915M30S (SX1262, 30dBm PA).
// External SX1262 LoRa radio on the default SPI1 bus (PA5/PA6/PA7).
// No on-chip filesystem / identity is used (KISS_NO_CRYPTO build).
class EByteE22PF103Board : public STM32Board {
public:
void begin() override {
// Free PA15 (JTDI) for the TX LED: switch the debug port to SW-DP only (drops the
// 5-wire JTAG, keeps 2-wire SWD, so flashing/debug via ST-Link is unaffected). Must
// run before anything configures PA15.
__HAL_RCC_AFIO_CLK_ENABLE();
__HAL_AFIO_REMAP_SWJ_NOJTAG();
STM32Board::begin();
// E22P EN line forced high (RadioLib does not drive it as an RF switch pin).
pinMode(PB13, OUTPUT);
digitalWrite(PB13, HIGH);
#if defined(P_LORA_TX_LED)
// TX-activity LED (active-low). STM32Board::onBeforeTransmit/onAfterTransmit toggle
// it; configure the pin here since the base class never does.
pinMode(P_LORA_TX_LED, OUTPUT);
digitalWrite(P_LORA_TX_LED, HIGH); // off
#endif
}
const char* getManufacturerName() const override {
return "EBYTE E22P F103 KISS";
}
};
extern EByteE22PF103Board board;
extern WRAPPER_CLASS radio_driver;
extern VolatileRTCClock rtc_clock;
extern SensorManager sensors;
bool radio_init();
mesh::LocalIdentity radio_new_identity();