How to activate DFU Mode on Cube Orange+

Hello, I currently have a bad bootloader on my Cube Orange +. To upload a new bootloader, I want to put it in DFU mode. From what I have read online, the only way to do this is to break open the case and manually pull up the BOOT0 line on power up. Is there any way to enter DFU mode without breaking into the case, like with an ST-link or the BlackMagic Probe (https://black-magic.org/)? I do have access to the IO and FMU Debug ports through the ADS-B Carrier board.

@jclomax There is an SWD interface available on the standard Carrier board. You can find it if you take apart the plastic around the Carrier board. It is below the carrier board. The pinout of the same is as follows.
image

image

The debug ports use connector type SM06B-SURS-TF(LF)(SN)-ND

I’m not getting and communication via usb on the cube orange to windows 11.
i think i have the same issue, where can i find a cable from the swd to the pc?

you need to purchase STLink, JLink or Blacmagic probe to be able to connect through this process. If you have Cube that was Dead on arrival best to contact your reseller. If this is an issue induced through experimentation then only you need to follow above steps

1 Like

With @sidbh’s help I was able to rewrite the standard bootloader (and then upload ArduPilot) to an autopilot so I’d like to share how it was done.

  1. Purchase an STLinkv2 (search on amazon)
  2. Ensure you have an ArduPilot build environment setup
  3. If using Windows PC running WSL2 (and VSCode) as I do then you will need to download and install WSL USB Manager to allow WSL2 to access the PC’s USB ports
  4. Open the Cube’s carrier board and connect to the STLink as shown below
    stlink-cube-wiring-corrected
  5. Connect both the STLinkv2 and Cube to the PC via USB
  6. If using a Windows PC use WSL USB Manager to make the STLink’s COM port available to WSL2. SM32 STLink should appear first in the “Windows USB Devices” area. Select it and push the “Attach” button and it should move to the “Forwarded Devices” section
    wsl-usb-manager
  7. Open a WSL2 terminal and cd to the ardupilot directory and enter these commands
    • sudo apt install libusb
    • sudo apt install openocd
    • sudo openocd -f Tools/debug/openocd-h7.cfg
  8. Open a second WSL2 terminal and again cd to the ardupilot directory and enter these commands
    • arm-none-eabi-gdb ./Tools/bootloaders/CubeOrangePlus_bl.elf
    • target extended-remote :3333
    • monitor stm32h7x mass_erase 0
    • monitor halt
    • load ./Tools/bootloaders/CubeOrangePlus_bl.elf
      OR
    • monitor flash write_image ./Tools/bootloaders/CubeOrangePlus_bl.elf
  9. the commands from above would sometimes work and would sometimes not work. I often had to power cycle the STLink and repeat steps 7 and 8 but eventually I would see a message like below
    write-success-message
  10. power cycle the Cube and use MP to load the software as per usual

By the way, @sidbh said that it is much easier to instead use a JLink programmer and the software that comes with it. The key point is that you need to load the appropriate bootloader (ending in .elf) from this directory onto the board. Once that is done correctly you can use the regular MP or QGC to get AP onto the board.

Hi,
I accidentally flashed cube orange bootloader onto cube orange plus and similarly I want to upload a new bootloader.
I have a Cubepilot Kore board with cube orange plus . STLink v2 has been connected as instructed to the FMU debug pins. Cube orange plus and STlinkv2 are both connected to Linux Ubuntu 22.04 PC.
When I run this command in ardupilot directory:
sudo openocd -f Tools/debug/openocd-h7.cfg

I get an unable to connect to target error. Could you please guide me as to what might be the issue?
The log is as follows:
sudo openocd -f Tools/debug/openocd-h7.cfg
Open On-Chip Debugger 0.11.0
Licensed under GNU GPL v2
For bug reports, read
OpenOCD: Bug Reporting
Info : auto-selecting first available session transport “hla_swd”. To override use ‘transport select ’.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
Info : clock speed 1800 kHz
Info : STLINK V2J29S7 (API v2) VID:PID 0483:3748
Info : Target voltage: 3.106154
Error: init mode failed (unable to connect to the target)

1 Like

@Mos_Khan please share image of your connections. Target Voltage less than 3.3V is suspicious.

Hi,
@sidbh These are the images:




@Mos_Khan Actually I just read back your comments, recovering from loading CubeOrange bootloader onto CubeOrangePlus board is extremely tricky, even if you can SWD in. Basically to recover you will need to hold the MCU in reset and try connecting while resetting.

I don’t think reset pin is actually pinned out on the carrier board, so you will need to directly tap into the 80-pin DF17 Connector pin 7 refer The Cube Module Overview | CubePilot.

@sidbh Thank you for your guidance. Could you please elaborate on the steps you mentioned? Specifically, should I attempt to connect using the ST-Link V2 or via the USB port? Additionally, could you provide more details on how to hold the MCU in reset and connect while resetting? I would also appreciate any tips on accessing the reset pin on the 80-pin DF17 connector as referenced in the Cube Module Overview from CubePilot.

i can load any ardupilot version on my cube orange plus but i can’t connect, (it’s not showing the usual steady green led after few seconds)
proceeding with you instructions will solve my problem ?

thanks