Skip to main content
Lzhao
Associate II
September 25, 2019
Question

How to erase and modify option bytes bytes in STM32WB55CGU6?

  • September 25, 2019
  • 2 replies
  • 3153 views

0690X000009jBcIQAU.png

FLASH_CR:0690X000009jBcgQAE.png

This topic has been closed for replies.

2 replies

Remi QUINTIN
Technical Moderator
October 9, 2019

As a user you can get access (read/write) to any option bytes controlled by the CPU1.

All option bytes managed by CPU2 remain inaccessible and can’t be modified.

The OPTSTRT bit triggers the reloading of the option bytes to take into account all the changes.

Lzhao
LzhaoAuthor
Associate II
October 10, 2019

Yes, you're right. Users really can't change the option bytes managed by CPU2 directly. According to the value of FLASH_CR, you can see that there is no erase flag bit for selection bytes above. MER/PER is for flash memory. How can I erase and rewrite the option bytes managed by cpu1?

Remi QUINTIN
Technical Moderator
October 10, 2019

Set the Options Start (OPTSTRT) bit OPTSTRT in the FLASH_CR register to trigger the update of the option bytes values and wait for the BSY bit of the FLASH_SR register to be cleared.

The option bytes are located in a special part of the Flash memory (see table 9 in the RM to get the exact addresses). Programming or erasing the Flash memory is only done page per page or completely (Mass erase). So this takes time as the complete page containing the option bytes are reprogrammed. Hence the need to wait for the BSY bit to be cleared.