This repo contains example programs for the STM32F3 Discovery board - which uses the STM32F303VC MCU - utilizing the Embassy embedded Rust framework.
To run these programs, you'll need a nightly rust toolchain for the thumbv7em-none-eabihf target:
rustup install nightly
rustup target add thumbv7em-none-eabihf
In addition, cargo run
will try to flash the discovery board using probe-rs, so you'll need that as well. Alternatively, you can only cargo build
the programs and flash them via other means, or adapt the runner
option in .cargo/config.toml
.
Also, you will naturally need an STM32F3 Discovery board.
Several programs are contained in src/bin/
. For example, to run the hello.rs
program, execute this command:
cargo run --release --bin hello
The programs are based on and inspired by Embassy's stm32f3 and stm32f4 examples.
These programs work:
- hello: prints "Hello World!" to the debugging interface, that's it. See this example
- blinky: blinks the eight LEDs of the discovery board at different frequencies, by multiplexing eight independent tasks. See this example
- button: waits for button presses and releases using interrupts and controls an LED accordingly. See this example
- pwm: controls an LED's brightness by varying its duty cycle. See this example
- channel: uses a Channel to communicate between two async tasks. If the receiver interval is larger than the sender interval, this will demonstrate backpressure.
- signal: uses a Signal to communicate between two async tasks. If the receiver interval is larger than the sender interval, this will demonstrate overwriting without backpressure.
These don't:
- adc: should read a voltage from one of the ADC capable pins periodically. However, the program hangs at
Adc::new()
. See this example - uart: when TX and RX (PE0, PE1) are connected, should echo the UART output. However, no data is received and printed (I have not yet explicitly tested if the data is sent correctly). See this example