This example showcases how the adafruit-bluefruit-protocol crate can be used with an Adafruit Bluefruit LE UART Friend on an STM32F4 chip. It uses RTIC (Real-Time Interrupt-driven Concurrency) underneath.
The example logs all events (and other messages) using defmt
.
After the application has started you can connect using the Adafruit smartphone app and send any data packages and they will be printed using defmt
.
The example has been tested on a ST Nucleo-F401RE development
board but should work on any STM32F4xx family microcontroller as long as the bluetooth module is connected on USART1
using the following pins (or the code adapted accordingly):
TX
(of the microcontroller - this is RX for the bluetooth module!) onPB6
RX
(of the microcontroller - this is TX for the bluetooth module!) onPB10
- Optional: ensure that the rust toolchain is up-to-date:
rustup update
- Install
probe-run
:cargo install probe-run
- Install
flip-link
:cargo install flip-link
- Note:
flip-link
is not strictly necessary for this example (it doesn't need stack protection), however it can be considered best practices to include it.
- Note:
- Install the cross-compile target:
rustup target add thumbv7em-none-eabihf
- Optional: install the LLVM tools:
rustup component add llvm-tools-preview
- Install the STLink drivers
- Connect the board via USB
- Run
cargo run
(the correct chip & target is already defined inCargo.toml
and.cargo/config
) - Enjoy your running program :)