No description
Find a file
2024-05-03 15:57:50 -07:00
.cargo blinks the user LED on the Nucleo board. 2024-05-02 16:07:19 -07:00
src use controller board LED, adjust blink rate based on potentiometer 2024-05-03 15:57:50 -07:00
.gitignore blinks the user LED on the Nucleo board. 2024-05-02 16:07:19 -07:00
build.rs use controller board LED, adjust blink rate based on potentiometer 2024-05-03 15:57:50 -07:00
Cargo.toml use controller board LED, adjust blink rate based on potentiometer 2024-05-03 15:57:50 -07:00
memory.x blinks the user LED on the Nucleo board. 2024-05-02 16:07:19 -07:00
openocd.cfg blinks the user LED on the Nucleo board. 2024-05-02 16:07:19 -07:00
openocd.gdb blinks the user LED on the Nucleo board. 2024-05-02 16:07:19 -07:00
README.md use controller board LED, adjust blink rate based on potentiometer 2024-05-03 15:57:50 -07:00

TinFOC: a Rust-y Field-Oriented Control crate for STM32 MCUs

A crate that provides an FOC motor controller using STM32 Cortex microcontrollers.

Or rather, it would if it were done, but it is not. It's currently my embedded programming playground project, but I do intend on making it useful and good. I'll let you know when that's the case, but until then, it's going to be a work in progress.

Dependencies

The MCU I'm using is the STM32F302R8, and I'm using the X-Nucleo IHM07M1 BLDC motor controller shield board that provides the actual power to the motor.

This requires the thumbv7em-none-eabihf Rust target:

rustup target add thumbv7em-none-eabihf

In order to connect to the microcontroller with a debugger (say, to load the program) on Ubuntu linux, you'll need to:

sudo apt install openocd gdb-multiarch

probe-rs is a convenient tool for interacting with your dev board.

Running on hardware

Assuming you've plugged your board into your computer via USB:

  1. build TinFOC with cargo build
  2. load it onto the board and run it with:
  • probe-rs run --chip=STM32F302R8Tx target/thumbv7em-none-eabihf/debug/tinfoc

If all went well, and your IHM07M1 motor controller board is attached to the Nucleo dev board, the red LED on the IHM07M1 should start to blink, and you can turn the potentiometer to adjust the blinking rate.