2

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.

5
  • More relevant to what? When are you planning to change it (if it's not tied to the program)? Is your program meant to run on several different versions of the device? Commented May 22, 2014 at 22:08
  • In general, you should check your project settings (the linker settings in particular), and/or your project's linker command file, which defines the different memory regions within your program. Both of these may have different structure on each IDE. For example, if you're using IAR, then your project's linker command file is .icf. Commented May 22, 2014 at 22:12
  • The program will be running on many of the same chip Commented May 22, 2014 at 22:44
  • So under what circumstances are you planning to change this number, and for what reasons (under these circumstances) do you want to make it independent from the version of your program? Commented May 22, 2014 at 22:47
  • The number won't change. Is the version number stored on the chip somewhere as well? Commented May 22, 2014 at 23:27

3 Answers 3

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

You can use the backup registers (20*32bits), or the backup SRAM (4kbytes).

Comments

0

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

OTP function description

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.