cancel
Showing results for 
Search instead for 
Did you mean: 

CubeProgrammer and Option Bytes Support in HEX files

unterberg_rtb
Associate III

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

4 REPLIES 4
Aziz BRIGUI
ST Employee

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.

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

 

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

Hello Aziz,

Option Bytes Programming still fails on the STM32C011.

Attached you find The HEX file I used. This file contains just the option bytes FLASH segment. When we flash this on out board, the Cube Programmer reports success, but the option bytes did not change. A verify fails.

MCU:  STM32C011F6U6 

Programmer: STM32CubeProgrammer 2.17.0 (Windows GUI).

Option Bytes set by the HEX: RAM_PARITY_CHECK=0 BOR_EN=1 BORR_LEV=2 BORF_LEV=2

Regards, Norbert