[SOLVED] Program option bytes for STM32F042G6

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] Program option bytes for STM32F042G6

    Hi,

    I'm trying to program the option bytes of a STM32F042G6 with the Segger Flasher and J-Flash. I started with downloading the STM32 Unlock project: wiki.segger.com/images/9/9b/STM32F0_Unlock.jflash, changed the device, etc. Programming seams to work. But the option bytes fail to program correctly.

    To program my suggested content I changed

    Source Code

    1. InitStep14_Action = "Write 16bit"
    2. InitStep14_Value0 = 0x1FFFF800
    3. InitStep14_Value1 = 0x000055AA
    4. InitStep14_Comment = "55AA = ROP Level 0."
    to

    Source Code

    1. InitStep14_Action = "Write 32bit"
    2. InitStep14_Value0 = 0x1FFFF800
    3. InitStep14_Value1 = 0x807F55AA
    4. InitStep14_Comment = "55AA = ROP Level 0."

    In the ExitStep I added a "Verify 32bit" on the address and value. But the verify fails with other content.

    I have used J-Link/J-Flash Version V6.52e (2019-10-16)

    Any ideas or solutions? Whats wrong with this?
  • Hi,
    Thank you for your inquiry.

    The problem might be, that you are writing a "0" to bit 23, which is reserved and therefore supposed to be written "1" (at least this is stated by the manual).
    Therefore you are supposed to write "0x00FF55AA" instead of "0x807F55AA".

    Example:

    Source Code

    1. InitStep14_Action = "Write 32bit"
    2. InitStep14_Value0 = 0x1FFFF800
    3. InitStep14_Value1 = 0x00FF55AA
    4. InitStep14_Comment = "Set user and read protection option bytes to production value"

    Does this solve the issue?

    Best regards,
    Fabian
    Please read the forum rules before posting.

    Keep in mind, this is *not* a support forum.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support you can contact us via our support system: segger.com/ticket/

    Or you can contact us via e-mail.