From c7e425f9bb5d10c796f93ce06483a7f2ee82201e Mon Sep 17 00:00:00 2001 From: Guilherme Akira Alves dos Santos Date: Fri, 3 Oct 2025 17:23:11 -0300 Subject: [PATCH 1/5] Handles the addrmode zeroed and add missing FH PIBs. --- src/subsystem/mac/areq.rs | 2 +- src/types.rs | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/subsystem/mac/areq.rs b/src/subsystem/mac/areq.rs index ced7683..d8b93b9 100644 --- a/src/subsystem/mac/areq.rs +++ b/src/subsystem/mac/areq.rs @@ -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]; cursor .read_exact(&mut ie_payload) .map_err(|_| Error::NotEnoughBytes)?; diff --git a/src/types.rs b/src/types.rs index 19e6cae..26089a4 100644 --- a/src/types.rs +++ b/src/types.rs @@ -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, } @@ -263,6 +266,7 @@ impl ExtendedAddress { #[derive(Debug, PartialEq, Copy, Clone)] pub enum Address { + AddrNone(ExtendedAddress), Addr16Bit(ShortAddress), Addr64Bit(ExtendedAddress), } @@ -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)?), }; @@ -285,6 +290,10 @@ impl Address { pub fn encode_into(&self, buffer: &mut Vec) { 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); @@ -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, +} + bitflags! { #[derive(Debug, Clone)] pub struct TxOption: u8 { @@ -554,6 +572,10 @@ pub enum FHPIBAttributeId { GTK2Hash = 0x2017, GTK3Hash = 0x2018, NeighborValidTime = 0x2019, + CsmaBaseBacoff = 0x201A, + NumNonSleepDevice = 0x201B, + NumSleepDevice = 0x201C, + NumTempTableNode = 0x201D, } impl FHPIBAttributeId { From b6d2cda344e30f58c53efcbb00e801560ed6aba7 Mon Sep 17 00:00:00 2001 From: Guilherme Akira Alves dos Santos Date: Thu, 9 Oct 2025 19:47:16 -0300 Subject: [PATCH 2/5] Change WS Async Req frame's length. --- src/subsystem/mac/sreq.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/subsystem/mac/sreq.rs b/src/subsystem/mac/sreq.rs index c711160..4fbb082 100644 --- a/src/subsystem/mac/sreq.rs +++ b/src/subsystem/mac/sreq.rs @@ -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, command: CommandCode { is_extended: false, cmd_type: CommandType::SREQ, From c48e178b21158e130ee84eefbf74c4c9c268bbf0 Mon Sep 17 00:00:00 2001 From: Guilherme Akira Alves dos Santos Date: Tue, 14 Oct 2025 15:47:58 -0300 Subject: [PATCH 3/5] Add missing MACPIBAttributeId's. --- src/types.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/types.rs b/src/types.rs index 26089a4..6946241 100644 --- a/src/types.rs +++ b/src/types.rs @@ -531,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 { From 3c00ef242d6d597ca65c1a772b61beb0041c17d1 Mon Sep 17 00:00:00 2001 From: Guilherme Akira Alves dos Santos Date: Fri, 31 Oct 2025 17:11:09 -0300 Subject: [PATCH 4/5] Remove parameter for AddrNone. --- src/types.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/types.rs b/src/types.rs index 6946241..d7b5c61 100644 --- a/src/types.rs +++ b/src/types.rs @@ -266,7 +266,7 @@ impl ExtendedAddress { #[derive(Debug, PartialEq, Copy, Clone)] pub enum Address { - AddrNone(ExtendedAddress), + AddrNone, Addr16Bit(ShortAddress), Addr64Bit(ExtendedAddress), } @@ -276,7 +276,10 @@ 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::AddrNone => { + std::io::BufRead::consume(cursor, 8); + Address::AddrNone + }, AddressMode::Addr16Bit => { let address = Address::Addr16Bit(ShortAddress::try_decode(cursor)?); std::io::BufRead::consume(cursor, 6); @@ -290,9 +293,9 @@ impl Address { pub fn encode_into(&self, buffer: &mut Vec) { match self { - Address::AddrNone(address) => { + Address::AddrNone => { buffer.put_u8(AddressMode::AddrNone as u8); - address.encode_into(buffer); + buffer.extend_from_slice(&[0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]); } Address::Addr16Bit(address) => { buffer.put_u8(AddressMode::Addr16Bit as u8); From 192cb64dd7951f50e28c38b429d6bf07ac17983d Mon Sep 17 00:00:00 2001 From: Guilherme Akira Alves dos Santos Date: Tue, 11 Nov 2025 17:34:06 -0300 Subject: [PATCH 5/5] Update comment message about frame length. --- src/subsystem/mac/sreq.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/subsystem/mac/sreq.rs b/src/subsystem/mac/sreq.rs index 4fbb082..006e229 100644 --- a/src/subsystem/mac/sreq.rs +++ b/src/subsystem/mac/sreq.rs @@ -1478,7 +1478,8 @@ 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. + // The official coprocessor interface guides released so far incorrectly list a frame length of 0x26 for this message. + // The correct frame length value is 0x1E. See the link below for more details. // 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 {