STM32H730VBT6 write user settings in FLASH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-18 8:37 AM
I couldn’t figure out how to write a simple code to write some bytes at the end of the Flash on my STM32H7. I don’t need much bytes, only one uint32_t.
I tried using HAL_FLASH_Program by unlocking the flash first but couldn’t make it work..
Any help?
- Labels:
-
Firmware
-
STM32CubeIDE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 5:37 AM
The STM32H735x would be the closest proxy, but any of them where you limit yourself to the one sector would suffice.
The Value Line parts share the same die as others but less of the Flash is tested to save time on the test equipment and improve throughput.
Up vote any posts that you find helpful, it shows what's working..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 5:59 AM
Would Option Bytes by a solution to my problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 7:02 AM - edited ‎2023-10-19 7:08 AM
> Would Option Bytes by a solution to my problem?
Option Bytes - not at all. A similar topic was here recently, about some other STM32. A short summary: unless the firmware install procedure has filled the whole flash page, you can find properly aligned empty space past the firmware image and write your data there. Properly aligned here means on 32 bytes boundary. Write also in multiples of 32 bytes (256 bits).
Also, as Tesla DeLorean noted, "value line" STM32H7 can actually have more than one flash page, but its up to you to find them and verify they are working. YMMV.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 7:30 AM
Writing at the end of the firmware sounds like a great idea.
Do I need to erase the bytes first? Or is it a simple as :
uint32_t data[8] = { 0x123456778,
0x123456778,
0x123456778,
0x123456778,
0x123456778,
0x123456778,
0x123456778,
0x123456778,
};
void writeUserSettings(uint32_t* data, uint32_t address)
{
HAL_FLASH_Unlock();
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FLASHWORD, address, data);
HAL_FLASH_Lock();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 8:06 AM
As simple as. Locate an empty place and write.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 8:41 AM
Can you be more specific? I know the address where I want to write but don’t know how to
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 8:49 AM
Yes. Unlock, then write. Then lock (optionally).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2023-10-19 9:54 AM
The memory must be in an erased state, and then you get one-shot writing it. Perhaps check content first?
When you write/download your test app in the debugger it's going to erase the memory within the whole 128KB sector. You don't need to erase it again, as this will also erase your application, but you'll get one chance to write each block of 32-bytes. You can walk forward, or backward, within memory and write those slots.
Up vote any posts that you find helpful, it shows what's working..

- « Previous
-
- 1
- 2
- Next »