-
Notifications
You must be signed in to change notification settings - Fork 651
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
base: master
Are you sure you want to change the base?
Conversation
let lqi = rbuf[data_len]; | ||
|
||
// We drop the CRC bytes (the MFR) from our frame. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are dropping the CRC, I do not think this should be called frame_len
since the MFR is technically part of the frame.
edit: this linked to line 854 when it should be to 855 the line below
let frame_len = data_len - radio::MFR_SIZE;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you recommend? That variable is there from before.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps changing this to buffer_len
? buffer_len
too feels suboptimal.
This gets at the issue with needing this field to be passed up the stack to denote the active length since we are passing the entire unused buffer upwards (so that it can later be reset by framer). These issues all seem like they would be solved by using a subslice
. Is there a reason that we did not originally do this? In my opinion it seems the radio driver itself should be the only entity setting/resetting the receive buffer it interacts with (not the framer or some other "higher" element).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This gets at the issue with needing this field to be passed up the stack to denote the active length since we are passing the entire unused buffer upwards (so that it can later be reset by framer). These issues all seem like they would be solved by using a
subslice
. Is there a reason that we did not originally do this? In my opinion it seems the radio driver itself should be the only entity setting/resetting the receive buffer it interacts with (not the framer or some other "higher" element).
The first 15.4 code was probably written before subslice/leasablebuffer existed.
I agree this should use subslice. But, the stack needs to edit both the start and end of the buffer, and that is more complex than many use cases. It sounded like the networking WG was thinking about that.
I would like to see the stack be clarified, and then updated to subslice once we have a good story for reserving space at the start of the buffer.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Not enough room for CRC | |
// Provided buffer does not have adequate space. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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, |
There was a problem hiding this comment.
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.
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>
f722b2d
to
9479df2
Compare
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:
OFF
error if try to TX when radio is off.This required some changes to the constants in the HIL.
PHR_SIZE
andPHR_OFFSET
.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).Testing Strategy
Need to do this.
TODO or Help Wanted
n/a
Documentation Updated
/docs
, or no updates are required.Formatting
make prepush
.