Rust on microcontrollers

Instructor: Michael Kefeder

First we’ll look at how to write a minimalistic I2C driver for a touchpanel of a small e-paper display, to have an easy introduction into the basic concepts of the Rust embedded eco-system.

Then we’ll inspect the implementation of a driver for a SPI controlled transceiver module MRF89XA to see which techniques and libraries can be useful. We will use the manufacturer provided specifications sheet and their example C code to improve the existing driver with Rust. Using the driver we’ll see how one can write a minimal application that communicates with other microcontrollers wirelessly. Additionally we’ll discover how to write Rust code that is compatible with the widely used over the air protocol RadioHead embedded packet radio software (GPL licensed). The workshop includes hands-on exercises applying the learnt concepts.

Prerequisites / target audience

If you have neither experience with microcontrollers nor with Rust following this workshop will be very hard. You’ll have to then learn the concepts behind embedded programming and a new programming language simultaneously, not impossible, but potentially too much.

Topics

Technological prerequisites

Hardware

Nice to have hardware

Software:

Please bring your computer pre-installed with the following tools:

# install compilation targets
rustup target add thumbv6m-none-eabi
rustup target add --toolchain nightly thumbv6m-none-eabi
# necessary linker
cargo install flip-link
# Useful to creating UF2 images for the RP2040 USB Bootloader
cargo install elf2uf2-rs --locked
# Useful for flashing over the SWD pins using a supported JTAG probe
# this contains  cargo-embed too. Also available via homebrew
cargo install cargo-binstall
cargo binstall probe-rs-tools

It is strongly advised to use Linux, macOS or WSL on Windows. Pure Windows setups work for sure too, but from experience cross-compiling on there is harder to achieve.


Michael Kefeder

For location and schedule visit our Workshops page