Skip to main content
Akuma.6
Associate III
February 8, 2024
Question

Store data in internal flash using stm32g0x

  • February 8, 2024
  • 2 replies
  • 1003 views

Hi Team,

I am using stm32g0x mcu to store the default chunk of data in to internal specific location for our data storage. Once it reboot it should read the default data.

I tried with different mcu calls which will not synchronize with our platform.

Please share some examples based on our platform 

Regards,

Kumar 

This topic has been closed for replies.

2 replies

Tesla DeLorean
Guru
February 8, 2024

Aren't there FLASH examples in HAL / CubeG0?

Find a sector/page at the end of memory.

Shrink the size assigned to FLASH in the linker script to account for your usage outside of application space.

Use a pointer to READ the content of a STRUCTURE holding your data / configuration. ie = (void *)0x08003F00, or wherever you've placed it.

Have some default settings you can write to the location if the structure integrity indicates it is wrong or empty.

Do the basic erase/write of the content of a RAM copy of the structure into the memory space you've selected.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Tesla DeLorean
Guru
February 8, 2024
Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Pavel A.
Super User
February 8, 2024

The default chunk of data? What is this? The internal SRAM of STM32 usually survives reset, if the power is not lost. So after a reset you can expect data in the SRAM intact, without any special "calls".