Skip to content

A simple Arduino-like API for developing firmware on STM32-based flight controllers

License

Notifications You must be signed in to change notification settings

rosflight/BreezySTM32

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BreezySTM32: A simple Arduino-like API for developing firmware on STM32-based flight controllers

BreezySTM32 aims to provide a simple ("breezy") Application Programming Interface (API) for writing firmware on the ARM STM32F103 controller boards popular on toady's flight controllers (Naze32, Flip32, CC3D). As with the Arduino, you write a setup() function and a loop() function, and BreezySTM32 takes care of the rest, providing you with a C-like printf() statement, a SerialPort1 that you can read/write, and libraries for standard signals like analog voltage, PWM, UART, and I^2C. (If you want to use the Arduino IDE with your STM32 board, there are other tools to do this; my goal with BreezySTM32 was to provide a bare-bones C API for my favorite flight controllers.)

To use BreezySTM32, you'll at minimum need to install the GNU ARM toolchain. After that you can use whatever development tools you like to build your firmware. I have found it easiest to avoid IDE / debugging tools like Eclipse, sticking with simple makefiles for building / flashing, vim for editing, and printf() for debugging.

To load new firmware, you should first disconnect the board from your computer, short the BOOT pins together, and reconnect to your computer. The Flip32 features through-hole soldering pads for the BOOT pins, so that is the board I've been using for development. By pushing a two-pin jumper onto the pins, I avoid having to place a paper clip or tweezers across the pins while flashing. (The Baseflight firmware that I adapted to write BeezySTM32 uses the clever trick of [listening] (https://github.com/multiwii/baseflight/blob/master/src/serial.c#L878-L879) for a special reboot message, which you send from your compute right before flashing. So if you've got a long-term project to work on, you might consider implementing something like that to avoid having to short the pins every time.)

The BreezySTM32 examples directory includes the following use cases:

  • a simple LED blinker
  • a program that searches the board for I2C devices, reporting the addresses of any such devices found
  • a program that reads from the MaxBotix MB1242 I2C ultrasonic rangefinder and reports distances in centimeters
  • a program that reads from the onboard MPU6050 Inertial Measurement Unit and reports acceleration in mm/s2, angular velocity in mrad/s and the time delay between measurements and the time to print to the screen in us.
  • a program that tests the SPI-based flash memory
  • a C++ program for blinking one of the LEDs

A makefile is included with each example, to show you how to start your own projects. Type make flash to flash the example to your board.

Projects known to be using BreezySTM32 include:

If you find BreezySTM32 helpful, please consider donating to the Baseflight or Cleanflight projects from which it is derived.

About

A simple Arduino-like API for developing firmware on STM32-based flight controllers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 87.3%
  • Assembly 10.5%
  • HTML 1.4%
  • C++ 0.8%