In order to get a bit more of a feeling what rust is like on embedded devices, I did a couple of small experiments like blink, ..., etc. For these experiments I used the stm32F401 plus a couple of elecrical components like LEDs, potentiometers and resistors. In order to make the interaction with the hardware of this board a bit simpler, I make use of the stm32f4xx-hal crate, which simplifies a lot of this logic.
Each of the experiments can be found in their own dedicated file / folder. In order to run a specific one, make sure that it is being called
in main.rs and comment the other ones out.
After connecting to the stm32 using a StLink, the project can be run using cargo build and cargo run.
The run command will automaticaly fires up GDB and sets up the connection to OpenOCD.
Below you can find a short description of the experiments and the breadboard setup I used.
This experiment blinks a number of LED's one by one.
Reading the number of mV on pin 5 and printing it to the console.
Same as the blink experiment, but now the speed at which the LED's blink can be adjusted using a potentiometer.
Outputing a saw wave using the MCP4922 DAC. Make sure that the VRef is wired, otherwise the output will contain noise.
Use the RTIC framework to schedule the blinking of the onboard LED using tasks and interrupts.
Use the RTIC framework to have a DAC output a triangle wave. Unfortunately it was not possible to reach a proper audio rate (44kHz+).