Skip to main content
Maximilian Pohl
Associate III
Apr 5, 2019 12:15 PM UTC
Solved

STM32L0 use internal EEPROM

Hello,

i just want to use the Internal EEPROM of my STM32L052.

I followed the short description in the STM32CubeMX manual. But it is not working.

Here my small code example

 HAL_FLASHEx_DATAEEPROM_Unlock();
 HAL_FLASHEx_DATAEEPROM_Erase(0x08080000U);
 //HAL_FLASHEx_DATAEEPROM_EnableFixedTimeProgram();??
 HAL_FLASHEx_DATAEEPROM_Program (FLASH_TYPEPROGRAMDATA_WORD, 0x08080000U, 0x123456);
 HAL_FLASHEx_DATAEEPROM_Lock();
 HAL_Delay(100);
 xprintf("EEPROM 0:\n\r",(*(__IO uint32_t*) 0x08080000U));

Sadly it is not working. There is also no good example which helps me with that.

Any ideas?

Best regards

Max

This topic has been closed for replies.
After Forever
After ForeverBest answer
Senior III
Apr 5, 2019 1:04 PM UTC

Try to debug into or print the values which the HAL functions return to find out which one returns an error.

Also, I don't know how your xprintf works, but if it's like the standard printf then I don't see any format string (for example %u) there.

3 replies

After Forever
After ForeverBest answer
Senior III
Apr 5, 2019 1:04 PM UTC

Try to debug into or print the values which the HAL functions return to find out which one returns an error.

Also, I don't know how your xprintf works, but if it's like the standard printf then I don't see any format string (for example %u) there.

Maximilian Pohl
Associate III
Apr 5, 2019 1:28 PM UTC

Omg, i´m such an idot. youre right. now it is working ( it was all the time;( )

sorry for that stupid mistake.

Thank you

After Forever
Senior III
Apr 5, 2019 1:33 PM UTC

No worries, "stupid" mistakes happen especially after long hours of work (: