Skip to main content
RFlec.1
Associate III
October 26, 2022
Question

How To use EEPROM emulation in STM32F0xx (AN4061) with STM32CubeIDE

Hello!

I downloaded the code and documentation to AN4061 but I can't compile it in STM32CubeIDE. The Project uses an STM32F051, CubeMX and HAL. The definitions and functions used in the code are not available in HAL and the HAL_FLASH or HAL_FLASHEx Drivers don't seem to support the functionality of AN4061. Meaning there are no functions to delete or write a Page, just the Option Bytes. What am I missing? Is there a possibility to add another flash driver to the project? There doesn't seem to be anything in the available software packages.

Many Greetings!

Remo

This topic has been closed for replies.

10 replies

Tesla DeLorean
Guru
October 26, 2022

Check what stm32f0xx​_hal_conf.h is pulling in.

​

Consider just managing the Flash and structures you want to save more directly.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
RFlec.1
RFlec.1Author
Associate III
October 26, 2022

HAL_FLASH_MODULE_ENABLED is defined. But also the HAL Documentation for STM32F0 MCUs doesn't mention any of the functions used in AN4061.

With your second statement you mean digging into the reference manual and try a more low level approach? Yeah, maybe, when there is no driver available anymore this would probably be the only remaining solution.

Tesla DeLorean
Guru
October 26, 2022

Not sure.

I'm using L0 parts over F0 ones​.

I'd have to imagine ST has the EE EMU​ stuff for the F0, or Cube can autogen something.

Tips, Buy me a coffee, or three.. PayPal Venmo (See Profile) Up vote any posts that you find helpful, it shows what's working..
RFlec.1
RFlec.1Author
Associate III
October 26, 2022

AN4061 is specifically for F0.

CubeMX does not have any settings for FLASH. Or at least I didn't find anything. That is actually my question.

Pavel A.
October 26, 2022

This is correct. CubeMX does not deal with writing or erasing functionality. You add all that manually. Please see examples in the STM32Cube package (installed by CubeMX or CubeIDE) and other numerous projects on github and so on.

RFlec.1
RFlec.1Author
Associate III
October 26, 2022

Ok, thanks! I just thing it's a bit curious that an older StdPeriph_Driver included in AN4061 would contain functions to erase and write flash data and the newer HAL doesn't.

waclawek.jan
Super User
October 27, 2022
RFlec.1
RFlec.1Author
Associate III
October 28, 2022

Yeah, OK, HAL Documentation for FLASH su cks. I now switched to searching in the header files and other online resources. I also discarded the idea that I need EEPROM emulation. There are only few settings to save and even with the limited write operations available on FLASH it will last for more than a livetime.