Firmware Update Protocol

I’m trying to write my own firmware loading application to interact with the stock bootloader (FMUv5 I think).

I think I’m overlooking some detail because almost everything except booting up with the new firmware is working.

I can successfully put my pixhawk 4 mini into bootloader mode using a mavlink command.
I can reboot out of bootloader mode by sending PROTO_BOOT.
I can erase the existing firmware.
When I transfer new firmware (so far just the same most recent stable firmware QGC downloads and transfers) I get back the correct CRC code.
When I try to reboot, my pixhawk 4 mini just stays in bootloader mode even though the PROTO_BOOT command responds with PROTO_OK (and I have to load new firmware using QGC to recover).

Pseudocode steps
Enter Bootloader mode
Send PROTO_GET_SYNC
Get Bootloader size using PROTO_DEVICE_FW_SIZE
Send PROTO_CHIP_ERASE
Send new firmware 1.11.2px4_fmu-v5_multicopter.px4 64 bytes (PROTO_PROG_MULTI_MAX) at a time formatted PROTO_PROG_MULTI, bytes_in_next_segment, next_piece_of_firmware_file, PROTO_EOC
Verify the CRC (calculated with spare bytes filled with 0xFF)
Send PROTO_BOOT and PROTO_EOC to reboot

Anyone see anything I’m missing or have suggestions for what to check?

My advice would be to examine the QGC code that does this as there could be some subtle things that must be done.