Skip to main content
GEORGE SANDLER
Associate III
September 11, 2025
Solved

STM32G0 Engineering bytes programming

  • September 11, 2025
  • 1 reply
  • 293 views

What is the sequence and APIs to erase and program the Engineering bytes?
There are APIs to handle Main flash, and APIs to handle OTP, but it is not clear how the Engineering bytes should be handled.

Thanks

Best answer by TDK

Ahh, my mistake.

The "engineering bytes" section isn't available for you to program.

TDK_1-1757559059183.png

It holds information like the flash size. Only a few pieces within the region are specified. For example, the unique ID resides within here. You can read out data in here just like any other memory address.

TDK_0-1757558960561.png

 

1 reply

TDK
Super User
September 11, 2025

HAL_FLASHEx_OBProgram is used to program the flash option bytes. The option bytes must be unlocked when you do this.

Here's an example which does this on the STM32F4 series. The procedure is the same on the STM32G0XX, but the option bytes will be a bit different. See the reference manual for the option bytes available on that platform.

STM32CubeF4/Projects/STM324xG_EVAL/Examples/PWR/PWR_BOR/Src/main.c at 4a006eb89e58f8b1b99fd8b34b66a5926c26196c · STMicroelectronics/STM32CubeF4

"If you feel a post has answered your question, please click ""Accept as Solution""."
GEORGE SANDLER
Associate III
September 11, 2025

Thank you for a quick answer. STM32G0B1 memory has distinct sections: 128 of option bytes; and 768 of engineering bytes. Only interested in learning how the engineering bytes programming.

Are you saying that both sections share same programming procedure?

TDK
TDKBest answer
Super User
September 11, 2025

Ahh, my mistake.

The "engineering bytes" section isn't available for you to program.

TDK_1-1757559059183.png

It holds information like the flash size. Only a few pieces within the region are specified. For example, the unique ID resides within here. You can read out data in here just like any other memory address.

TDK_0-1757558960561.png

 

"If you feel a post has answered your question, please click ""Accept as Solution""."