2025-09-10 5:46 PM
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
2025-09-10 6:56 PM - edited 2025-09-10 7:51 PM
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.
2025-09-10 7:22 PM
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?
2025-09-10 7:50 PM - edited 2025-09-10 7:51 PM
Ahh, my mistake.
The "engineering bytes" section isn't available for you to program.
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.