Hello,
I need to update a part of the bootloader's memory via the app. So I am using the app to read the bootloader configuration part of the memory and then update it for the next reset. The issue is that I can read the memory area without problems, but when writing to it the function FLASH_Program returns a erros (kStatus_FTFx_CommandFailure) .
Can you please help me finding out where is the issue?
In the attachment there is the app. Funny thing is that if I comment the line 24 (where I update the delay with 2) the flashing process does not have any problem.
Also here is the memory layout of the app
Thank you for the help
Regards
Solved! Go to Solution.
Hi @joao_ribeiro ,
Flash_program only write data to flash. You must erase the whole sector first. Flash is not eeprom.
Regards,
Jing
Hello,
Sorry to repost, but I am really stuck here.
I have tried a couple of new scenarios that might help figuring out the issue. It should be related with the memory write process:
a. I can read from the bootloader memory section without a problem, so the memory mapping should be ok;
b. If I write exactly what is in memory , there is no issue;
c. If I update one of the values in memory and try to write it back in memory it does break at the function FLASH_Program;
d. If I use the same code in the attachment but without the bootloader it does work fine, but if I change a bit the code in order to add ++1 at the memory value and program it again, it does fail again. And it fails when I reset and try to read the memory that in fact was not correctly written the last time.
It must be a simple fix, but I honestly can't see it right now.
Thank you for the help.
Regards
Hi @joao_ribeiro ,
Flash_program only write data to flash. You must erase the whole sector first. Flash is not eeprom.
Regards,
Jing
Hi @jingpan ,
You are correct. I missed that point.
After adding the functions FLASH_Erase and FLASH_VerifyErase before the FLASH_Program, the issue was gone.
Thank you very much for the help
Regards