Use hardware channel activity detection for checking interference#1727
Use hardware channel activity detection for checking interference#1727weebl2000 wants to merge 4 commits intomeshcore-dev:devfrom
Conversation
|
Ok now this is very interesting. My house has LOS to 4 high level repeaters. I'll test this when I get back from work and see what happens. reminds me of busy channel lockout in shared 2 way radio repeaters back in the day before LTR / trunking. Could be onto something here for sure. |
214a0a0 to
bc39bcc
Compare
75da5d5 to
8bd55b6
Compare
581e805 to
40ab8ea
Compare
|
I like your implementation. :-) Using hardware CAD instead of the broken RSSI approach is the right direction. One concern: repurposing interference_threshold as the CAD enable flag is a code smell. The field originally carried a numeric RSSI threshold, now it's overloaded as a boolean for a different feature. A threshold of 50 and 1 mean the same thing, which is surprising. Given that RSSI-based detection is effectively dead code at this point, why not just remove interference_threshold entirely and enable CAD unconditionally? That would simplify the config, eliminate the semantic confusion, and make the intent clear. |
|
Isn't this very like CSMA/CD, like on classic Ethernet? Or CSMA/CA, if a pre-calculated timer is used per node? |
40ab8ea to
acbc02f
Compare
|
Its running here. First feelings in a busy mesh is that access my repeater is smooth, also send a message in public is running smooth. I will try it longer and see if it stay the same Day 2 and still happy with this patch add to 1.14.1 |
acbc02f to
d7087bc
Compare
|
Thank you very much for implementing CAD! I tested simultaneous 2-node DM — sharing results & observations Test environment: ---Baseline (CAD disabled, default): Test 1-char DM, one-way 150-char DM, one-way 1-char channel msg, one-way 1-char channel msg, simultaneous 1-char DM, simultaneous 150-char DM, simultaneous ---With CAD enabled (this PR): Test 1-char DM, simultaneous (run 1) 1-char DM, simultaneous (run 2) 150-char DM, simultaneous (run 1) 150-char DM, simultaneous (run 2) Observations: CAD clearly helps for short messages. 1-char simultaneous DM improved dramatically — one side gets through quickly (~5s) while the other waits and eventually delivers (~27-52s). 150-char simultaneous DM fails consistently. The retry pattern is: 4 retries at ~1min 5sec intervals via direct path, then 5th retry switches to flood path. The flood path switch appears to make things worse, not better — both nodes fail at ~7min. Flood path collision. When direct path fails and falls back to flood, both nodes flood simultaneously — same collision pattern observed in channel message simultaneous test (never delivered). Suggestion: Adding a small random backoff (e.g. 0-500ms) before each retry attempt would break the synchronized collision loop. This is especially important for multi-packet messages where collision opportunities multiply with each packet fragment. Thank you for reading! |
Following up on the suggestion above about random backoff — I implemented it and tested with Japan LoRa settings (SF12/BW125/CR4/8). Long random backoff (8000-22000ms) when channel is busy These values are likely too large for US/EU regions with faster LoRa settings. But for Japan SF12, backoff must exceed single message air time to break the collision loop. |
|
Yeah, it seems to perform worse on long messages with this PR to me. We have a dense mesh at SF7, 62,5 kHz here, with lots of in-band noise from telemetry and whatnot. |
|
Every 6 to 12 hours over a three-day period, I divided the received packets on corrupted. The correlation is linear and evens out over time. Standard "int.thresh 6" based on RSSI, showed a received/damaged ratio of 5.8–6. With new "hardware" measurement system, the ratio was 3.7–4. I performed measurements on the same node and antenna. I don’t know if damaged packet ratio is a good indicator of how well the int.thresh function works, but my observations show that the RSSI measurement works better. |
d7087bc to
dc9e6ae
Compare
|
Updating my earlier comments in light of subsequent work. After testing CAD + random backoff (reported above), I went further and Key findings comparing the two approaches: CAD (this PR)
RSSI-based LBT (PR #2218 approach)
Note: the 150-char simultaneous DM result (91% success) reported in my @YSOFF's observation (RSSI ratio 5.8–6 vs CAD 3.7–4 favoring RSSI) is For Japan regulatory mode, I ended up removing CAD entirely — RSSI alone Jitter (0–500ms on free channel detection) prevents two nodes that For DMs, the picture is more nuanced. Direct DMs with a known path make Finally, the ACK timeout retry interval itself is not randomized — nodes |
|
How is this different than this check that's already being performed before transmit? MeshCore/src/helpers/radiolib/CustomSX1268.h Lines 81 to 85 in bfd4800 |
|
@beala The RX interrupt is sluggish because it waits for the modem’s synchronization pipeline to confidently 'lock' onto a preamble (typically requiring 4+ symbols), whereas hardware CAD is a proactive, high-speed correlation scan that can detect activity in as little as one or two symbols. Just give it a shot! :-) You’ll see, it feels much better. |
… checking interference
… checking interference
|
I strongly suggest to rename the config parameter for the feature suggested in this pull request from
I strongly suggest to rename this setting to something different to avoid confusion when reading documentations and to not lead to undesired behaviour if people flash from one firmware variant to another and have modified that setting before. Suggestion: Rename it to Regards! |
|
@dreirund Agreed that
Suggestion: It maps directly to what the hardware does (Channel Activity Detection), makes the boolean nature explicit, and carries no legacy baggage from the old RSSI threshold semantics. |
|
I would like to share two videos from our MeshCore test bench (1 companion + 8 repeaters), illustrating the difference between stock firmware 1.15.0 (txdelay 0.5, rxdelay 0, int.thresh 0) and a patched build with this PR applied and HW CAD enabled. Simultaneous TX LED activity indicates a collision. In the second video with HW CAD enabled, the TX LEDs resemble an orchestrated chaser rather than simultaneous bursts. I am aware that some regions (Japan?) mandate LBT compliance. For that reason I would argue that LBT should not be removed but that HW CAD should be added as a complementary option alongside it. mc-firmware-1.15.0-default-settings.mp4mc-firmware-1.15.0syssi-hw-cad-enabled.mp4 |
|
That's a nice test that demonstrates the usefulness! 🎉 Regarding the different cli commands: I'm all for changing things, but let's first see if this is something that will be taken into dev before I make the changes. :) @liamcottle - thoughts on this one? |
dc9e6ae to
2db6d4e
Compare
Wouldn't a fair comparison be to have
What I read in the repevant pull request, it seems also a feature that could be kept and used alongside, also manually activateable for any region. How does it differ from the current |
CAD can simply be enabled, or the firmware could even be shipped with HW CAD active by default, no additional configuration needed. In contrast, int.thresh requires careful selection of a threshold value to work correctly. In my experience, this makes HW CAD lower-maintenance and a better default than the current one, as illustrated by the videos above, which does not work well. That said, whether |
|
On Thu, 30 Apr 2026 06:42:59 -0700, @syssi wrote:
> How does it differ from the current int.thresh implementation?
CAD can simply be enabled, or the firmware could even be shipped with HW-CAD active by default, no additional configuration needed. In contrast, int.thresh requires careful selection of a threshold value to work correctly.
|
|
Your question might be a better fit for #2218. Would you mind reposting it there? |
Can you also test with "set txdelay 0" because collision is less possible. |
Using RSSI isn't very reliable (it's disabled in the code for a reason). We might try hw channel activity detection. Since we are gonna TX anyway it shouldn't be too bad to listen for a few milliseconds first. Worst case we see there is a transmission and we wait a little while. Alternative is that we just TX anyway and intefere with others causing transmission collisions.
Would be great if people could test this on their repeaters & companions and see if TX becomes more reliable.
You can build firmware for you device using https://mcimages.weebl.me?commitId=use-hardware-channel-activity-detection
First impressions after flashing this on one of my repeaters that is high up & exposed to a lot of other repeaters is that it responds a little more consistently. Sometimes it's snappier, but often times it's slightly slower but it fails way less. I.e. less failed status requests & non-answered commands.