Skip to main content
MBhir.11
Associate III
Mar 5, 2021 10:33 AM UTC
Solved

EEPROM in STM32CUbe IDE

Hi,

I had requirement of storing some application data in to EEPROM of MCU.

I am using STM32L151RCT6 MCU for my application.

Please suggest me any tried examples on this?

This topic has been closed for replies.
Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
Mar 9, 2021 4:04 PM UTC

STM32CubeIDE and STM32CubeMX only overwrite their own code, not the one you inserted, when you regenerate the project - and have followed the conventions. If your own code is concerned, you have apparently inserted it outside of the USER CODE blocks.

You could refer to this hand-on, step 6, if you are interested how user code should be inserted. Alternatively, you can find this information in UM1718, appendix B.1

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

3 replies

Mike_ST
ST Technical Moderator
Mar 5, 2021 3:52 PM UTC

You can check the examples within the STM32L1 package available here:

https://www.st.com/en/embedded-software/stm32cubel1.html

And have a look at this example : Projects\STM32L152D-EVAL\Examples\FLASH\FLASH_EraseProgram

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
MBhir.11
MBhir.11Author
Associate III
Mar 9, 2021 7:25 AM UTC

Hi ,

Thanks for your reply.

I have one doubt about STM32cube IDE tool.

first time i created the LED toggling code and in main i added the HAL function to toggle that GPIO.

After that i changed the debug mode from JTAG 5 pin configuration to serial wire configuration and generated the project once again.

After generating, the main file will overwrite because it has system configuration , clock and peripheral configuration.

I need user defined program in the main file should not erase/over write .

How to manage that ?? i have huge algorithm in main and it should not overwrite every time.

Please suggest me any settings are needed in the tool?

Peter BENSCH
Peter BENSCHBest answer
ST Technical Moderator
Mar 9, 2021 4:04 PM UTC

STM32CubeIDE and STM32CubeMX only overwrite their own code, not the one you inserted, when you regenerate the project - and have followed the conventions. If your own code is concerned, you have apparently inserted it outside of the USER CODE blocks.

You could refer to this hand-on, step 6, if you are interested how user code should be inserted. Alternatively, you can find this information in UM1718, appendix B.1

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.