Servers by jDrones

Issues with Flashing Pixhawk4 via RPi

For a school project I’ve written some simple code to flash onto a Pixhawk 4 controller which controls a UAV. However, everytime I want to tune something differently I have to power off, walk up, disconnect, flash with new code, connect, and power on. I’m guessing there’s a way to flash this remotely with a RPi (preferably a Zero), but I’m not sure where to start. Is it as simple as building the code on the RPi and connecting it via USB to the Pixhawk, then SSHing into the Pi, flashing, and sending a command to restart the Pixhawk?

I don’t know enough about it and don’t have a ton of money so I’m a bit afraid of bricking it by trying a bunch of guesses, but any advice or a point in the right direction would be very much appreciated.



Yes, exactly as you’ve described, using the script, or —upload cli argument if you use the companion computer to compile your code.

1 Like

Which is exactly how the Solo loads firmware as well actually.


Thanks James. Does this mean I can just use the Pi as a pass-through instead of building the code on it? I think that is how I’m reading your line “…or -upload cli argument if you use the companion computer to compile your code”, meaning since I’d prefer the Pi to not compile the code I would use the script on the compiled code. For example, compiling the code on an off-UAV laptop and using the Pi to flash through this script. Would I be able to “simply” transfer the compiled file to the Pi and upload from there?

I ask because the code on the laptop hasn’t been managed appropriately during development, and so I keep running into troubles making it compile on the Pi. I thought if this were feasible it would save me the headache of getting the Pi on the same page package-wise (or whatever the other problems may be) as the laptop.

Thanks again

Yes: just grab your apj file from wherever it is and get it onto the Pi.
You’ll need to check the bootloader source code to figure out which serial port on the flight controller has flashing enabled. I think it’s only USB and telem2.



Servers by jDrones