简体   繁体   中英

STM32F4 memory retained on programming

Is there any memory on the STM32F407VG that is retained when a new program is flashed onto the chip?

I want to store a serial number on the device that is tied to the device, not the program.

I am aware there is a hardware identifier stored on the chip, but I want to create a more relevant number.

As Etienne said in his answer, you can use the backup registers or backup SRAM but those imply having a backup power source. What I have done for the STM32F3, is use the Flash as an Emulated EEPROM. The drivers are on the ST website, you reserve a few pages of Flash as your 'EEPROM' and write whatever information you want there. On startup your device can read those values or modify them during program execution.

Described here: AN3969.(Application Note from ST, you can just google the ref. #)

A safety measure wold be to change linker file so those flash pages don't accidentally get overwritten if your code should grow larger.

您可以使用备份寄存器(20*32bits),或备份SRAM(4kbytes)。

You can put this in the OTP area, which will keep the serial number for the life of the part.

OTP功能说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM