zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
177 stars 87 forks source link

Force TX after CCA failure on EZSP v7+ #576

Closed puddly closed 12 months ago

puddly commented 12 months ago

EMBER_VALUE_FORCE_TX_AFTER_FAILED_CCA_ATTEMPTS seems to work in the latest Gecko SDK release! This allows the radio to force a transmit, even after CCA failures.

Normally this sounds like a bad idea but the alternative is to allow the radio to silently fail with a generic "delivery error" (TODO: figure out a way to infer the actual error code).

codecov[bot] commented 12 months ago

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (f52d73e) 99.77% compared to head (e0ce7d9) 99.77%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## dev #576 +/- ## ======================================= Coverage 99.77% 99.77% ======================================= Files 67 67 Lines 4837 4855 +18 ======================================= + Hits 4826 4844 +18 Misses 11 11 ``` | [Files Changed](https://app.codecov.io/gh/zigpy/bellows/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy) | Coverage Δ | | |---|---|---| | [bellows/ezsp/config.py](https://app.codecov.io/gh/zigpy/bellows/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy#diff-YmVsbG93cy9lenNwL2NvbmZpZy5weQ==) | `100.00% <100.00%> (ø)` | | | [bellows/ezsp/protocol.py](https://app.codecov.io/gh/zigpy/bellows/pull/576?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=zigpy#diff-YmVsbG93cy9lenNwL3Byb3RvY29sLnB5) | `97.56% <100.00%> (+0.26%)` | :arrow_up: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

puddly commented 12 months ago

It appears that this change is compatible with many more versions of EmberZNet than I thought: reading the value with getValue fails with EzspStatus.ERROR_INVALID_ID, but the write will still succeed. I've confirmed that the CCA bypassing works as far back as EmberZNet 7.1.1.0, and I'm sure previous releases too, meaning this PR will affect most modern EZSP adapters.

puddly commented 12 months ago

And with the adapter in a noisy environment, here are some traffic captures:

With CCA bypass (coordinator responds to beacon request)

image

Without CCA bypass (coordinator doesn't respond)

image

A device was only able to join (successfully might I add) in the first capture.

MattWestb commented 12 months ago

Great finding and work done our master HACKER !!!!