Community forums

Flash custom SW on Pixhawk 3 Pro through debug ports


I’m trying to flash a custom SW into the Pixhawk 3 Pro FMU debug port but I can’t manage to do it.

I’m using:

  • ST-LINK v2
  • a debug adapter (scavanged from a crazyflie but I would expect it to be just a wiring adaptation that should work as long as the connectors are the same) => Crazyflie debug adapter
  • open-ocd software to flash

I end up with an error as shown below, just like if I wasn’t connected at all:

Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 2000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : Unable to match requested speed 2000 kHz, using 1800 kHz
Info : clock speed 1800 kHz
Info : STLINK v2 JTAG v28 API v2 SWIM v6 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.291700
Error: init mode failed (unable to connect to the target)
in procedure 'program' 
in procedure 'init' called at file "embedded:startup.tcl", line 495
in procedure 'ocd_bouncer'
** OpenOCD init failed **
shutdown command invoked

Am I missing something ? Should the debug adapter be a specific one ?


Hi there,

You can indeed flash a custom firmware into the Pixhawk.

We are using this driver from texane for Linux distros :

Then using that kind of command you will be able to flash the binary from address 0x8000000

st-flash write prog.bin 0x8000000

If you are compiling the PX4 repo then you can flash the device with the .PX4 compiled binary using QGroundControl

Anyway, to flash the device you can use any cheap stlinkV2 probe available on the internet (amazon, aliexpress) like this one :

NB : There are two SWDIO ports, one is for the FMU and the other one is for the IO microcontroler

Hi Paul,

Thanks for the answer.
I finally managed to flash, using a custom cable between my stlinkv2 probe (the big one) and the pixhawk 3 pro through the FMU debug port.
The problem was not the driver nor the adapter but the Crazyflie adapter/cable is not a DCD-Mini standard (even though it uses SM06B-SRSS-TB connectors).

Still, what kind of adapter do you use between your stlinkv2 and the debug port? Is there any off the shelf adapter that I can order (not that I don’t like my custom soldered cable but it could be cleaner :smiley: )?