Tutorial: LoRa (SX1262), Sub-GHz (CC1101), Overlays & EU868 Duty-Cycle

This tutorial covers Sub-GHz packet radio development on PylotOS (hal.rf + pylotos.wireless + pylotos.overlays), including shared-SPI safety, RF front-end switch protection, regional ISM regulatory enforcement, and replay-protected packet framing.


1. Supported Sub-GHz Hardware & Bus Topologies

Board / ExpansionRadio ICBus Wiring & Special C HAL Guarantees
heltec_wifi_lora_32_v3SX1262Dedicated SPI2 (SCK=9, MOSI=10, MISO=11, CS=8, RST=12, BUSY=13, DIO1=14), VEXT=36 active-LOW rail.
lilygo_t_deck (+ Plus)SX1262Shared SPI2 (40/41/38) alongside ST7789 LCD (CS=12) & microSD (CS=39); DIO1 ISR never touches SPI — FIFO reads lock hal_spi_bus_lock().
m5stack_cardputer_adv + Cap LoRa-1262SX1262EXT 14-pin (CS=5, RST=3, BUSY=6, DIO1=4) + PI4IOE5V6408 @ 0x43 pin P0 RF-switch guard driven before PA enable.
Grove / M-Bus / Header CC1101CC1101Runtime pin-guarded hal.rf.attach("cc1101", ...) for 433.92 MHz & 868.35 MHz 2-FSK / GFSK / OOK frames.

2. Regional ISM Band & Sliding 1% Duty-Cycle Enforcer (hal_rf_reg.h)

To prevent accidental illegal transmissions or channel hogging, the C HAL enforces regional ISM limits directly at set_freq(), set_power(), and send():

RegionAllowed BandMax TX PowerDuty-Cycle Budget (1-Hour Sliding Window)
EU868 (default)863.0 – 870.0 MHz+14 dBm (+27 dBm in 869.4–869.65)1% (36,000 ms / hr) calculated via exact Semtech LoRa Time-on-Air
EU433433.05 – 434.79 MHz+10 dBm10% (360,000 ms / hr)
US915 / AU915902.0 – 928.0 MHz+22 dBmDwell / channel hopping
AS923915.0 – 928.0 MHz+16 dBm1% (36,000 ms / hr)

If an app attempts to set 915 MHz under EU868, or exceeds its 36,000 ms hourly airtime budget, the C HAL raises OSError(errno.EPERM). Always inspect hal.rf.duty_info() to adapt telemetry cadence gracefully!


3. Custom Declarative Hardware Overlays (/apps/.overlays/*.json)

Create custom expansion descriptors without recompiling C firmware:

{
  "id": "t_embed_cc1101_plus",
  "name": "LilyGO T-Embed CC1101 Sub-GHz Shield",
  "boards": ["lilygo_t_embed"],
  "subsystem": "rf",
  "driver": "cc1101",
  "port": "ext_cap",
  "params": {
    "spi_host": 2,
    "cs": 15,
    "irq": 4
  },
  "region": "EU868"
}

Apply from Python or the pylot> console:

from pylotos import overlays

overlays.apply_overlay("cardputer_adv_cap_lora1262", persist=True)

Try both Sub-GHz examples in pylotos-sim:

pylotos-sim examples/lora_mesh_messenger.py --board lilygo_t_deck --port 8080
pylotos-sim examples/subghz_cc1101_and_overlays.py --board lilygo_t_embed --port 8080