Skip to main content
Visitor II
July 24, 2025
Solved

STM32C031 Flash Memory Protection Fail to Reconnect

  • July 24, 2025
  • 3 replies
  • 285 views

Hi All,

 

Using STM32CubeProgrammer with the ST-LINK in SWD mode.

If the RDP flag is set to 0xBB (level 1) and programmed the programmer can no longer connect to the device.

How can I reconnect to the device to set it back to 0xAA?

 

_Carl_

    This topic has been closed for replies.
    Best answer by Bugfarmer

    Solved! (I think)

    Make sure nBOOT0, nBOOT1 and nBOOT_SEL are all set. Make sure BOOT_LOCK is clear.

    Setting the Read Protection to 0xBB works as before. However, it is possible to connect to the device again and restore it to 0xAA.

    This would appear to be contrary to the description given in RM0490 Rev 3. From what I can work out: ultimately, it was the BOOT_LOCK bit that was the problem.

     

    The next problem is how to mark this thread as solved.

    3 replies

    Super User
    July 24, 2025

    Do a full chip erase?

    Super User
    July 24, 2025

    Holding BOOT0 high during reset may let you connect with SWD, do a full chip erase, and recover the chip.

    You should be able to connect under RDP1 unless it's actively modifying option bytes, erasing flash, going into low power modes, or reassigning SWD pins.

    BugfarmerAuthor
    Visitor II
    July 25, 2025

    Hi TDK,

    BOOT0 is SWCL. Therefore I cannot control it. It is under the control of the STM32CubeProgrammer. Unless, there is a setting in that to help?

    BugfarmerAuthorAnswer
    Visitor II
    July 25, 2025

    Solved! (I think)

    Make sure nBOOT0, nBOOT1 and nBOOT_SEL are all set. Make sure BOOT_LOCK is clear.

    Setting the Read Protection to 0xBB works as before. However, it is possible to connect to the device again and restore it to 0xAA.

    This would appear to be contrary to the description given in RM0490 Rev 3. From what I can work out: ultimately, it was the BOOT_LOCK bit that was the problem.

     

    The next problem is how to mark this thread as solved.

    Super User
    July 25, 2025