cancel
Showing results for 
Search instead for 
Did you mean: 

stm32l432kc nucleo Board data retain in Internal memory..?

KINGame
Associate III

 I am using stm32l432kc nucleo Board.

Is there any option for data retain when power is turned OFF ( Non-volatile memory Type).

If yes can you please share the details and sample codes

3 REPLIES 3

You can store data in the internal FLASH, just mind its erase granularity. Read the FLASH chapter in RM, and see examples in CubeL4.

JW

KnarfB
Principal III

You may take a look at the X-CUBE-EEPROM EEPROM emulation library.

berendi
Principal

The internal flash has 2Kbytes erase blocks, so you can reserve some of them for storing data. Just decrease the flash size in the linker script e.g. by 8 Kbytes to give you 4 blocks at the end. See flash memory organization in the reference manual, and the user manual of your linker/toolchain.

There are a few drawbacks of using the internal flash though, it has a quite limited number of erase/write cycles, and writing/erasing the flash blocks program execution for a long time, nothing (not even interrupt code) runs while a flash sector is being erased.

There are 128 bytes of backup RAM available and preserved as long as there is battery power. Is there a battery holder on your board? This might be the simplest to configure and use, and you'd get a real time clock as a bonus.

And then it's possible to hook up an external $0.20 EEPROM IC.