Skip to content
Draft
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
11 changes: 10 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@ resolver = "2"
members = ["crates/*"]
# ziggurat-phy-esp and ziggurat-esp only build for an ESP32-C6 (riscv32imac) with esp-hal;
# excluded so host `cargo build` over the workspace doesn't try (and fail) to compile them.
exclude = ["fuzz", "crates/ziggurat-phy-esp", "crates/ziggurat-esp"]
# The EFR32MG24 crates likewise only build for thumbv8m.main-none-eabihf (Cortex-M33F).
exclude = [
"fuzz",
"crates/ziggurat-phy-esp",
"crates/ziggurat-esp",
"crates/ziggurat-efr32-pac",
"crates/ziggurat-rail-sys",
"crates/ziggurat-efr32",
"crates/ziggurat-phy-efr32",
]

[workspace.package]
version = "0.1.0"
Expand Down
24 changes: 18 additions & 6 deletions crates/ziggurat-driver/src/zigbee_stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
loop {
let (packet, ieee802154_frame) = self.recv_frame().await;

if !matches!(
if matches!(
ieee802154_frame,
ziggurat_ieee_802154::Ieee802154Frame::Beacon(_)
) {
Expand Down Expand Up @@ -1437,9 +1437,15 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {

let result: Result<(), RadioError> = async {
let radio = self.radio.lock().await;
radio.set_promiscuous(true).await?;

let mut sweep: Result<(), RadioError> = Ok(());
for &channel in channels {
radio.set_channel(channel).await?;
radio
if let Err(e) = radio.set_channel(channel).await {
sweep = Err(e);
break;
}
let tx = radio
.transmit(TxFrame {
psdu: beacon_request.clone(),
channel: None,
Expand All @@ -1448,11 +1454,17 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
max_csma_backoffs: self.tunables.mac_max_csma_backoffs,
security_processed: true,
})
.await?;
.await;
if let Err(e) = tx {
sweep = Err(e);
break;
}
R::sleep(duration_per_channel).await;
}
// Leave the radio on the home channel before releasing it.
radio.set_channel(home_channel).await

radio.set_promiscuous(false).await?;
radio.set_channel(home_channel).await?;
sweep
}
.await;

Expand Down
6 changes: 3 additions & 3 deletions crates/ziggurat-driver/src/zigbee_stack/mac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
fcs: 0x0000,
});

frame.to_bytes()
frame.to_bytes_without_fcs()
}

#[allow(clippy::cognitive_complexity)]
Expand Down Expand Up @@ -396,7 +396,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
tracing::trace!("Sending 802.15.4 frame: {final_frame:?}");
tracing::trace!(
"Sending 802.15.4 frame bytes: {:02X?}",
final_frame.to_bytes()
final_frame.to_bytes_without_fcs()
);

if self.state.hack_disable_tx {
Expand All @@ -408,7 +408,7 @@ impl<P: RadioPhy, R: Runtime> ZigbeeStack<P, R> {
let result = self
.radio
.transmit(TxFrame {
psdu: final_frame.to_bytes(),
psdu: final_frame.to_bytes_without_fcs(),
channel: Some(channel),
csma_ca: true,
max_frame_retries: self.tunables.mac_max_frame_retries,
Expand Down
2 changes: 2 additions & 0 deletions crates/ziggurat-efr32-pac/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
Cargo.lock
Loading