Skip to content

Flight Controller Setup

Compatible Hardware

Currently, the ROSflight firmware supports:

  1. An in-development board from AeroVironment, the Varmint. This board has an integrated Jetson Orin, but is not yet commercially available.
  2. MRO's Pixracer Pro, which has the same H7 processor.

Supporting your own board

It is possible to write your own board support package (BSP). If you do create your own support package for the ROSflight firmware, please contribute back!

Serial Port Configuration

Tip

You can see which groups you are a member of by running groups $USER on the command line.

The following bullet point is necessary:

  • Be sure your user is in the dialout and plugdev groups so you have access to the serial ports. You will need to log out and back in for these changes to take effect.
    sudo usermod -aG dialout,plugdev $USER
    

If you experience issues, you may need one or both of the next two bullet points:

  • Temporarily stop the modem-manager (Sometimes, Linux thinks the device is a modem -- this command will be effective until next boot, or until you run the command again with start in place of stop)

    sudo systemctl stop ModemManager.service
    

  • Add the custom udev rule so Linux handles the flight controller properly (copy the following as /etc/udev/rules.d/45-stm32dfu.rules)

    # DFU (Internal bootloader for STM32 MCUs)
    SUBSYSTEM=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="df11", MODE="0664", GROUP="plugdev"
    

Tip

You can permanently disable the ModemManager if you do not need it, then you won't have to disable it every time you reboot:

sudo systemctl disable ModemManager.service
Replace disable with enable to revert (i.e. if you find some other program you use needs access to it). Or you can uninstall it entirely from your system:
sudo apt purge modemmanager

Building and Flashing the Firmware

This guide assumes you are running Ubuntu 22.04 LTS, which is the currently supported development environment.

Installing the ARM Embedded Toolchain

sudo apt install gcc-arm-none-eabi

You can test the installation and check which version is installed by running arm-none-eabi-gcc --version.

Building the Firmware from Source

  1. To build the firmware, first clone the firmware repository:
    git clone --recursive https://github.com/rosflight/rosflight_firmware
    
  2. Create build directory:
    cd rosflight_firmware && mkdir build && cd build
    
  3. Build using: (board_name should be either varmint or pixracer_pro)
    cmake .. -DBOARD_TO_BUILD=<board_name> && make -j
    

Flashing firmware

Install STM32CubeProgrammer

We use the STM32CubeProgrammer to flash the flight controller.

  1. Download the programmer here. You may have to enter your email to download the software.
  2. Install the software by following the instructions in the downloaded package.

Flashing the Varmint

Needed tools

You will need an ST-Link STM programmer to flash the firmware. We use ST-Link V2, and you can find it on Mouser.

  1. Plug the end of the ribbon cable into the 6-pin slot on the Varmint. You may have to make your own cable that connects the ST-Link to the 6-pin connector.

    Danger

    The Varmint has 2 6-pin connectors. Do not connect the ribbon cable to the port closest to the power wires.

    Varmint 6-pin cable

  2. Power on the Varmint by connecting a battery to the board.

  3. Open STM32CubeProgrammer.

  4. Plug in the USB connector from the ST-Link to the computer. Select "Connect" in the STM32CubeProgrammer. This should detect the ST-Link and connect automatically. Select "Connect"

  5. Navigate to the programming page. Navigate to programming page

  6. Select the hex file that was just built and click "Open".

    /path/to/rosflight_firmware/build/boards/varmint_h7/varmint_10X/varmint10X.hex
    
    Select the previously built hex file

  7. Select the appropriate options and press "Start Programming" Select options and start programming

Flashing the Pixracer Pro

Flashing the Pixracer Pro is a very similar process to flashing the Varmint.

  1. The Pixracer Pro does not use the same 6-pin connector to connect to the ST-Link. Instead, it uses a TC2030 connector with retaining clips.

    Connectors we use

    In addition to the ST-Link V2 board linked above, we use these cables to flash the Pixracer Pro:

    1. 20-pin ribbon adapter board (connect the ST-Link to this adapter)
    2. Programming cable that connects to the adapter board
    3. TC2030 clip to attach the programming cable to the board

    Connectors for the Pixracer Pro

  2. Power on the Pixracer Pro using a USB-C port.

  3. Follow the instructions from the Varmint flashing guide.

LEDs

TODO

Update this table with the updated LED flash patterns.

The meaning of the various LEDs is summarized in the following table. The colors of the LEDs may change depending on your specific board:

LED On Off Slow Blink Fast Blink
Power (Blue) Board powered - - -
Info (Green) RC control Offboard control - -
Warning (Red) Armed Disarmed Error (disarmed) Failsafe (armed)