cancel
Showing results for 
Search instead for 
Did you mean: 

EEPROM Initialisation STM32L0

rebwarghadrzade
Associate II
Posted on June 11, 2015 at 17:11

Hi there,

I want to initialise the on chip EEPROM so I can save a number of bytes which will be Factory reset values. I don't want to use the Emulated EEPROM and I cant find any document regarding to that.

I used PIC microcontrollers before and in MPLAB there is a macro which can initialise the EEPROM with the reset values and these values may be updated later when the code is running.

So how I can program the EEPROM when I program the device?

5 REPLIES 5
Posted on June 11, 2015 at 18:30

So how I can program the EEPROM when I program the device?

Get the bytes you need into the .HEX you're delivering, and pick the ''FLASH'' algorithms for all the memory regions they are using, be it FLASH, EEPROM, external memory, whatever.

How would you get it to your .HEX file? By understanding the tools you're using. Defining memory regions in your linker scripts or scatter files. Directing content there with compiler directives, #pragma, etc. Most embedded tools have extensive documentation of how these things can be done, and there's the internet.

You could merge the data into a .HEX file with a text editor. If your initial data is device specific (serial number, calibration, etc), you can make a tool to auto-generate it, or add it to your programmer code.

You could put code in your app that writes a default set of values into the EEPROM when it recognizes the initial start up, or erased values.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
uilter
Senior
Posted on June 11, 2015 at 18:41

Hello g_Rebwar,

In my case, I read this document ( Programming manual ). This document explain the way for STM32L1. I believe it is the same thing to STM32L0, but of course that the range of address is diferente.

There is a lot of sample codes what could help you too into STM32L0xx HAL Driver.

rebwarghadrzade
Associate II
Posted on June 15, 2015 at 10:17

Hello Clive1,

Thanks for your response. I have been trying to follow your instructions but as I am new to ARM and Keil, I haven't been able to get any where.

Is there an example I could have to see how it is done or a document that guide me to achieve that?

I will be grateful if you could help me with this.

Thanks

 

rebwarghadrzade
Associate II
Posted on June 15, 2015 at 10:20

Thanks Witte,

I read through the document, there are some good explanations and code examples. However, I haven't been able to find the ones I need.

Thanks again.

rebwarghadrzade
Associate II
Posted on July 06, 2015 at 12:42

Hello Clive,

Could you give me some more advice with regard to the method you have mentioned. Are there any other ways to put the data I want to download into the EEPROM  in a .hex file? I need this for production purposes so it should be in a single hex file.