7.3. FCU Firmware

7.3.1. Building the Firmware

Todo

Add instructions for different FCUs, especially PixHawk 6C

Assuming the PX4-Autopilot firmmware has been cloned and the build tools has been installed as described in PX4 Setup, building the firmware for the PixRacer is done by

$ make px4_fmu-v4_default

Since the FCU is connected with the Raspberry Pi via USB, it is possible to flash new firmwares directly from the Raspberry Pi.

In the PX4-Autopilot repository is a script to do this: Tools/px_uploader.py.

Hint

It is quite handy to have this script in ~/bin on the Pi. Make sure that this directory is in PATH.

  1. Copy the firmware you want to flash to the Raspberry Pi (for example with scp).

  2. Reboot the FCU into bootloader mode via its shell (QGroundControl or debug port)

    screen /dev/fcu_debug 57600
    
    reboot -b
    

    The FCU should stop flashing slowly in green and start flashing rapidly in some weird color.

  3. Flash the firmware

    px_uploader.py --port '/dev/ttyACM*' px4_fmu-v4_default.px4
    

    Attention

    Make sure you have single quotes around the port name. Otherwise the shell resolves the wildcard before the python script is executed. Alternatively choose the port directly, probably /dev/fcu_usb.

7.3.2. Exiting Bootloader

In some cases the FCU might get stuck in bootloader mode. In this case send the reboot sequence to the bootloader.

Run

python3

and execute the following lines:

import serial
s = serial.Serial('/dev/fcu_usb', 115200)
s.write(b'\x30' + b'\x20')
quit()