Travis CI Dashboard: travis-ci.com/MVHS-Rocket-Group/STM32-Flight-Computer
.pio/*
: PlatformIO config files and build directory. (Generated upon execution of first build).vscode/*
: VSCode config files.include/*
: C/C++ header files.constants.h
: Provides constant definitions.helpers.h
: Provides development infrastructure for project.mean_sensor_filter.h
: Lightweight sensor noise filter taking a time-average for all inputs.state.h
: Statestruct
providing convenient storage for all values in the state vector.
lib/*
: C/C++ libraries.Arduino_LSM9DS1_ID6589/*
: Slightly modified version of this library from PlatformIO registry tweaked to use the correct addresses for theLSM9DS1
chip as configured by Ozzymaker.
src/*
: C/C++ source code files.main.cpp
: Primary entry point for program.
.gitattributes
,.gitignore
: Git SCM config files.travis.yml
: Travis CI (continuous integration) automated build checker config.platformio.ini
: PlatformIO build config.STM32-Flight-Computer.code-workspace
: VSCode workspace file.TODO.md
: TODO list for project.
STM32 (Blue Pill development board, STM32F103C8T6
MCU part) flight computer and FDR for high-power SRM rockets. This program is developed in conjunction with the PlatformIO IDE system with integration into VSCode and Atom editors, a substantial upgrade from the oxymoron Arduino IDE.
Program upload and line-by-line debugging support is provided by the wonderful ST-Link V2 connected to the STM32's SWD (Serial Wire Debug) port and a serial text terminal by an FTDI breakout board connected to UART1
on the STM32.
- Ozzymaker BerryIMU via I2C
- SD Card breakout board via SPI
- 3v3 to 5v signal converter
- Arduino framework for STM32 targets in PlatformIO
- Control-loop paradigm with State and Goal messages logged.
- Gist of Features:
- Flight controller (PWM Output)
- Flight state data logger
- Important flight events: e.g. Launch detection, arming of different systems, control loop decisions, deployments (detected via accelerometer edges?)
- Camera recorder via “pressing” the record button?
- Landing buzzer control?
- Arming switch toggle (software interrupt)
RC PWM has a "window" period of 20ms (milliseconds), with a pulse ranging in width from 1ms to 2ms, where 1ms is ~0% command and 2ms is ~100% command. Duty cycle, a percentage, is a ratio of on-time to off-time.
Therefore:
- 0% throttle command --> 5% duty cycle
- 100% throttle command --> 10% duty cycle
Documentation on PWM usage in Arduino
From perspective of a cockpit at the nose cone: (TODO: Verify if these are still correct!)
Vehicle Axis: | Axis Description: | IMU Measurement Axis: |
---|---|---|
X | roll - vertical axis through center of rocket | +X (acc), +X (gyro) |
Y | pitch - horizontal axis | -Y (acc), +Y (gyro) |
Z | yaw - horizontal axis | -Z (acc), +Z (gyro) |
For some reason, the default STSTM32
linker scripts for the generic STM32F103C8
, the chip on the Blue Pill, assume that the the MCU has 64K of program flash memory, which is just not the case, as most boards around have 128K of flash. This shouldn't be an issue, but for the extra headroom, this is a good mod. Original post on PlatformIO Community forum.
File | Original | Post-mod |
---|---|---|
[USER_DIR]\.platformio\platforms\ststm32\boards\genericSTM32F103C8.json |
"maximum_size": 65536, |
"maximum_size": 131072, |
[USER_DIR]\.platformio\platforms\ststm32\ldscripts\stm32f103x8.ld |
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 64K |
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 128K |