From 732bd18ac382ea6e52b1331c6e084aa765051da9 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Wed, 29 Apr 2026 14:21:09 -0600 Subject: [PATCH] fix(deps): pin lora-phy to swaits/lora-rs#fixed for sx127x/sx126x reliability Switch lora-phy from crates.io to the swaits/lora-rs "fixed" branch which carries three fixes awaiting upstream PR acceptance: - phy: sx127x: clear stale IRQ flags before reconfiguring DIO mapping in set_irq_params (fix/sx127x-irq-clear-position) - phy: sx127x: clear stale IRQ flags in do_rx before mode change (fix/sx127x-rx-irq-clear) - phy: sx126x: pre-command BUSY check + standby/IRQ-clear hygiene around CAD (fix/sx126x-busy-race) Validates TBeam classic (sx127x) in particular and tightens reliability across every board (the sx126x BUSY-race fix lands on every nRF/RP2040 board too). Pinned to commit e8a52ebd via Cargo.lock; revert to crates.io once the three PRs land upstream. --- Cargo.lock | 5 +++++ Cargo.toml | 6 +++--- TODO.md | 41 +++++++++++++++++++++++++---------------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a4ec3b3..06ad058 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1734,6 +1734,7 @@ dependencies = [ [[package]] name = "lora-modulation" version = "0.1.5" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" dependencies = [ "defmt 0.3.100", ] @@ -1741,6 +1742,7 @@ dependencies = [ [[package]] name = "lora-phy" version = "3.0.2-alpha" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" dependencies = [ "defmt 0.3.100", "document-features", @@ -1754,6 +1756,7 @@ dependencies = [ [[package]] name = "lorawan" version = "0.9.1" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" dependencies = [ "aes", "cmac", @@ -1765,6 +1768,7 @@ dependencies = [ [[package]] name = "lorawan-device" version = "0.12.2" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" dependencies = [ "defmt 0.3.100", "document-features", @@ -1779,6 +1783,7 @@ dependencies = [ [[package]] name = "lorawan-macros" version = "0.1.0" +source = "git+https://github.com/swaits/lora-rs.git?branch=fixed#e8a52ebd35352ce0267148fd392a0b1956d7735f" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index bd5bbde..af85070 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,9 +34,9 @@ ucobs = { version = "0.3", features = ["legacy-msrv"] } heapless = "0.9" donglora-protocol = "1" hsmc = { version = "0.5", default-features = false, features = ["embassy", "trace-defmt"] } -# Local path while iterating on CAD IRQ-clear / standby-after-CAD fixes. -# Switch back to git fork (then crates.io) once changes are upstreamed. -lora-phy = { path = "../../lora-rs/lora-phy", features = ["defmt-03"] } +# Fork branch carrying CAD IRQ-clear / standby-after-CAD fixes awaiting upstream PRs. +# Switch back to crates.io once changes are upstreamed. +lora-phy = { git = "https://github.com/swaits/lora-rs.git", branch = "fixed", features = ["defmt-03"] } portable-atomic = { version = "1", default-features = false, features = ["critical-section"] } static_cell = "2.1" diff --git a/TODO.md b/TODO.md index aab3a93..3cee0fa 100644 --- a/TODO.md +++ b/TODO.md @@ -1,30 +1,39 @@ # Firmware TODO List -## `lora-phy` fix: drop fork pin once PR #428 merges + releases +## `lora-phy` fix: drop fork pin once PRs #428 / #431 / #432 merge + release + +Upstream PRs (all open): + +- [#428 — *phy: add pre-command BUSY checks per Semtech + datasheets*](https://github.com/lora-rs/lora-rs/pull/428) (sx126x): + pre-command BUSY check + standby/IRQ-clear hygiene around CAD. +- [#431 — *phy: sx127x: clear stale IRQ flags in do_rx before mode + change*](https://github.com/lora-rs/lora-rs/pull/431). +- [#432 — *phy: sx127x: clear stale IRQ flags before reconfiguring DIO + mapping in set_irq_params*](https://github.com/lora-rs/lora-rs/pull/432). -Upstream PR: [lora-rs/lora-rs#428 — *phy: add pre-command BUSY checks -per Semtech datasheets*](https://github.com/lora-rs/lora-rs/pull/428) -(open). Fork branch we ship from: -[`swaits/lora-rs @ fix/sx126x-busy-race`](https://github.com/swaits/lora-rs/tree/fix/sx126x-busy-race). +[`swaits/lora-rs @ fixed`](https://github.com/swaits/lora-rs/tree/fixed) +— a merge of all three fix branches kept up-to-date with upstream +`main`. -Firmware consumes the fix via a direct `git` dependency in +Firmware consumes the fixes via a direct `git` dependency in `Cargo.toml`: ```toml -lora-phy = { git = "https://github.com/swaits/lora-rs.git", branch = "fix/sx126x-busy-race", features = ["defmt-03"] } +lora-phy = { git = "https://github.com/swaits/lora-rs.git", branch = "fixed", features = ["defmt-03"] } ``` -When PR #428 merges and a `lora-phy` release ships on crates.io that -contains it, switch this line back to a normal `lora-phy = "X.Y"` -crates.io version and drop the explanatory comment block above it. +When all three PRs merge and a `lora-phy` release ships on crates.io +that contains them, switch this line back to a normal +`lora-phy = "X.Y"` crates.io version and drop the explanatory comment +block above it. -Hardware-verified on Wio Tracker L1: 20/20 clean-boot TX after the fix -(vs ~50% before). The fix adds a pre-command BUSY check before each -`SpiInterface` read/write op, keeping the existing post-command wait -in place — belt-and-suspenders bracketing that closes the -BUSY-assertion latency window (T_SW ≤ 600 ns) a single level-poll can -miss. +Hardware impact: large stability gain on every board — the sx126x +BUSY-race fix lands on every nRF/RP2040 board, and the sx127x IRQ-clear +fixes unblock TBeam classic in particular. Hardware-verified on Wio +Tracker L1 (sx126x): 20/20 clean-boot TX after the fix (vs ~50% +before). ---