Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/subsystem/mac/areq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ impl WSAsyncInd {
.read_exact(&mut data_payload)
.map_err(|_| Error::NotEnoughBytes)?;

let mut ie_payload = vec![0x00; data_length as usize];
let mut ie_payload = vec![0x00; ie_length as usize];
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The IE payload should have the IE length, not data length

cursor
.read_exact(&mut ie_payload)
.map_err(|_| Error::NotEnoughBytes)?;
Expand Down
4 changes: 3 additions & 1 deletion src/subsystem/mac/sreq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1478,10 +1478,12 @@ impl WSAsyncReq {
self.channels.encode_into(buffer);
}

// This frame's length is 0x1e, instead of 0x26 (as shown in the documentation). Check the link below for more information.
// https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1578237/launchxl-cc1352r1-wrong-length-for-mac_ws_async_req-command
pub fn into_mt_frame(self) -> MTFrame {
MTFrame {
header: MTHeader {
length: 0x26,
length: 0x1e,
Comment on lines 1484 to +1486
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

command: CommandCode {
is_extended: false,
cmd_type: CommandType::SREQ,
Expand Down
39 changes: 38 additions & 1 deletion src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,11 @@ impl Status {
}
}

// AddrNone value was added in order to handle AddressMode zeroed. Check the link below for more information.
// https://e2e.ti.com/support/wireless-connectivity/sub-1-ghz-group/sub-1-ghz/f/sub-1-ghz-forum/1570804/simplelink-cc13xx-cc26xx-sdk-dstaddrmode-is-zeroed-in-mac_ws_async_ind-packet
#[derive(Debug, FromPrimitive, PartialEq, Copy, Clone)]
pub enum AddressMode {
AddrNone = 0x00,
Addr16Bit = 0x02,
Addr64Bit = 0x03,
}
Expand Down Expand Up @@ -263,6 +266,7 @@ impl ExtendedAddress {

#[derive(Debug, PartialEq, Copy, Clone)]
pub enum Address {
AddrNone(ExtendedAddress),
Addr16Bit(ShortAddress),
Addr64Bit(ExtendedAddress),
}
Expand All @@ -272,11 +276,12 @@ impl Address {
let address_mode = AddressMode::try_decode(Read::by_ref(cursor))?;

let address = match address_mode {
AddressMode::AddrNone => Address::AddrNone(ExtendedAddress::try_decode(cursor)?),
AddressMode::Addr16Bit => {
let address = Address::Addr16Bit(ShortAddress::try_decode(cursor)?);
std::io::BufRead::consume(cursor, 6);
address
}
},
AddressMode::Addr64Bit => Address::Addr64Bit(ExtendedAddress::try_decode(cursor)?),
};

Expand All @@ -285,6 +290,10 @@ impl Address {

pub fn encode_into(&self, buffer: &mut Vec<u8>) {
match self {
Address::AddrNone(address) => {
buffer.put_u8(AddressMode::AddrNone as u8);
address.encode_into(buffer);
}
Address::Addr16Bit(address) => {
buffer.put_u8(AddressMode::Addr16Bit as u8);
address.encode_into(buffer);
Expand All @@ -298,6 +307,15 @@ impl Address {
}
}

// Struct based on the ApiMac_payloadIeItem_t retrieved from
// the api_mac.h file in the SIMPLELINK-LOWPOWER-F2-SDK v8.30.01.01
pub struct IeItem {
pub type_long: bool,
pub id: u8,
pub content_len: u16,
pub content: Vec<u8>,
}
Comment on lines +312 to +317
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Used to parse the IE payload in WS Async frames

Copy link
Copy Markdown
Author

@fariadif fariadif Oct 28, 2025

Choose a reason for hiding this comment

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

Where have you found the info describing these fields?
I couldn't find it in the stack-cop-interface guide.

Copy link
Copy Markdown

@guilherme-akira guilherme-akira Oct 28, 2025

Choose a reason for hiding this comment

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

I got it from the SDK code:
image


bitflags! {
#[derive(Debug, Clone)]
pub struct TxOption: u8 {
Expand Down Expand Up @@ -513,6 +531,21 @@ pub enum MACPIBAttributeId {
ChannelPage = 0xE7,
PhyCurrentDescriptorId = 0xE8,
FCSType = 0xE9,
DiagRxCrcPass = 0xEA,
DiagRxCrcFail = 0xEB,
DiagRxBC = 0xEC,
DiagTxBC = 0xED,
DiagRxUC = 0xEE,
DiagTxUC = 0xEF,
DiagTxUCRetry = 0xF0,
DiagTxUCFail = 0xF1,
DiagRxSecureFail = 0xF2,
DiagTxSecureFail = 0xF3,
RssiThreshold = 0xF4,
RangeExtender = 0xF5,
EnDataAckPending = 0xF6,
RfFreq = 0xF7,
PaType = 0xF8,
}

impl MACPIBAttributeId {
Expand Down Expand Up @@ -554,6 +587,10 @@ pub enum FHPIBAttributeId {
GTK2Hash = 0x2017,
GTK3Hash = 0x2018,
NeighborValidTime = 0x2019,
CsmaBaseBacoff = 0x201A,
NumNonSleepDevice = 0x201B,
NumSleepDevice = 0x201C,
NumTempTableNode = 0x201D,
}

impl FHPIBAttributeId {
Expand Down