cancel
Showing results for 
Search instead for 
Did you mean: 

State of the option byte values in flash after a forced mass erase

justinx
Associate

Hi there,

I am trying to understand the state of the option byte values in flash after a forced mass erase (changing RDP from level 1 to 0) for a STM32L151 (Cat.2).

From my own investigation it appears that after a forced mass erase all the option bytes in flash are erased (0 value). The data sheet does explicitly state that the program memory and option bytes will be erased. The erased value of program on this part is 0. All good. However i notice that the RDP option byte in flash is not erased. 

Process and details below:

  * Mass erase by changing RDP from level 1 to 0 using JTAG script.

  * Cycle power.

  * Load firmware to inspect the state of the option bytes.

    OB->RDP = 0xff5500aa

    This is not erased? Why?

    OB->USER = 0x00000000

    This appears erased? i.e. it does not contain the virgin device values for BOR etc.

    FLASH->OBR = 0x007800aa

    This is the virigin device value.

    OB->WRP01 = 0x00000000

    This appears erased? i.e. it does not contain the complement of the virgin device value of 0 (no write protected sectors)

    OB->WRP23 - 0x00000000

    This appears erased? i.e. it does not contain the complement of the virgin device value of 0 (no write protected sectors)

    FLASH->WRPR1 = 0x00000000

    This is the virgin device value.

    FLASH->SR = 0x0000080c

    Flash memory module is ready.

    End of high voltage.

    Option validity error.

    This makes sense based on the above OB->*** registers not containing the appropriate complements.

Specifically what I would like to know (supporting documentation would be appreciated) is after a forced mass erase, is the user expected to restore all the option byte values in flash? If so how and when is this best done?

I am currently using a STM32L151, but i also need to know if the same rules apply to the STM32L412 and STM32G473.

Thanks

Justin

0 REPLIES 0