From c6077f6c17317a564c5b0ab7efec6f429183d80d Mon Sep 17 00:00:00 2001 From: William Hicklin Date: Mon, 20 Jan 2025 13:58:51 +0000 Subject: [PATCH 1/2] Set the TX_MTU to the L2CAP_MTU rather than the PAYLOAD_LEN. --- examples/apps/src/ble_l2cap_central.rs | 4 ++-- examples/apps/src/ble_l2cap_peripheral.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/apps/src/ble_l2cap_central.rs b/examples/apps/src/ble_l2cap_central.rs index fa1caf06..9ce00836 100644 --- a/examples/apps/src/ble_l2cap_central.rs +++ b/examples/apps/src/ble_l2cap_central.rs @@ -25,7 +25,7 @@ where .build(); // NOTE: Modify this to match the address of the peripheral you want to connect to. - // Currently it matches the address used by the peripheral examples + // Currently, it matches the address used by the peripheral examples let target: Address = Address::random([0xff, 0x8f, 0x1a, 0x05, 0xe4, 0xff]); let config = ConnectConfig { @@ -48,7 +48,7 @@ where info!("New l2cap channel created, sending some data!"); for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(stack, &tx).await.unwrap(); } info!("Sent data, waiting for them to be sent back"); let mut rx = [0; PAYLOAD_LEN]; diff --git a/examples/apps/src/ble_l2cap_peripheral.rs b/examples/apps/src/ble_l2cap_peripheral.rs index f66389c7..451b24d5 100644 --- a/examples/apps/src/ble_l2cap_peripheral.rs +++ b/examples/apps/src/ble_l2cap_peripheral.rs @@ -69,7 +69,7 @@ where Timer::after(Duration::from_secs(1)).await; for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(stack, &tx).await.unwrap(); } info!("L2CAP data echoed"); From fdffca2ca9910f52af0c647ea03c862d59ce1b4c Mon Sep 17 00:00:00 2001 From: William Hicklin Date: Mon, 20 Jan 2025 13:58:51 +0000 Subject: [PATCH 2/2] Set the TX_MTU to the L2CAP_MTU rather than the PAYLOAD_LEN. --- examples/apps/src/ble_l2cap_central.rs | 4 ++-- examples/apps/src/ble_l2cap_peripheral.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/apps/src/ble_l2cap_central.rs b/examples/apps/src/ble_l2cap_central.rs index 03919bd8..44858a68 100644 --- a/examples/apps/src/ble_l2cap_central.rs +++ b/examples/apps/src/ble_l2cap_central.rs @@ -26,7 +26,7 @@ where } = stack.build(); // NOTE: Modify this to match the address of the peripheral you want to connect to. - // Currently it matches the address used by the peripheral examples + // Currently, it matches the address used by the peripheral examples let target: Address = Address::random([0xff, 0x8f, 0x1a, 0x05, 0xe4, 0xff]); let config = ConnectConfig { @@ -49,7 +49,7 @@ where info!("New l2cap channel created, sending some data!"); for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(&stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(&stack, &tx).await.unwrap(); } info!("Sent data, waiting for them to be sent back"); let mut rx = [0; PAYLOAD_LEN]; diff --git a/examples/apps/src/ble_l2cap_peripheral.rs b/examples/apps/src/ble_l2cap_peripheral.rs index f4c0de7d..da173196 100644 --- a/examples/apps/src/ble_l2cap_peripheral.rs +++ b/examples/apps/src/ble_l2cap_peripheral.rs @@ -70,7 +70,7 @@ where Timer::after(Duration::from_secs(1)).await; for i in 0..10 { let tx = [i; PAYLOAD_LEN]; - ch1.send::<_, PAYLOAD_LEN>(&stack, &tx).await.unwrap(); + ch1.send::<_, L2CAP_MTU>(&stack, &tx).await.unwrap(); } info!("L2CAP data echoed");