Corrupted Opta bootloader

i tri to develop a firmware to update OPTA's application software by OTA.
Based on the "STM32H747_manageBootloader.ino" example, i think i have accidentally corrupted the factory OPTA bootloader, when i have changed the firmware. Now, my OPTA doesn't want to communicate any more by USB cable with Arduino IDE. No COM port is detected by the PC when i pug in the USB cable.

i think i have to reprogram the initial bootloader on my OPTA.
i have seen this post, to make a debugger :

How to use ST-Link to debug sketches running on Opta

Could it be a solution to connecte a ST-LINK programmer/debbuger to my OPTA ? and then trying to reprogram the good bootloader on it ?

Thanks in advance for help

Romuald

Hi romuendrotek,

Have you tried going into bootloader mode manually? Double press reset button, green LED will begin to turn on and off smoothly. Then you should be able to see COM (other than in normal mode), select it and try to upload sketch of some sort.

I hope it'll help.

Thank you Darrag212 for your reply.

Yes, i tried the double press on reset button also. The green led is always OFF.
No led, No COM-port... all is shut down :smiling_face_with_tear:
i really think i have put my code into the memory space of the boot code of the OPTA...

i bought a STLINK programmer (i don't have received it for the moment). i will solder wires to connect SWIO and SWCLK to the ST-Link and will try to program the opta_bootloader.h code which is present on STM32H247_manageBootloader.ino sketch. It's starts like that :

/* Bootloader version 25 */
const unsigned char bootloader_bin[] = {
  0x00, 0x00, 0x08, 0x24, 0x7d, 0x06, 0x00, 0x08, 0xc9, 0x06, 0x00, 0x08,
  0xc9, 0x06, 0x00, 0x08, 0xc9, 0x06, 0x00, 0x08, 0xc9, 0x06, 0x00, 0x08,
  0xc9, 0x06, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0x05, 0x00, 0x08,
  0xc9, 0x06...

i hope it will work... i will tell you again.
Unless someone knows another method?

Regards

I was in a similar situation. I built mcuboot from source for opta, flashed using the bootloader manager sketch and proceeded to brick it.

But instead of st-link I used a Raspberry Pi Pico (rp2040) to flash a working bootloader back on the opta.
The SWD pinout in the link in the first post is correct. Optionally, you can solder a breakout for nRESET if you encounter issues where the programmer fails to sync with the m7.

The connection:
pico GP1 --> opta nRESET (optional)
pico GP2 --> opta SWDCLK
pico GP3 --> opta SWDIO

Then:

  1. Download debugprobe_on_pico.uf2 from Releases at GitHub - raspberrypi/debugprobe.
  2. Bootsel-power-up pico, drag drop the file onto its drive
  3. Download/extract OpenOCD. For Windows: Download OpenOCD for Windows
  4. Run openocd.exe -f interface/cmsis-dap.cfg -c "adapter speed 1000" -f target/stm32h7x.cfg -c "program bootloader.bin 0x08000000"

The output from openocd:

Summary

openocd.exe -f interface/cmsis-dap.cfg -c "adapter speed 1000" -f target/stm32h7x.cfg -c "program bootloader.bin 0x08000000"
Open On-Chip Debugger 0.12.0 (2024-09-16) [GitHub - sysprogs/openocd: OpenOCD shipped with VisualGDB. Built with CMake.]
Licensed under GNU GPL v2
libusb1 d52e355daa09f17ce64819122cb067b8a2ee0d4b
For bug reports, read
OpenOCD: Bug Reporting
adapter speed: 1000 kHz
Info : auto-selecting first available session transport "swd". To override use 'transport select '.
Info : Using CMSIS-DAPv2 interface with VID:PID=0x2e8a:0x000c, serial=E661AC8863978628
Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: Atomic commands supported
Info : CMSIS-DAP: Test domain timer supported
Info : CMSIS-DAP: FW Version = 2.0.0
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 0 SWDIO/TMS = 0 TDI = 0 TDO = 0 nTRST = 0 nRESET = 0
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x6ba02477
Info : [stm32h7x.ap2] Examination succeed
Error: [stm32h7x.cpu0] Cortex-M CPUID: 0x0 is unrecognized
Error: [stm32h7x.cpu0] Examination failed
Warn : target stm32h7x.cpu0 examination failed
Info : [stm32h7x.ap2] gdb port disabled
Info : [stm32h7x.cpu0] starting gdb server on 3333
Info : Listening on port 3333 for gdb connections
Info : [stm32h7x.cpu0] Cortex-M7 r1p1 processor detected
Warn : [stm32h7x.cpu0] Erratum 3092511: Cortex-M7 can halt in an incorrect address when breakpoint and exception occurs simultaneously
Info : The erratum 3092511 workaround will resume after an incorrect halt
Info : [stm32h7x.cpu0] target has 71 breakpoints, 0 watchpoints
[stm32h7x.cpu0] halted due to breakpoint, current mode: Thread
xPSR: 0x01000000 pc: 0x0800067c msp: 0x24080000
** Programming Started **
Info : Device: STM32H74x/75x
Info : flash size probed value 2048k
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
Info : Padding image section 0 at 0x0801f42c with 20 bytes (bank write end alignment)
Warn : Adding extra erase range, 0x0801f440 .. 0x0801ffff
** Programming Finished **

1 Like

Hello,
My OPTA is resurrected !!! Let me share my experience :

i soldered 5 wires on the OPTA's PCB like this :

On the other side of the wires (outside the enclosure), i soldered an 20-pin HE10 Header to connect it to a ST-LINK/V2 programmer :

Then, i download the ST Microelectronics software programmer : https://www.st.com/en/development-tools/stm32cubeprog.html

Under Arduino IDE, i load the "STM32H747_manageBootloader" example sketch.
i "export the compiled binaries" to generate the ".hex" file.

And then, i program the OPTA with this ".hex" file with stm32cubeprog (don't forget to select "Hardware reset" for the "Reset mode").

In Arduino IDE, i answer "y" for yes to the question asked to update firmware.

And now it's ok, when i plug in the USB cable, my OPTA is recognized by the Arduino IDE !

i can program it as usual from USB !

i hope this can help someone else :slight_smile:

4 Likes

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.