Files
MeshTerm/scripts/xiao-radio/meshcore-uart1.patch
T
Jean-Pierre MartineauandClaude Opus 4.8 077742868a scripts/xiao-radio: PicoCalc XIAO nRF52840 UART radio setup
Complete, reproducible bring-up for giving a PicoCalc (Luckfox Lyra, Calculinux) a
MeshCore radio via a Seeed XIAO nRF52840 + Wio-SX1262 on the Lyra's hardware UART1:

  - README.md    -- parts, wiring, build -> flash -> setup, the why, troubleshooting
  - build-firmware.sh  -- clone + patch MeshCore, build the _usb env, emit the .uf2
  - flash.py           -- flash the .uf2 via the XIAO UF2 bootloader (Win/Linux/Mac)
  - lyra-setup.sh      -- boot-persistent UART1->GP4/GP5 mux service, dialout, profile
  - uart1-mux.py       -- the RK3506 matrix-IO register poke that routes UART1
  - meshcore-uart1.patch -- the two firmware edits (Serial1 bind; I2C off D6/D7)

The two firmware edits are both required: bind the companion to hardware UART1
(Serial1 = D6/D7) instead of USB, and move I2C off D6/D7 (MeshCore maps it there and
sensors.begin() would otherwise seize the UART pins). Also documented in the top-level
scripts/README.md alongside the Calculinux and uConsole-SPI targets.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-31 02:02:48 -04:00

30 lines
1.1 KiB
Diff

diff --git a/examples/companion_radio/main.cpp b/examples/companion_radio/main.cpp
index ef9b6bf..020c746 100644
--- a/examples/companion_radio/main.cpp
+++ b/examples/companion_radio/main.cpp
@@ -159,7 +159,8 @@ void setup() {
#ifdef BLE_PIN_CODE
serial_interface.begin(BLE_NAME_PREFIX, the_mesh.getNodePrefs()->node_name, the_mesh.getBLEPin());
#else
- serial_interface.begin(Serial);
+ Serial1.begin(115200); // companion protocol over hardware UART1 (D6=TX, D7=RX)
+ serial_interface.begin(Serial1);
#endif
the_mesh.startInterface(serial_interface);
#elif defined(RP2040_PLATFORM)
diff --git a/variants/xiao_nrf52/platformio.ini b/variants/xiao_nrf52/platformio.ini
index a085433..065b617 100644
--- a/variants/xiao_nrf52/platformio.ini
+++ b/variants/xiao_nrf52/platformio.ini
@@ -26,8 +26,8 @@ build_flags = ${nrf52_base.build_flags}
-D SX126X_DIO3_TCXO_VOLTAGE=1.8
-D SX126X_CURRENT_LIMIT=140
-D SX126X_RX_BOOSTED_GAIN=1
- -D PIN_WIRE_SCL=D6
- -D PIN_WIRE_SDA=D7
+ -D PIN_WIRE_SCL=16
+ -D PIN_WIRE_SDA=17
-D PIN_USER_BTN=PIN_BUTTON1
-D DISPLAY_CLASS=NullDisplayDriver
build_src_filter = ${nrf52_base.build_src_filter}