Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

802.15.4 HIL updates; nRF52840 IEEE 802.15.4 Driver Updates #3995

Merged
merged 11 commits into from
Jun 5, 2024

Conversation

bradjc
Copy link
Contributor

@bradjc bradjc commented May 17, 2024

Pull Request Overview

This pull request is a pass over the nRF52840 15.4 driver. The changes are fairly well encapsulated in commits, but listed here:

  • Implement the config and power callbacks with a deferred call.
  • Do not enter RX mode on init. RX mode is entered on start(). Otherwise the radio is always on, even if nothing is using it.
  • Change constants to defines in the HIL.
  • Remove setting RX and TX addresses as these functions were not doing anything and this support does not exist in the hardware.
  • Change the catch for a "too long" packet to just set the 8th bit of the length to 0. This avoids both dropping the packet and any buffer index errors.
  • Pass the ACK transmission error to the callback instead of the CRC result. Also rename the CRC variable. Also we know the CRC passed if we sent an ACK, so no need to check in the second RX case.
  • Return OFF error if try to TX when radio is off.
  • Format comments

This required some changes to the constants in the HIL.

  • Add PHR_SIZE and PHR_OFFSET.
  • Remove MIN_MHR_SIZE as it is incorrect (should be 7, as the minimum PHR is 9, and the MFR is 2, so that leaves 7).
  • Add comments.

Testing Strategy

Need to do this.

TODO or Help Wanted

n/a

Documentation Updated

  • Updated the relevant files in /docs, or no updates are required.

Formatting

  • Ran make prepush.

@github-actions github-actions bot added nrf Change pertains to the nRF5x family of MCUs. HIL This affects a Tock HIL interface. WG-Network In the purview of the Network working group. labels May 17, 2024
@bradjc bradjc mentioned this pull request May 20, 2024
26 tasks
chips/nrf52840/src/ieee802154_radio.rs Show resolved Hide resolved
chips/nrf52840/src/ieee802154_radio.rs Outdated Show resolved Hide resolved
return Err((ErrorCode::BUSY, buf));
} else if radio::PSDU_OFFSET + frame_len >= buf.len() {
} else if buf.len() < radio::PSDU_OFFSET + frame_len + radio::MFR_SIZE {
// Not enough room for CRC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Not enough room for CRC
// Provided buffer does not have adequate space.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems less clear to me.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only mentioning the CRC here is inaccurate since it may be that there is not enough room for the PHR or that there is not enough room for the CRC. Perhaps updating then to:
// Not enough room for CRC and/or PHR.

@@ -1298,24 +1349,24 @@ impl<'a> kernel::hil::radio::RadioData<'a> for Radio<'a> {
buf: &'static mut [u8],
frame_len: usize,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not entirely sure what the correct name is for this, but once again, frame_len seems somewhat misleading here since the frame does not contain the CRC here (that is to be added by hardware). There may not be a better name for this.

bradjc and others added 11 commits May 23, 2024 16:56
No address filtering for nrf52840 in 15.4 mode.
Calling `radio_initialize()` in the HIL::init function puts the radio in
to RX mode. That means the radio is on unconditionally in any board that
includes the 15.4. The HIL::start() function should be used to start the
radio and put it in RX mode.
Avoid an issue where the radio is off but the state is not.
This matches the HIL and the rf233
Co-authored-by: Tyler Potyondy <77175673+tyler-potyondy@users.noreply.github.com>
@bradjc bradjc force-pushed the nrf52840-ieee802154-updates branch from f722b2d to 9479df2 Compare May 23, 2024 20:59
@bradjc
Copy link
Contributor Author

bradjc commented Jun 5, 2024

Is this waiting on me?

@ppannuto ppannuto added this pull request to the merge queue Jun 5, 2024
Merged via the queue into master with commit 690848d Jun 5, 2024
18 checks passed
@ppannuto ppannuto deleted the nrf52840-ieee802154-updates branch June 5, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
HIL This affects a Tock HIL interface. nrf Change pertains to the nRF5x family of MCUs. WG-Network In the purview of the Network working group.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants