/stm32l4a6-rust-demo

Quick demo project for using Rust on the STM32L4A6 Microcontroller

Primary LanguageRustThe UnlicenseUnlicense

STM32L4A6 Rust Demo

Working with the STM32L4A6ZG microcontroller via the Nucleo-L4A6ZG.

Getting Started

  1. Install Rust. It must be installed using rustup.
  2. Install the required dependencies for embedded rust development.
rustup update
rustup target add thumbv7em-none-eabihf
rustup component add llvm-tools
cargo install cargo-binutils probe-rs-tools cargo-expand
  1. Open this repo in VS Code.
  2. To flash and run the firmware, run cargo embed from the root of this repo, with the Nucleo-L4A6ZG plugged in.
  3. Observe logs coming from the STM32. Observe the green onboard LED blinking.

Guides/Notes

Alternative Ideas

Notable Dev Kit Pins

  • LD1 = PC7 (Green LED)
  • LD2 = PB7 (Blue LED)
  • LD3 = PB14 (Red LED)
  • USART2 TX = PA2 or PD5
  • USART2 RX = PA3 or PD6

Not Used

  • PG7 = LPUART1 TX (via ST-LINK)
  • PG8 = LPUART1 RX (via ST-LINK)

Hints for Next Steps

  1. Create two separate crates in a repo, and put as much testable logic as possible in the other platform-independent crate.
    • E.g., command parsing, the command list, etc. goes in that crate.
  2. Consider adding defmt logging: https://github.com/knurling-rs/defmt