diff options
| author | Badr Bouslikhin <[email protected]> | 2024-12-05 18:47:33 +0100 |
|---|---|---|
| committer | Badr Bouslikhin <[email protected]> | 2024-12-05 18:47:33 +0100 |
| commit | 78b536e74ba158917946ee9516924f1966f20ecd (patch) | |
| tree | 542b151125789d5a4b0fd5fbefb0a5d5f4a90f98 /examples | |
| parent | 75a21e5045c3d770c69737df1b586e668ba5b1b1 (diff) | |
docs: improve stm32 embassy-usb-dfu example
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/boot/bootloader/stm32wb-dfu/README.md | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/examples/boot/bootloader/stm32wb-dfu/README.md b/examples/boot/bootloader/stm32wb-dfu/README.md index d5c6ea57c..3c5f268a0 100644 --- a/examples/boot/bootloader/stm32wb-dfu/README.md +++ b/examples/boot/bootloader/stm32wb-dfu/README.md | |||
| @@ -1,11 +1,37 @@ | |||
| 1 | # Bootloader for STM32 | 1 | # Bootloader for STM32 |
| 2 | 2 | ||
| 3 | The bootloader uses `embassy-boot` to interact with the flash. | 3 | This bootloader implementation uses `embassy-boot` and `embassy-usb-dfu` to manage firmware updates and interact with the flash memory on STM32WB55 devices. |
| 4 | 4 | ||
| 5 | # Usage | 5 | ## Prerequisites |
| 6 | 6 | ||
| 7 | Flash the bootloader | 7 | - Rust toolchain with `cargo` installed |
| 8 | - `cargo-flash` for flashing the bootloader | ||
| 9 | - `dfu-util` for firmware updates | ||
| 10 | - `cargo-binutils` for binary generation | ||
| 11 | |||
| 12 | ## Usage | ||
| 13 | |||
| 14 | ### 1. Flash the Bootloader | ||
| 15 | |||
| 16 | First, flash the bootloader to your device: | ||
| 8 | 17 | ||
| 9 | ``` | 18 | ``` |
| 10 | cargo flash --features embassy-stm32/stm32wb55rg --release --chip STM32WB55RGVx | 19 | cargo flash --features embassy-stm32/stm32wb55rg --release --chip STM32WB55RGVx |
| 11 | ``` | 20 | ``` |
| 21 | |||
| 22 | ### 2. Build and Flash Application | ||
| 23 | |||
| 24 | Generate your application binary and flash it using DFU: | ||
| 25 | |||
| 26 | ``` | ||
| 27 | cargo objcopy --release -- -O binary fw.bin | ||
| 28 | dfu-util -d c0de:cafe -w -D fw.bin | ||
| 29 | ``` | ||
| 30 | |||
| 31 | ## Troubleshooting | ||
| 32 | |||
| 33 | - Make sure your device is in DFU mode before flashing | ||
| 34 | - Verify the USB VID:PID matches your device (c0de:cafe) | ||
| 35 | - Check USB connections if the device is not detected | ||
| 36 | - Make sure the transfer size option of `dfu-util` matches the bootloader configuration. By default, `dfu-util` will use the transfer size reported by the device, but you can override it with the `-t` option if needed. | ||
| 37 | - Make sure `control_buf` size is larger than or equal to the `usb_dfu` `BLOCK_SIZE` parameter (in this example, both are set to 4096 bytes). | ||
