
Blink an LED on STM32 With Rust and stm32f4xx-hal
Build a bare-metal Rust blinky for an STM32F411 Nucleo board with stm32f4xx-hal, from Cargo.toml and memory.x to the toggle loop and the flash command.
Tag
16 posts

Build a bare-metal Rust blinky for an STM32F411 Nucleo board with stm32f4xx-hal, from Cargo.toml and memory.x to the toggle loop and the flash command.

Use the STM32 built-in system bootloader to program firmware over a USB serial adapter, with BOOT0 wiring, the handshake bytes and CubeProgrammer commands.

Use the DMAMUX request multiplexer on STM32G4 and H7 to connect any peripheral request to any DMA channel, plus request generators and synchronization.

Stream continuous data on an STM32 with circular DMA, process each half buffer on the half-transfer and complete events, and detect a missed deadline.

Copy and fill memory blocks with the STM32F4 DMA2 controller using HAL_DMA_Start_IT or polling, with the FIFO setting it requires and the common mistakes.

Put an STM32F4 into Stop mode with HAL_PWR_EnterSTOPMode, wake it with an RTC alarm every minute, and restore the clocks that Stop switches off.

Free an I2C slave holding SDA low after a reset by clocking SCL up to nine times and sending a stop, with a tested C routine and the reason for nine.

Bring up a USB CDC serial port on an STM32F4 with TinyUSB: 48 MHz clock, OTG_FS pins, VBUS sensing, the interrupt handler, tusb_config.h and a printf retarget.

Blink the LD2 LED on a NUCLEO-F446RE by writing the GPIO registers yourself: MODER, OTYPER, OSPEEDR, PUPDR and ODR, with a SysTick delay and a register decoder.

Start two ThreadX threads on an STM32 with tx_kernel_enter, tx_application_define and tx_thread_create, and learn priorities, stacks, time slices and sleep.

Build an STM32F4 blinky with no HAL: one C file, a short linker script, a vector table and the arm-none-eabi-gcc commands that produce a flashable binary.

Learn how DMA controllers move data without the CPU, from memory copies to ADC, UART and timer transfers, on STM32, RP2040 and ESP32, and the pitfalls to avoid.