diff options
| author | xoviat <[email protected]> | 2023-06-21 21:50:12 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-06-21 21:50:12 +0000 |
| commit | 1f2be2dac5eeed739d2866b9b63ca06fdd84c276 (patch) | |
| tree | fd97bffac5ab4f754d9fd48d7ac8b95054a1d046 /examples/stm32wb | |
| parent | 2e625138ff8384a96f1f8a4d7a9c557b50353836 (diff) | |
| parent | 5247c1c795a8b37be485aeeaa99a79eece678fba (diff) | |
Merge pull request #1569 from xoviat/tl-mbox-2
wpan: misc. cleanup and add mac
Diffstat (limited to 'examples/stm32wb')
| -rw-r--r-- | examples/stm32wb/Cargo.toml | 14 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox_ble.rs (renamed from examples/stm32wb/src/bin/tl_mbox_tx_rx.rs) | 0 | ||||
| -rw-r--r-- | examples/stm32wb/src/bin/tl_mbox_mac.rs | 64 |
3 files changed, 78 insertions, 0 deletions
diff --git a/examples/stm32wb/Cargo.toml b/examples/stm32wb/Cargo.toml index 83a443754..e41424aad 100644 --- a/examples/stm32wb/Cargo.toml +++ b/examples/stm32wb/Cargo.toml | |||
| @@ -20,3 +20,17 @@ embedded-hal = "0.2.6" | |||
| 20 | panic-probe = { version = "0.3", features = ["print-defmt"] } | 20 | panic-probe = { version = "0.3", features = ["print-defmt"] } |
| 21 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } | 21 | futures = { version = "0.3.17", default-features = false, features = ["async-await"] } |
| 22 | heapless = { version = "0.7.5", default-features = false } | 22 | heapless = { version = "0.7.5", default-features = false } |
| 23 | |||
| 24 | |||
| 25 | [features] | ||
| 26 | default = ["ble"] | ||
| 27 | mac = ["embassy-stm32-wpan/mac"] | ||
| 28 | ble = ["embassy-stm32-wpan/ble"] | ||
| 29 | |||
| 30 | [[bin]] | ||
| 31 | name = "tl_mbox_ble" | ||
| 32 | required-features = ["ble"] | ||
| 33 | |||
| 34 | [[bin]] | ||
| 35 | name = "tl_mbox_mac" | ||
| 36 | required-features = ["mac"] \ No newline at end of file | ||
diff --git a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs b/examples/stm32wb/src/bin/tl_mbox_ble.rs index 439bd01ac..439bd01ac 100644 --- a/examples/stm32wb/src/bin/tl_mbox_tx_rx.rs +++ b/examples/stm32wb/src/bin/tl_mbox_ble.rs | |||
diff --git a/examples/stm32wb/src/bin/tl_mbox_mac.rs b/examples/stm32wb/src/bin/tl_mbox_mac.rs new file mode 100644 index 000000000..a42939bbd --- /dev/null +++ b/examples/stm32wb/src/bin/tl_mbox_mac.rs | |||
| @@ -0,0 +1,64 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(type_alias_impl_trait)] | ||
| 4 | |||
| 5 | use defmt::*; | ||
| 6 | use embassy_executor::Spawner; | ||
| 7 | use embassy_stm32::bind_interrupts; | ||
| 8 | use embassy_stm32::ipcc::{Config, ReceiveInterruptHandler, TransmitInterruptHandler}; | ||
| 9 | use embassy_stm32_wpan::TlMbox; | ||
| 10 | use {defmt_rtt as _, panic_probe as _}; | ||
| 11 | |||
| 12 | bind_interrupts!(struct Irqs{ | ||
| 13 | IPCC_C1_RX => ReceiveInterruptHandler; | ||
| 14 | IPCC_C1_TX => TransmitInterruptHandler; | ||
| 15 | }); | ||
| 16 | |||
| 17 | #[embassy_executor::main] | ||
| 18 | async fn main(_spawner: Spawner) { | ||
| 19 | /* | ||
| 20 | How to make this work: | ||
| 21 | |||
| 22 | - Obtain a NUCLEO-STM32WB55 from your preferred supplier. | ||
| 23 | - Download and Install STM32CubeProgrammer. | ||
| 24 | - Download stm32wb5x_FUS_fw.bin, stm32wb5x_BLE_Stack_full_fw.bin, and Release_Notes.html from | ||
| 25 | gh:STMicroelectronics/STM32CubeWB@2234d97/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x | ||
| 26 | - Open STM32CubeProgrammer | ||
| 27 | - On the right-hand pane, click "firmware upgrade" to upgrade the st-link firmware. | ||
| 28 | - Once complete, click connect to connect to the device. | ||
| 29 | - On the left hand pane, click the RSS signal icon to open "Firmware Upgrade Services". | ||
| 30 | - In the Release_Notes.html, find the memory address that corresponds to your device for the stm32wb5x_FUS_fw.bin file | ||
| 31 | - Select that file, the memory address, "verify download", and then "Firmware Upgrade". | ||
| 32 | - Once complete, in the Release_Notes.html, find the memory address that corresponds to your device for the | ||
| 33 | stm32wb5x_BLE_Stack_full_fw.bin file. It should not be the same memory address. | ||
| 34 | - Select that file, the memory address, "verify download", and then "Firmware Upgrade". | ||
| 35 | - Select "Start Wireless Stack". | ||
| 36 | - Disconnect from the device. | ||
| 37 | - In the examples folder for stm32wb, modify the memory.x file to match your target device. | ||
| 38 | - Run this example. | ||
| 39 | |||
| 40 | Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name. | ||
| 41 | */ | ||
| 42 | |||
| 43 | let p = embassy_stm32::init(Default::default()); | ||
| 44 | info!("Hello World!"); | ||
| 45 | |||
| 46 | let config = Config::default(); | ||
| 47 | let mbox = TlMbox::init(p.IPCC, Irqs, config); | ||
| 48 | |||
| 49 | let sys_event = mbox.sys_subsystem.read().await; | ||
| 50 | info!("sys event: {}", sys_event.payload()); | ||
| 51 | |||
| 52 | mbox.sys_subsystem.shci_c2_mac_802_15_4_init().await; | ||
| 53 | // | ||
| 54 | // info!("starting ble..."); | ||
| 55 | // mbox.ble_subsystem.write(0x0c, &[]).await; | ||
| 56 | // | ||
| 57 | // info!("waiting for ble..."); | ||
| 58 | // let ble_event = mbox.ble_subsystem.read().await; | ||
| 59 | // | ||
| 60 | // info!("ble event: {}", ble_event.payload()); | ||
| 61 | |||
| 62 | info!("Test OK"); | ||
| 63 | cortex_m::asm::bkpt(); | ||
| 64 | } | ||
