Skip to main content
Graduate
February 19, 2025
Solved

Failed to erase memory on Nucleo-FR446RE

  • February 19, 2025
  • 2 replies
  • 1463 views

Hello, 

A small disclaimer before beginning, this is my very first project on STM32, and my experience (currently being a student) with embedded systems as a whole is quite limited, so if I omit any important information, please indicate it for me. 

I'm currently trying to familiarize myself with the Nucleo-FR446RE, building the project seems to go on pretty nicely, but whenever I try to debug the code in order to flash it on the FR446, I get the following error : 

Problem during debugging (1)Problem during debugging (1)

More specifically I get the following error related to the failure to erase the memory :


Debugging error (2)Debugging error (2)

Other, maybe unrelated potential solutions that I've tried would be : 

  • Use STM32CubeProgrammer in order to verify the flash memory protection, I have correctly disabled the protection
  • The ST-LINK firmware is up-to-date (tried downgrading it as well)
  • I have replaced the cable numerous times, and verified the correct placement of jumpers on the board
  • Tried debugging on an entirely new board and on a new, completely unrelated project

What's weird is that whenever I try to flash the .elf file using STM32CubeProgrammer for the first time after connecting the ST-LINK, it works correctly. However, if I attempt to flash it again later, the aforementioned error occurs.

If anyone could provide some pointers on other potential solutions, I would greatly appreciate it.

 

On a sidenote, the debugging settings are as follows : 


Debugging settingsDebugging settings

    This topic has been closed for replies.
    Best answer by mƎALLEm

    Hello,

    Its seems the write protection is enabled in the option bytes.

    This is what I have as configuration:

    SofLit_0-1740042541127.png

    Unchecked: the sector is write protected.

    I'm attaching the option bytes that you can upload to your board in attachment.

    You can read this article on how to upload it.

     

    2 replies

    Technical Moderator
    February 19, 2025

    Hello @Edzzio and welcome to the community,

    Did you try to connect and erase the MCU with STM32CubeProgrammer tool? try it and tell us what do you get?

    EdzzioAuthor
    Graduate
    February 19, 2025

    Hello @mƎALLEm,

    Thanks for the quick response !

    I did try to erase the entire chip's flash memory, as well as manually erasing individual sectors to find the culprit (if that is of any use), and in both cases I had the same error.

    More specifically, here would be the error message : 

    Error messageError message

    Could it be a hardware issue ? Or maybe I could try the ST-LINK Utility to check on the R-W permissions (although I have read that it wasn't recommended).

    Technical Moderator
    February 20, 2025

    Hello,

    When you connected with STM32CubeProgrammer, what is the target voltage shown:

    SofLit_0-1740038326453.png

    What about the availability of these jumpers?

    SofLit_1-1740038397109.png

    How did you power the board? over STLINK? or VIN pin?

    Did you modify options bytes?

    Did you modify something on the board?

    Technical Moderator
    February 20, 2025

    I had the same message by activating the write protection:

    SofLit_0-1740047711960.png

    Please ensure you apply the changes you set in the option bytes by clicking "Apply" button. Then you can disconnect and reconnect again and recheck the write protection option bytes.

    So, please follow the steps described in the article I shared above o, how to restore the option bytes.

    EdzzioAuthor
    Graduate
    February 20, 2025

    The change of Option Bytes seemed to have worked on STM32CubeIDE but not on STM32Programmer, as I am now able to debug my project, and the flash memory is correctly erased. 

    I thank you for your time, I will mark the Option Bytes change as the main solution.