cancel
Showing results for 
Search instead for 
Did you mean: 

Store data in internal flash using stm32g0x

Akuma.6
Associate III

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 

3 REPLIES 3

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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Pavel A.
Evangelist III

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".