2020-09-08 09:33 AM
Hi,
I am using STM32L4R5ZI MCU (Nucleo kit). My application demands non-volatile storage of few configuration parameters. I am using 2 banks mode. I want to store a double word at location 0x8100000 which is first page of bank 2. I tried the STM32L4R5ZI_NUCLEO_FLASH_EraseProgram example code that was available from ST webpage. But am getting unpredictable results. Sometimes It works. But most of the times, Erase operation was not successful. All I was trying is, ensure the double word is properly saved at first page of the 2nd bank everytime i write with new value. Why there is inconsistency in erasing the flash memory ?
2020-09-08 10:02 AM
>>Why there is inconsistency in erasing the flash memory ?
Hard to know, guessing implementation or power stability
Saving / updating configuration structure in FLASH on the L4R5 here, also doing firmware updating, not sure why your implementation fails.
Supply on NUCLEO should be fine.
2020-09-08 09:46 PM
I observed that, controller boots from System memory whenever there is erase failure. I got this by noticing controller not stopping at the breakpoint during debug. When i hit pause, ide flags "Break at address 0x1ffffxxxx with no debug information available, or outside of program code" . This confirms that controller is not booting from the flash memory. I verified the BOOT0 pin voltage level and it is as expected 0V. Then I verified the OPTR register value for nBoot1 and nBoot0 bit status. I could see nBoot1 bit is set, but in SFRs view, I couldnt see nBoot0 value. Why the controller is booting from system memory occassionally ? This is not happening everytime. When I recompile and again debug, it boots from flash memory.
2020-09-09 03:31 AM
Hello,
Verify the value of nSWBOOT0 if it's set, with the BOOT0 is 0 and when the flash is empty the system will boot from the system memory. You can check table 4 Boot modes of the reference manual to see the different boot possibilities.
Br,
2020-09-09 03:47 AM
Yes, nSWBOOT0 is set. But how it considers Flash empty, because am just modifying the configuration value that needs to be written on Page 1/Bank2.
2020-09-09 04:25 AM
Hello,
Can you share the configuration of the FLASH_OPTR register and your main if it's possible? I want to check if the bit BFB2 is set or not.
Br,
2020-09-09 04:33 AM
HI,
Pls find snapshot of the FLASH register below , taken in debug mode: BFB2 is RESET, so dual bank boot disabled.
2020-09-09 04:35 AM
2020-09-10 06:57 AM
Hello,
Can you maybe share your main? I tried the example but i couldn't see the problem you're facing.
Br,