cancel
Showing results for 
Search instead for 
Did you mean: 

How to persistently write into option byte BOOT_ADD0/1

Gahlen Feld
Associate II
Posted on June 13, 2017 at 14:12

Hello,

when reading out FLASH_OPTCR1 register I get boot addresses 0x00200000 and 0x00100000 for BOOT_ADD0 and BOOT_ADD1.

Now I am doing the option byte unlock procedure and the OPTLOCK-bit in FLASH_OPTCR is cleared to 0.

Then I write a new boot address for BOOT_ADD0 and lock the option byte by setting OPTLOCK-bit in FLASH_OPTCR.

When reading out FLASH_OPTCR1 I get the new boot address for BOOT_ADD0 (and the old for BOOT_ADD1).

But when I reset the MCU, my change to the BOOT_ADD0 is not persistently saved but the original value is retained.

What is the right procedure to store the boot addresses persistently?

Tank you in advance,

Gahlen.

#persistent #option-bytes #boot_add0
1 ACCEPTED SOLUTION

Accepted Solutions
Uwe Bonnes
Principal III
Posted on June 13, 2017 at 16:30

I miss FLASH_OPTCR_OPTSTRT getting set to initiate programming. Reread the reference manual.

View solution in original post

3 REPLIES 3
Uwe Bonnes
Principal III
Posted on June 13, 2017 at 16:30

I miss FLASH_OPTCR_OPTSTRT getting set to initiate programming. Reread the reference manual.

Posted on June 13, 2017 at 17:07

this sounds good, I will try it tomorrow morning and yes, I will also read the reference manual (obviously I missed this section when reading it)

Posted on June 14, 2017 at 11:11

you are right! when using the OPTSTRT bit it persistently writes the addresses into flash memory -> THANK YOU!

Initially I was confused since the reference manual speaks of 'user option operation' regarding the OPTSTRT bit and I associated it with the user options bytes only (but this was wrong)