Skip to content

MPU6050 (IMU) Example on an STM32F4 chip

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

rursprung/nucleo-f401re-mpu6050

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MPU6050 (IMU) Example

CI

This example showcases how the mpu6050 crate for the IMU of the same name can be used on an STM32F4 chip.

The example logs messages using defmt.

The example has been tested on a ST Nucleo-F401RE development board but should work on any STM32F4xx family microcontroller as long as the IMU is connected via I2C1 on pins PB8 (SCL) and PB9 (SDA) or the code is adapted accordingly.

Prerequisites

  1. Install Rust
  2. Optional: ensure that the rust toolchain is up-to-date: rustup update
  3. Install probe-rs: cargo install probe-rs --features cli
  4. Install flip-link: cargo install flip-link
    • Note: flip-link is not strictly necessary for this example (it doesn't need stack protection), however it can be considered best practices to include it.
  5. Install the cross-compile target: rustup target add thumbv7em-none-eabihf
  6. Install the STLink drivers

Build & Download to Board

  1. Connect the board via USB
  2. Optional: change your targeted platform in Cargo.toml and .cargo/config (it defaults to STM32F401RE)
  3. Run cargo run
  4. Enjoy your running program :)