2022-01-24 05:17 AM
Hi,
I write some data to the 0x080A0000 (sector 5 )address which is not protected. I write the data and ı can read that data too. There is no problem with that. But if I comment out the line which writes to data to the flash and run the program. That time I could not read the data that is written before. Shouldn't the flash keep that data even the power goes off? Any suggestions.
Thank you.
Solved! Go to Solution.
2022-01-24 06:38 AM
Sure you can, see RM0399, section 4.5 for details or the examples FLASH_WriteProtection in the repository (locally or on Github).
Regards
/Peter
2022-01-24 05:57 AM
Of course you can store data in flash. However, since you have not protected that block and new firmware is loaded into the flash when a line is changed and the program recompiled, it is quite possible that the data will then be overwritten.
Regards
/Peter
2022-01-24 06:20 AM
Thanks for the answer, sir. I know that I can configure the protection settings via stm32programmer. But how can I do that in code itself? Could I change this property during the runtime?
2022-01-24 06:38 AM
Sure you can, see RM0399, section 4.5 for details or the examples FLASH_WriteProtection in the repository (locally or on Github).
Regards
/Peter
2022-01-24 11:37 AM
Option bytes can also be set using STM32CUBEPROGRAMMER and persist across resets/power downs.
2022-01-25 05:01 AM
After all, there were some settings about boot addressing in KEIL. Like, do not touch the area between address A and address B. In cubeIDE, I couldn't find it in debug configuration. It is maybe about the Linker file. I don't know about it.
Thank you.
2022-01-25 05:09 AM
OK.
When your question is answered, please mark this topic as answered by choosing Select as Best for the preferred answer. This will help other users find that answer faster.
/Peter