Skip to content

lonesometraveler/stm32f4xx-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Examples for stm32f4xx_hal

A collection of small examples built with stm32f4xx_hal. I also have another example collection for stm32f3xx_hal.

Overview

You will find the follwoings in examples:

  • timer_interrupt_1.rs: Timer interrupt flips a bool. A LED gets flipped based on the bool in the main.
  • timer_interrupt_2.rs: Timer interrupt toggles a LED.
  • gpio_interrupt_1.rs: GPIO interrupts with one button.
  • gpio_interrupt_2.rs: GPIO interrupts with two buttons 1.
  • gpio_interrupt_3.rs: GPIO interrupts with two buttons 2.
  • serial_1.rs: Serial Echo.
  • serial_interrupt_1.rs: Serial Echo with interrupt.
  • timer_counter_1.rs: Pulse width reading with a timer. (Maxbotix Ultrasonic sensors demo)
  • adc_1.rs: ADC reading and PWM output example.
  • adc_interrupt_1.rs: ADC EOC End of Conversion Interrupt. An interrupt version of adc_1.rs.
  • adc_interrupt_2.rs: ADC External trigger. Injected Conversion Mode.
  • rtfm_1.rs: Real-Time Interrupt-driven Concurrency (RTIC) framework + BBQueue (SPSC, lockless, no_std, thread safe, queue) example.
  • rtfm_2.rs: Real-Time Interrupt-driven Concurrency (RTIC) framework example. LED toggle with Timer interrupt.
  • rtfm_3.rs: Real-Time Interrupt-driven Concurrency (RTIC) framework example. Software task scheduling + UART interrupt.

I am planning to add more.

Usage

Note I wrote these for Nucleo-F429ZI board which has a STM32F429 microcontroller. If you use a different microcontroller, you need to adjust the settings accordingly.

  1. Clone this repo.
$ git clone https://github.com/lonesometraveler/stm32f4xx-examples.git
  1. If necessary, set a default target in .cargo/config and edit the memory region info in memory.x.

  2. Build the examples.

$ cargo build --examples

Cortex Debug

The config file for Cortex-Debug extension for VS Code is in .vscode folder. If your board is Nucleo-F429ZI and you plan to use JLink, it's pretty much ready to go. Just specify an executable in .vscode/launch.json.

About

A collection of small examples built with stm32f4xx-hal

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published