After I write to flash memory I cannot do it again upon reflashing entire program onto chip, how to avoid this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 2:57 AM
I have an STM32F407 board and have worked out how to flash a certain flash-sector as well as erasing it.
My problem is that whenever I have written to flash, and I reboot my board, I cannot flash again until I reflash the entire programme from STM32CubeIDE. As far as I've understood it is that whenever flash is accessed it will lock it afterwards to avoid unauthorized access. But I want to be able to do it indefinitely without having to reflash the code. How do I do this?
My code is at the moment:
FLASH_Unlock();
FLASH_OB_Unlock();
FLASH_EraseSector(FLASH_Sector, VoltageRange);
flashFunction(param);
FLASH_Lock();
FLASH_OB_Lock();
Any suggestions what to do to be able to write to flash how much I want without reflashing?
- Labels:
-
Flash
-
STM32F4 Series
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-01 4:26 PM
Read the reference manual and debug the code. Look at FLASH status register, especially the error bits.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-03 11:00 AM
Hello @William Bäckström​,
As mentioned in the reference manual, the main Flash memory block is divided into 4 sectors of 16 Kbytes, 1 sector of 64 Kbytes, and 7 sectors of 128 Kbytes. You can program/erase the sectors word by word using HAL_FLASH_Program(); HAL_FLASHEx_Erase();
Maybe, jumping and executing your code from RAM could be a better choice.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-03 2:58 PM
The person cannot implement a simple thing, but you are suggesting a more complex and rarely necessary one. Great advice!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-03-05 2:13 PM
Thank you for your feedback @Piranha​. Although, that's an interesting opinion, but I prefer to help anyways. We are here to help each other!
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
