diff --git a/scripts/README.md b/scripts/README.md index 1872fb2..3b1719e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,12 +1,15 @@ # scripts -Device-side helpers for running MeshTerm on real hardware. Two independent targets -live here, each self-contained: +Device-side helpers for running MeshTerm on real hardware. Independent, self-contained +targets live here: - **Calculinux device** (Luckfox Lyra / ClockworkPi PicoCalc) — one-time bring-up and the console font. +- **XIAO nRF52840 UART radio** ([`xiao-radio/`](xiao-radio/)) — wire a Seeed XIAO + + Wio-SX1262 to the Lyra's hardware UART and run MeshTerm against it. Full build → flash → + setup guide with scripts. This is the way to give a PicoCalc a real MeshCore radio. - **SPI-attached radio bridge** (`meshterm-spi-bridge`) — expose a bare SPI LoRa chip - to MeshTerm as if it were a companion device. + to MeshTerm as if it were a companion device (uConsole AIO, Waveshare HATs). ## Calculinux device (Luckfox Lyra / ClockworkPi PicoCalc) @@ -37,6 +40,25 @@ Two prerequisites the setup script checks for but cannot embed: Both scripts are POSIX `sh`, idempotent, and safe to re-run. +## XIAO nRF52840 UART radio — give a PicoCalc a real radio + +A **Seeed XIAO nRF52840 + Wio-SX1262** wired to the Luckfox Lyra's hardware UART1, running +MeshCore companion firmware over `Serial1` (D6/D7). MeshTerm talks to it directly on +`/dev/ttyS1` — no bridge process. Everything (parts, wiring, firmware build/flash, device +setup, the *why*) is in [`xiao-radio/README.md`](xiao-radio/), with scripts for each step: + +| Script | Runs on | What it does | +|---|---|---| +| [`xiao-radio/build-firmware.sh`](xiao-radio/build-firmware.sh) | dev machine | clone + patch MeshCore, build the `_usb` env, emit the `.uf2` | +| [`xiao-radio/flash.py`](xiao-radio/flash.py) | dev machine | flash the `.uf2` to the XIAO via its UF2 bootloader | +| [`xiao-radio/lyra-setup.sh`](xiao-radio/lyra-setup.sh) | the Lyra (root) | boot-persistent UART1→GP4/GP5 mux service, `dialout`, default MeshTerm profile | +| [`xiao-radio/uart1-mux.py`](xiao-radio/uart1-mux.py) | the Lyra | the matrix-IO register poke that routes UART1 to the header pads | + +Two things this depends on, both handled by the patch/guide: the firmware must bind the +companion to `Serial1` **and** move I²C off D6/D7 (MeshCore maps it there and it steals the +UART pins); and MeshTerm must include the platform-UART liveness fix (`serial_port_present` +treats a soldered `/dev/ttyS1` as present). + ## meshterm-spi-bridge — expose an SPI-attached radio Some boards wire the LoRa chip straight to the host's SPI bus — the ClockworkPi diff --git a/scripts/xiao-radio/README.md b/scripts/xiao-radio/README.md new file mode 100644 index 0000000..1776fa2 --- /dev/null +++ b/scripts/xiao-radio/README.md @@ -0,0 +1,145 @@ +# PicoCalc mesh radio — XIAO nRF52840 over UART + +Give a **PicoCalc (Luckfox Lyra, Calculinux)** a real MeshCore LoRa radio by wiring a +**Seeed XIAO nRF52840 + Wio‑SX1262** to the Lyra's hardware UART and running MeshTerm +against it. No BLE, no USB host, no SD‑slot sacrifice, and — with the firmware fixed the +right way — **no re‑soldering dead ends.** + +``` + MeshTerm ──serial──> /dev/ttyS1 ──UART1 (GP4/GP5)──> XIAO Serial1 (D6/D7) ──> SX1262 ──))) mesh + (on the Lyra) 115200 8N1 matrix‑IO mux companion fw +``` + +Three steps: **build firmware → flash the XIAO → set up the Lyra.** Each has a script. + +--- + +## 1. Hardware + +### Bill of materials +- **Seeed XIAO nRF52840** (plain or **Sense**) stacked with the **Wio‑SX1262** LoRa module + (the SX1262 uses XIAO pins D1–D5, D8–D10 — already wired inside the kit; nothing to do). +- **Luckfox Lyra** in *Pico* form factor (RK3506, SD‑boot), running **Calculinux** inside a + **ClockworkPi PicoCalc**. +- Four wires. + +### Wiring — four connections +The XIAO's free UART pins go to the PicoCalc's Pico‑style header. **Crossed** TX/RX: + +| XIAO pad | → | Lyra header | Physical pin | Carries | +|---|---|---|---|---| +| **D7** (Serial1 RX) | → | **GP4** | pin **6** | Lyra UART1 **TX** → XIAO RX | +| **D6** (Serial1 TX) | → | **GP5** | pin **7** | XIAO **TX** → Lyra UART1 RX | +| **GND** | → | **GND** | pin **8** | common ground | +| **3V3** | → | **3V3 OUT** | pin **36** | power (so it runs without USB) | + +> ⚠️ **The Lyra does *not* use Raspberry Pi Pico GPIO numbering.** The 40‑pin header is +> physically Pico‑compatible, but each pad's function is Luckfox's own RK3506 mapping. The +> pins above are verified: GP4 = `gpio0-0`, GP5 = `gpio0-1`. Don't trust a Pico pinout for +> anything else here. + +All signals are 3.3 V — no level shifter. There is **no 5 V rail** on this board; power the +XIAO from 3V3 only. + +--- + +## 2. Build the firmware *(on your dev machine)* + +Needs `git` and PlatformIO (`pip install platformio`). + +```bash +cd scripts/xiao-radio +sh build-firmware.sh +``` + +This clones MeshCore, applies [`meshcore-uart1.patch`](meshcore-uart1.patch), builds the +`Xiao_nrf52_companion_radio_usb` environment, and writes **`meshcore-xiao-radio.uf2`**. + +The patch makes two changes that are *both* required (see [Why](#why-it-works)): +- binds the companion protocol to **hardware UART1** (`Serial1`, D6/D7) instead of USB; +- moves the **I²C bus off D6/D7** (to internal pins 16/17) so it can't steal the UART pins. + +--- + +## 3. Flash the XIAO *(on your dev machine)* + +Plug the **XIAO's own USB‑C** into your computer (it may stay wired to the Lyra). + +```bash +python flash.py +``` + +It triggers the bootloader and copies the firmware. If it can't, **double‑tap the XIAO's +reset button** (it mounts as the `XIAO-SENSE` drive) and re‑run. + +Sanity check: after flashing, the XIAO's USB serial port goes **silent to the companion +protocol** — because the companion now lives on D6/D7, not USB. That silence is correct. + +--- + +## 4. Set up the Lyra *(on the device, as root)* + +Copy `scripts/` to the Lyra and run: + +```bash +sh scripts/xiao-radio/lyra-setup.sh # MT_USER=meshterm by default +``` + +It installs a **systemd service** that routes UART1 → GP4/GP5 on every boot, adds your user +to `dialout`, and writes a default MeshTerm serial profile for `/dev/ttyS1`. + +--- + +## 5. Run it + +```bash +meshterm +``` + +With the default profile in place, plain `meshterm` connects straight to the radio. You +should see your node come up (ours reports as `Johnputer-Pico`). + +--- + +## Why it works *(the short version)* + +Everything below was the hard part; the scripts encode the answers so you don't repeat it. + +- **Calculinux never wires UART1 to a pad.** The controller is enabled (so `/dev/ttyS1` + exists) but reaches no pin. The RK3506 *matrix IO* can carry UART1 on almost any pad, so + [`uart1-mux.py`](uart1-mux.py) pokes two register groups over `/dev/mem` to put UART1‑TX on + `gpio0-0` (GP4) and UART1‑RX on `gpio0-1` (GP5). No SD slot is sacrificed (the stock UART1 + pads are the front SD‑card slot — we avoid them entirely). +- **MeshCore maps I²C onto D6/D7 on the XIAO.** `XiaoNrf52Board::begin()` *and* + `sensors.begin()` call `Wire` on those exact pins, so the I²C peripheral seizes them and the + UART goes silent — even with perfect wiring. The patch moves I²C to the internal IMU pins + (16/17). This was the single reason the link stayed dead through every other fix. +- **MeshTerm liveness for soldered UARTs.** pyserial's `comports()` doesn't enumerate + platform‑bus ports like `/dev/ttyS1`, so MeshTerm's liveness poll would falsely report the + radio unplugged. MeshTerm now treats an existing `/dev` character device as present + (`serial_port_present` in `meshterm/core/connection.py`) — so **use a MeshTerm build that + includes that fix.** + +--- + +## Troubleshooting + +| Symptom | Check | +|---|---| +| `meshterm` can't open the port | Is `MT_USER` in `dialout`? (`groups`) — needs a fresh login after setup. | +| Port opens but no node / silence | Re‑flash with the **`_usb`** firmware (not `_ble`); the BLE build ignores Serial1. Confirm the XIAO's USB serial is *silent* to companion frames. | +| Still silent, wiring confirmed | Confirm the firmware has the **I²C‑remap** patch (`PIN_WIRE_SCL=16`, `PIN_WIRE_SDA=17`). | +| Nothing on `/dev/ttyS1` after reboot | `systemctl status uart1-radio-mux` — the mux must run each boot. | +| Verify the raw link, as root | Route the mux, open `/dev/ttyS1` @115200, send an `APP_START` frame (`3c 0e 00 01` + 7×`00` + name); a good radio replies with a `>`‑framed `05` (SELF_INFO). | + +### Updating MeshCore +`build-firmware.sh` pins a tested commit. To track upstream, run it with +`MESHCORE_COMMIT=main`; if the patch no longer applies cleanly, re‑apply the two edits in +[`meshcore-uart1.patch`](meshcore-uart1.patch) by hand — they're two hunks. + +--- + +## Optional: reach the radio from other machines (TCP) +The direct‑serial path above is for MeshTerm **on the PicoCalc itself**. If you also want the +radio on your LAN (`meshterm --tcp :5000` from a laptop), add a UART↔TCP pump in +front of `/dev/ttyS1`. That's a separate, optional piece and is not required for on‑device use. diff --git a/scripts/xiao-radio/build-firmware.sh b/scripts/xiao-radio/build-firmware.sh new file mode 100644 index 0000000..3b64cda --- /dev/null +++ b/scripts/xiao-radio/build-firmware.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# build-firmware.sh -- build the XIAO nRF52840 MeshCore radio firmware for the PicoCalc. +# +# Runs on your DEV MACHINE (not the Lyra). Produces a single .uf2 you flash with flash.py. +# +# What it does: +# 1. clones MeshCore (pinned to a tested commit) if you don't already have it +# 2. applies meshcore-uart1.patch -- the two changes that make this work: +# * bind the companion protocol to hardware UART1 (Serial1 = D6/D7) instead of USB +# * move the I2C bus OFF D6/D7 (to internal pins 16/17) so it can't seize the UART pins +# 3. builds the companion_radio_usb environment +# 4. converts the .hex to .uf2 +# +# Prerequisites: git, and PlatformIO CLI on PATH (`pio`). Install pio with: +# pip install platformio +# +# Usage: +# sh build-firmware.sh # clone+build into ./_meshcore-build +# MESHCORE_DIR=/path/to/MeshCore sh build-firmware.sh # use an existing checkout +# +set -eu + +HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +PATCH="$HERE/meshcore-uart1.patch" +MC="${MESHCORE_DIR:-$HERE/_meshcore-build}" +ENV=Xiao_nrf52_companion_radio_usb +# Commit this patch was cut against. Newer MeshCore may need the two edits re-applied by hand +# (see README "Updating"). Override with MESHCORE_COMMIT= to track upstream. +PIN="${MESHCORE_COMMIT:-03b6ef4}" + +command -v git >/dev/null 2>&1 || { echo "ERROR: git not found"; exit 1; } +command -v pio >/dev/null 2>&1 || command -v platformio >/dev/null 2>&1 || { + echo "ERROR: PlatformIO CLI (pio) not found. Install with: pip install platformio"; exit 1; } +PIO=$(command -v pio 2>/dev/null || command -v platformio) + +if [ ! -d "$MC/.git" ]; then + echo ">> cloning MeshCore into $MC" + git clone https://github.com/meshcore-dev/MeshCore.git "$MC" +fi + +echo ">> checkout $PIN + apply patch" +git -C "$MC" fetch --quiet --tags origin 2>/dev/null || true +git -C "$MC" checkout -f "$PIN" 2>/dev/null || { + echo " (pinned commit not found; using current checkout)"; } +git -C "$MC" apply "$PATCH" +echo " applied meshcore-uart1.patch" + +echo ">> building $ENV (first build downloads the nRF52 toolchain; be patient)" +( cd "$MC" && "$PIO" run -e "$ENV" ) + +HEX="$MC/.pio/build/$ENV/firmware.hex" +UF2CONV="$MC/bin/uf2conv/uf2conv.py" +OUT="$HERE/meshcore-xiao-radio.uf2" +echo ">> converting to uf2" +python "$UF2CONV" "$HEX" -c -f 0xADA52840 -o "$OUT" + +echo "" +echo "DONE. Firmware: $OUT" +echo "Next: put the XIAO in bootloader (double-tap reset) and run: python flash.py" diff --git a/scripts/xiao-radio/flash.py b/scripts/xiao-radio/flash.py new file mode 100644 index 0000000..d7c921b --- /dev/null +++ b/scripts/xiao-radio/flash.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +"""Flash the built .uf2 onto the XIAO nRF52840 via its UF2 bootloader. + +Runs on your DEV MACHINE with the XIAO's own USB-C plugged into it. Works on +Windows / Linux / macOS. + +The XIAO enters bootloader mode either by a physical **double-tap of its reset button** +(it mounts as the ``XIAO-SENSE`` drive) or, if it is running app firmware that exposes a +serial port, by the automatic 1200-baud "touch" this script attempts first. + +Usage: + python flash.py # flash ./meshcore-xiao-radio.uf2 + python flash.py path/to/firmware.uf2 # flash a specific file +""" +import glob +import os +import sys +import time + +HERE = os.path.dirname(os.path.abspath(__file__)) + + +def find_uf2_drive(): + """Return the mount path of a UF2 bootloader volume, or None.""" + candidates = [] + if os.name == "nt": + import string + + candidates = ["%s:\\" % d for d in string.ascii_uppercase] + else: + for base in ("/media", "/run/media", "/mnt", "/Volumes"): + candidates += glob.glob(os.path.join(base, "*")) + candidates += glob.glob(os.path.join(base, "*", "*")) + for c in candidates: + try: + if os.path.exists(os.path.join(c, "INFO_UF2.TXT")): + return c + except OSError: + continue + return None + + +def touch_1200(): + """Best-effort: pulse any Seeed XIAO app serial port at 1200 baud to reset to bootloader.""" + try: + import serial + import serial.tools.list_ports as lp + except Exception: + return + for p in lp.comports(): + if "2886" in (p.hwid or ""): # Seeed Studio USB VID + try: + serial.Serial(p.device, 1200).close() + print(" sent 1200-baud bootloader touch to %s" % p.device) + time.sleep(0.3) + except Exception: + pass + + +def main(): + uf2 = sys.argv[1] if len(sys.argv) > 1 else os.path.join(HERE, "meshcore-xiao-radio.uf2") + if not os.path.exists(uf2): + sys.exit("ERROR: firmware not found: %s\n(run build-firmware.sh first)" % uf2) + + print(">> looking for XIAO bootloader drive ...") + drive = find_uf2_drive() + if not drive: + touch_1200() + for _ in range(30): + drive = find_uf2_drive() + if drive: + break + time.sleep(1) + if not drive: + sys.exit( + "ERROR: no UF2 bootloader drive found.\n" + "Double-tap the XIAO's reset button (it mounts as XIAO-SENSE), then re-run." + ) + + print(">> flashing %s -> %s" % (os.path.basename(uf2), drive)) + with open(uf2, "rb") as src: + data = src.read() + with open(os.path.join(drive, "firmware.uf2"), "wb") as dst: + dst.write(data) + dst.flush() + os.fsync(dst.fileno()) + + # the bootloader reboots into the app once written; the drive disappears + for _ in range(10): + if not os.path.exists(os.path.join(drive, "INFO_UF2.TXT")): + print("DONE. XIAO flashed and rebooting into the radio firmware.") + return + time.sleep(1) + print("DONE (copy complete). If it didn't reboot on its own, tap reset once.") + + +if __name__ == "__main__": + main() diff --git a/scripts/xiao-radio/lyra-setup.sh b/scripts/xiao-radio/lyra-setup.sh new file mode 100644 index 0000000..970e232 --- /dev/null +++ b/scripts/xiao-radio/lyra-setup.sh @@ -0,0 +1,91 @@ +#!/bin/sh +# lyra-setup.sh -- make the UART-attached XIAO radio work on the Luckfox Lyra (Calculinux). +# +# Runs ON THE DEVICE as root. Idempotent -- safe to re-run. +# +# 1. installs uart1-mux.py and a systemd oneshot that re-applies the UART1->GP4/GP5 pin +# routing on every boot (Calculinux leaves /dev/ttyS1 wired to no pad otherwise) +# 2. adds the MeshTerm user to the `dialout` group so it can open /dev/ttyS1 +# 3. writes a default MeshTerm serial profile pointing at /dev/ttyS1 +# +# The MeshTerm user defaults to `meshterm`; override with: MT_USER=youruser sh lyra-setup.sh +# +# Prereq: the XIAO must be flashed with the radio firmware (see build-firmware.sh / flash.py) +# and soldered per the README wiring table. +set -eu + +HERE=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +MT_USER="${MT_USER:-meshterm}" +MT_HOME=$(getent passwd "$MT_USER" 2>/dev/null | cut -d: -f6) +[ -n "$MT_HOME" ] || MT_HOME="/home/$MT_USER" +MUX_DST=/usr/local/bin/uart1-radio-mux.py +UNIT=/etc/systemd/system/uart1-radio-mux.service + +[ "$(id -u)" = 0 ] || { echo "ERROR: run as root"; exit 1; } +[ -e /dev/ttyS1 ] || { echo "ERROR: /dev/ttyS1 missing -- is UART1 enabled in the DT?"; exit 1; } + +echo ">> installing pin-mux helper -> $MUX_DST" +mkdir -p "$(dirname "$MUX_DST")" +cp "$HERE/uart1-mux.py" "$MUX_DST" +chmod 755 "$MUX_DST" + +echo ">> installing + enabling systemd service" +cat > "$UNIT" </dev/null 2>&1 || true +systemctl restart uart1-radio-mux.service +echo " $(systemctl is-enabled uart1-radio-mux.service) / $(systemctl is-active uart1-radio-mux.service)" + +echo ">> granting $MT_USER access to /dev/ttyS1 (dialout group)" +if id "$MT_USER" >/dev/null 2>&1; then + if groups "$MT_USER" 2>/dev/null | grep -qw dialout; then + echo " already in dialout" + else + usermod -aG dialout "$MT_USER" && echo " added (takes effect on next login of $MT_USER)" + fi +else + echo " WARN: user $MT_USER not found -- skipping dialout" +fi + +echo ">> default MeshTerm profile -> $MT_HOME/.meshterm/config.toml" +CFG="$MT_HOME/.meshterm/config.toml" +if [ -e "$CFG" ]; then + echo " config already exists -- leaving it untouched." + echo " To use the radio, ensure it contains a serial profile:" + echo ' default_profile = "picocalc"' + echo ' [profiles.picocalc]' + echo ' port = "/dev/ttyS1"' +else + mkdir -p "$(dirname "$CFG")" + cat > "$CFG" <<'EOF' +# MeshTerm configuration +# XIAO nRF52840 + Wio-SX1262 radio, reached over the Lyra hardware UART1 (/dev/ttyS1). +default_profile = "picocalc" + +[profiles.picocalc] +port = "/dev/ttyS1" +baudrate = 115200 +transport = "serial" +default_tx_power = 22 +description = "XIAO nRF52840 + SX1262 via Lyra UART1 on GP4/GP5" +EOF + chown -R "$MT_USER:$MT_USER" "$(dirname "$CFG")" 2>/dev/null || true + echo " written." +fi + +echo "" +echo "DONE. Verify the radio answers:" +echo " su - $MT_USER -c 'meshterm'" +echo "(the mux is now active and will re-apply on every boot)" diff --git a/scripts/xiao-radio/meshcore-uart1.patch b/scripts/xiao-radio/meshcore-uart1.patch new file mode 100644 index 0000000..b5ca61a --- /dev/null +++ b/scripts/xiao-radio/meshcore-uart1.patch @@ -0,0 +1,29 @@ +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} diff --git a/scripts/xiao-radio/uart1-mux.py b/scripts/xiao-radio/uart1-mux.py new file mode 100644 index 0000000..eb7b2d8 --- /dev/null +++ b/scripts/xiao-radio/uart1-mux.py @@ -0,0 +1,54 @@ +#!/usr/bin/env python3 +"""Route the RK3506 UART1 controller to the PicoCalc header pads GP4/GP5. + +Calculinux enables the UART1 controller (so ``/dev/ttyS1`` exists) but never wires it to any +physical pad. The RK3506 "matrix IO" can carry UART1 on almost any pad; this poke selects it +on gpio0-0 (TX) and gpio0-1 (RX), which are the PicoCalc header holes GP4 and GP5 — where the +XIAO's D7 (RX) and D6 (TX) are soldered. + +Two register groups, both write-masked (high 16 bits = write-enable mask): + + * RMIO signal select @ 0xff910080 + pin*4 -> uart1-tx = 0x01, uart1-rx = 0x02 + (the signal id is the pinctrl "func" value minus 0x0f; verified against 8 live pins) + * primary iomux @ 0xff950000 + (pin//4)*4, 4-bit field (pin%4)*4 -> matrix mode = 7 + +Run as root, every boot (installed as the ``uart1-radio-mux`` systemd service by +``lyra-setup.sh``). Idempotent. After it runs, the XIAO radio is reachable at +``/dev/ttyS1`` @ 115200 8N1. +""" +import mmap +import os +import struct + +RMIO = 0xFF910000 # matrix-IO signal-select block +PMU = 0xFF950000 # gpio0 primary iomux block (PMU IOC) + +# gpio0-0 = RM_IO0 = PicoCalc GP4 (wired to XIAO D7 / UART RX) -> carry UART1 TX +# gpio0-1 = RM_IO1 = PicoCalc GP5 (wired to XIAO D6 / UART TX) -> carry UART1 RX +UART1_TX_SIG = 0x01 +UART1_RX_SIG = 0x02 + + +def poke(addr: int, value: int) -> None: + page = addr & ~0xFFF + off = addr - page + fd = os.open("/dev/mem", os.O_RDWR | os.O_SYNC) + try: + mm = mmap.mmap(fd, 0x1000, offset=page) + try: + mm[off : off + 4] = struct.pack(" None: + poke(RMIO + 0x80 + 0 * 4, (0x7F << 16) | UART1_TX_SIG) # gpio0-0 -> UART1 TX + poke(RMIO + 0x80 + 1 * 4, (0x7F << 16) | UART1_RX_SIG) # gpio0-1 -> UART1 RX + poke(PMU + 0x00, (0xFF << 16) | 0x77) # iomux pins 0,1 -> matrix mode (7) + print("UART1 routed to GP4/GP5 -> radio on /dev/ttyS1 @115200") + + +if __name__ == "__main__": + main()