Make nrf52 15.4 driver standards compliant; create generic 15.4 component #1878
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.
Pull Request Overview
This pull request fixes #1806 by making several adjustments to the nrf52 ieee802.15.4 driver so that it sends packets which are valid according to the standard. It also creates a generic 15.4 component, and uses it to replace the chip-specific components used for the same purpose by Imix and nrf52dk_base.
The primary issue was that the existing 15.4 code is too specific to the rf233, including an assumption that frame buffers passed to the radio driver will begin the PSDU 2 bytes after the beginning of the buffer, because the first byte of the buffer is assumed to be used to hold a SPI command (an rf233 specific implementation detail). The existing driver avoided this problem by appending an extra header in hardware -- the s0 header -- which is not intended to be included when the multiprotocol radio is used for iee802.15.4. The s0 header made the on-air frames invalid, and caused correctly configured radios to drop the frames in hardware. The fix in this PR is to offset the DMA pointer given to the hardware by 1 rather than including an extra header that does not belong. A better fix would involve replacing all instances of
radio::PSDU_OFFSET
with a chip-specific reference to an associated constant, but that would be a much more involved change.I made several other changes to the 15.4 driver to fix obvious issues or to make the driver more closely match the driver used by RiotOS.
The generic component still has the issue that it is impossible to initialize a
MuxMac
without a 15.4 userspace driver, but I believe resolving that in a generic way will require some HIL changes so I am leaving it for another time.Testing Strategy
This pull request was tested using the libtock-c apps
examples/tests/ieee802154/radio_tx
andexamples/tests/ieee802154/radio_rx
and verifying that packets can be sent from Imix->Imix, Imix->nrf52840dk, nrf52840dk->Imix, and nrf52840dk->nrf52840dk.I also used a 15.4 packet sniffer to sniff packets sent by both an Imix and an nrf52840dk and verified that the packets appear identical. (before this PR the nrf packets would not be detected by a sniffer at all!)
TODO or Help Wanted
N/A
Documentation Updated
Formatting
make format
.make clippy
.