Skip to main content
Associate
July 28, 2024
Solved

Programming the STM32WB with Openocd

  • July 28, 2024
  • 1 reply
  • 2359 views

Hi,

I need to program an STM32WB from a Raspberry Pi from the command line, preferably Python. I have got it up and running with my STM32FG0 but having no luck with the WB. From my understanding I need to:

  1. Program BLE Stack using FUS (Not sure how to do this using OpenOCD)
  2. Erase Application Coprocessor (Are there any specific flash banks or addresses I need to be aware of?)
  3. Program Bootloader (Should be simple)
  4. Program Application (Ideally I can do this Over The Air using the RPi's BLE but will settle for using OpenOCD if that isn't possible)

I have tried using the STM32CubeProgrammer but that doesn't run on the Raspberry Pi.

 

Any help or advice on the above would really help!

Thanks,

Best answer by Lubos KOUDELKA

Hi,
please see few slides with installation guidance. Please note I was testing with RPI zero 2W, for other models setting of Box64 may differ(as described on Box64 github page). 

Best regards,
Lubos

1 reply

Lubos KOUDELKA
ST Employee
August 15, 2024

Hi,
I can suggest you two alternatives:
1) Stay with OpenOCD, FUS/stack programming solve in the same way how it's done in STM32CubeProgrammer - load FUS operator binary as CPU1 code, then load new CPU2 binary and somehow (button, writing RAM variable) activate FUS using FUS operator in CPU1
2) Using box64 install STM32CubeProgrammer and use STM32CubeProgrammer API. From my perspective more universal approach, but as STM32CubeProgrammer is emulated (and I used Raspberry Pi zero 2W during my test), execution is bit slower.

I'm able to share with you more guidance for both options.

Best regards,
Lubos

mrchipsAuthor
Associate
August 30, 2024

Hi Lubos,

 

Thank you for your reply. I think Box64 sounds like a better alternative as it gives me more freedom to use the CubeProgrammerCLI as intended, rather than using OpenOCD which doesn't seem the most reliable from some of my other work with STM32's. I can accept a slightly slower execution if it gives me a more reliable solution.

 

Please could you share a bit more on how you got this approach to work? I am unfamiliar with box64 and emulation in general on the Pi.

 

Thanks,

Lubos KOUDELKA
Lubos KOUDELKABest answer
ST Employee
September 3, 2024

Hi,
please see few slides with installation guidance. Please note I was testing with RPI zero 2W, for other models setting of Box64 may differ(as described on Box64 github page). 

Best regards,
Lubos