cancel
Showing results for 
Search instead for 
Did you mean: 

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

RFlec.1
Associate II

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

10 REPLIES 10

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
Up vote any posts that you find helpful, it shows what's working..
RFlec.1
Associate II

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.

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
Up vote any posts that you find helpful, it shows what's working..
RFlec.1
Associate II

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.

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.

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.

I did not say that HAL library does not contain flash write & erase functions. Of course it does.

But CubeMX won't auto-generate code for that.

Hmm... I didn't find any HAL function to delete or write pages. Just Option Bytes. I couldn't even find any in HAL Documentation.