cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-G491RE Break at address "0xfffffffe" during FLASH erase

mirkoshtylla
Associate II

Hello everybody,

I'm having big troubles attempting to erase flash memory of my NUCLEO-G491RE. The message I'm getting after calling "HAL_FLASHEx_Erase" function is "Break at address "0xfffffffe" with no debug information available, or outside of program code".

If I debug and execute code from NUCLEO-G431 everything goes fine and I'm able to erase and write flash, if I copy-paste the same exact code on a project generated by the same .ioc file I get stuck to that message and the FLASH is not erased.

8 REPLIES 8
TDK
Guru

You could be erasing the vector table or other flash code your program is using. See what interrupt it’s in, if any, by looking at VECTACTIVE.

If you feel a post has answered your question, please click "Accept as Solution".

Hello @TDK​ , thank you very much for your precious help. Actually my Flash Code was mapped in Main Flash Memory and trying to erase single pages works fine. However I'm not succeding yet in writing onto the erased sectors. Should it be possible to write Flash just erasing the proper desired sector without having to erase it all? Do you suggest to keep my Program in Main Flash or to map it in an other area? Thank you!

Writing after erasing is the correct thing to do. Having user code in flash at 0x08000000 is typical.
If you feel a post has answered your question, please click "Accept as Solution".

Ok, the only thing that I've not understood yet is if it is possible to erase a single page without erasing all the flash and writing only on that page...

Yes, you can erase a single page of flash without erasing all of it. There should be HAL_FLASHEx_Erase or similar names function. Verify it was erased by reading 0xFF before writing.
If you feel a post has answered your question, please click "Accept as Solution".

Ok, thank you.

Even if the destination address in FLASH seems all erased however with the debugger I'm noticing that the highlighted piece of code is not transferring data from the origin address to flash. Here is a screen of the segment of code and flash that I'm trying to write to.

0693W00000JMErTQAX.png

Flash unlocked? Volatile pointers with the correct addresses? Hard to debug without seeing full code. Memory doesn’t update automatically in IDE.
Should be CubeMX examples. Should also be flash status flags to check.
If you feel a post has answered your question, please click "Accept as Solution".
mirkoshtylla
Associate II

This is the structure of my flash management function, it is basically copy-pasted from the example provided by ST.

0693W00000JMFVsQAP.pngSo all the proper bits are set and managed by HAL libraries. This is perfectly identical (even the data to copy) to the ST example but is not writing anything while running the example itself works fine. I can't understand what is going on since they are identical...