Failure of CHIP_ERASE and PROG_MULTI Commands When Using Custom Application to Upload .apj Files on Pixhawk 6C CUPE Plus Orange

m working on a custom application to upload .apj files to Pixhawk 6C CUPE Plus Orange using the Bootloader protocol. The application is built using Qt QML + C++.

  • I am using the official PX4 Bootloader protocol:

namespace BL {
const uint8_t INSYNC = 0x12;
const uint8_t OK = 0x10;

const uint8_t GET_SYNC = 0x21;
const uint8_t CHIP_ERASE = 0x23;
const uint8_t PROG_MULTI = 0x27;
const uint8_t REBOOT = 0x30;

const uint8_t EOC = 0x20;
const int PROG_MULTI_MAX = 64;
}

Current Behavior:

  • The serial port opens correctly.

  • GET_SYNC and REBOOT commands work and respond correctly with 12 10.

  • However, both CHIP_ERASE and PROG_MULTI commands fail, and I receive 12 13 (INVALID) or FAILED responses.

Example output:

Opened port: COM13 : Pixhawk6C
Opened port: COM14 : Pixhawk6C
MAVLink reboot-to-bootloader sent to SYS_ID=1 COMP_ID=1
Starting scan…
Port opened: COM12 (Pixhawk6C-BL)
:right_arrow: Sending INSYNC+GET_SYNC…
:left_arrow: GET_SYNC response: 12 10
CHIP_ERASE (takes ~6 seconds)…
:left_arrow: CHIP_ERASE response: 12 13 ← FAIL
:right_arrow: SET_ADDRESS 0x08004000…
:left_arrow: SET_ADDRESS response: 00 00 00 00 12 10 ← FAIL
Writing Firmware (PROG_MULTI)…
resp 12 13 12 13 ← FAIL at offset 0
Sending REBOOT command…
:left_arrow: REBOOT response: 12 10

apj sounds like ArduPilot. Ask over in discuss.ardupilot.org.