Skip to main content
Associate II
October 15, 2024
Question

CubeProgrammer and Option Bytes Support in HEX files

  • October 15, 2024
  • 1 reply
  • 1896 views

Hello,

We are using CubeProgrammer to program firmware code and option bytes using one single HEX file. This sometimes works and sometimes does not. Example:

HEX file Option Bytes programming on STM32G491 works with CubeProgrammer 2.16, but is broken in 2.17 (the updated database file Data_Base/STM32_Prog_DB_0x479.xml broke option bytes support in v2.17).

According to this forum (and my own tests), option bytes programming is not supported on C030 MCUs, but I suspect that it might be solved with an updated Data_Base/STM32_Prog_DB_0x453.xml file(?)

So is there a document that specifies the option bytes HEX file support for the different MCUs, or is option bytes programming working "just by accident" on some MCUs?

I suspect it could work on most MCUs because the integrated boot loader officially supports option bytes flashing.

Regards,

Norbert

1 reply

Aziz BRIGUI
Technical Moderator
October 22, 2024

Hello @unterberg_rtb

 

Could you please provide the hex file you're using as well as the full PN for STM32G491.

Could you also send the hex for STM32C030, you need to make sure you're programming the actual option bytes address (@0x1FFF7800) and not the flash registry address (@040022000).

 

Aziz

 

In order to give better visibility on the answered topics, please click on 'Accept as Solution' on the reply which solved your issue or answered your question.
Associate II
October 25, 2024

Hi Aziz,

I can not send you the original HEX files due to disclosure reasons, but I will prepare two demo files to demonstrate the issue.

Norbert

 

Associate II
November 6, 2024

Sorry, I was not able to duplicate the option bytes flashing issue on version 2.17. However, I came across a new issue with option bytes and the IWDG.

The attached HEX file contains two features: It sets the user option byte IWDG_SW=0 (activates hardware watchdog), and enables the IWDG in software with a quite small periode (Prescaler=IWDG_PRESCALER_4; Reload=99).

After you flash the attached ob-fail.hex file on an STM32G491RET6, CubeProgrammer GUI can no longer erase the chip or update option bytes. The error is "Error: Mass erase operation failed.Please verify flash protection". Tried with 2.16 and 2.17. However, you are still able to erase and update the CPU using the command line interface:
STM32_Programmer_CLI.exe --connect port=SWD index=0 -ob IWDG_SW=1 --erase all

After that, CubeProgrammer GUI becomes functional again.

Norbert