at86rf2xx: fix receive before send detection #12728
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Contribution description
The at86rf2xx radio handled a transfer complete condition with the radio in the BUSY_TX_ARET state as a finished transmission. This condition and state also occurs when a reception occurs just before switching to transmitting. This would cause a condition where first a TX_COMPLETE was
signalled and second a RX_COMPLETE was signalled. The network stack would then read the transmitted frame as a received frame.
The patch fixes the errornous RX callback by only submitting the TX_COMPLETE condition when there are at least 2 frames pending (at86rf2xx::pending_tx).
This should not impact packet loss with the radio. The frame received is also discarded without this patch.
The change set is not that big, it just appears big due to splitting out the tx complete handling from the
_isr()
call. Edit: splitted the tx complete refactor to a separate commit to ease reviewing.Testing procedure
The test as supplied with #11256 must pass.
examples/gnrc_networking
should work as usual on a samr21-xpro or on the iotlab-m3,Issues/PRs references
Fixes the issue described in #11256