2023-05-02 13:16:48 +02:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
|
|
|
use defmt::*;
|
|
|
|
use embassy_executor::Spawner;
|
2023-05-26 10:56:55 +02:00
|
|
|
use embassy_stm32::ipcc::Config;
|
2023-05-02 13:16:48 +02:00
|
|
|
use embassy_stm32::tl_mbox::TlMbox;
|
2023-05-25 00:29:56 +02:00
|
|
|
use embassy_stm32::{bind_interrupts, tl_mbox};
|
2023-05-04 12:02:17 +02:00
|
|
|
use embassy_time::{Duration, Timer};
|
2023-05-02 13:16:48 +02:00
|
|
|
use {defmt_rtt as _, panic_probe as _};
|
|
|
|
|
2023-05-25 00:29:56 +02:00
|
|
|
bind_interrupts!(struct Irqs{
|
|
|
|
IPCC_C1_RX => tl_mbox::ReceiveInterruptHandler;
|
|
|
|
IPCC_C1_TX => tl_mbox::TransmitInterruptHandler;
|
|
|
|
});
|
|
|
|
|
2023-05-02 13:16:48 +02:00
|
|
|
#[embassy_executor::main]
|
|
|
|
async fn main(_spawner: Spawner) {
|
2023-05-11 23:45:42 +02:00
|
|
|
/*
|
|
|
|
How to make this work:
|
|
|
|
|
|
|
|
- Obtain a NUCLEO-STM32WB55 from your preferred supplier.
|
|
|
|
- Download and Install STM32CubeProgrammer.
|
2023-05-11 23:53:55 +02:00
|
|
|
- Download stm32wb5x_FUS_fw.bin, stm32wb5x_BLE_Stack_full_fw.bin, and Release_Notes.html from
|
|
|
|
gh:STMicroelectronics/STM32CubeWB@2234d97/Projects/STM32WB_Copro_Wireless_Binaries/STM32WB5x
|
2023-05-11 23:45:42 +02:00
|
|
|
- Open STM32CubeProgrammer
|
|
|
|
- On the right-hand pane, click "firmware upgrade" to upgrade the st-link firmware.
|
|
|
|
- Once complete, click connect to connect to the device.
|
|
|
|
- On the left hand pane, click the RSS signal icon to open "Firmware Upgrade Services".
|
|
|
|
- In the Release_Notes.html, find the memory address that corresponds to your device for the stm32wb5x_FUS_fw.bin file
|
|
|
|
- Select that file, the memory address, "verify download", and then "Firmware Upgrade".
|
|
|
|
- Once complete, in the Release_Notes.html, find the memory address that corresponds to your device for the
|
|
|
|
stm32wb5x_BLE_Stack_full_fw.bin file. It should not be the same memory address.
|
|
|
|
- Select that file, the memory address, "verify download", and then "Firmware Upgrade".
|
2023-05-22 01:39:13 +02:00
|
|
|
- Select "Start Wireless Stack".
|
2023-05-11 23:53:55 +02:00
|
|
|
- Disconnect from the device.
|
2023-05-11 23:45:42 +02:00
|
|
|
- In the examples folder for stm32wb, modify the memory.x file to match your target device.
|
|
|
|
- Run this example.
|
|
|
|
|
|
|
|
Note: extended stack versions are not supported at this time. Do not attempt to install a stack with "extended" in the name.
|
|
|
|
*/
|
|
|
|
|
2023-05-26 10:56:55 +02:00
|
|
|
let _p = embassy_stm32::init(Default::default());
|
2023-05-02 13:16:48 +02:00
|
|
|
info!("Hello World!");
|
|
|
|
|
|
|
|
let config = Config::default();
|
2023-05-26 10:56:55 +02:00
|
|
|
let mbox = TlMbox::init(Irqs, config);
|
2023-05-02 13:16:48 +02:00
|
|
|
|
|
|
|
loop {
|
|
|
|
let wireless_fw_info = mbox.wireless_fw_info();
|
|
|
|
match wireless_fw_info {
|
|
|
|
None => error!("not yet initialized"),
|
|
|
|
Some(fw_info) => {
|
|
|
|
let version_major = fw_info.version_major();
|
|
|
|
let version_minor = fw_info.version_minor();
|
|
|
|
let subversion = fw_info.subversion();
|
|
|
|
|
|
|
|
let sram2a_size = fw_info.sram2a_size();
|
|
|
|
let sram2b_size = fw_info.sram2b_size();
|
|
|
|
|
|
|
|
info!(
|
|
|
|
"version {}.{}.{} - SRAM2a {} - SRAM2b {}",
|
|
|
|
version_major, version_minor, subversion, sram2a_size, sram2b_size
|
|
|
|
);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-05-04 12:02:17 +02:00
|
|
|
|
|
|
|
Timer::after(Duration::from_millis(500)).await;
|
2023-05-02 13:16:48 +02:00
|
|
|
}
|
|
|
|
}
|