Skip to main content
Maximilian Pohl
Associate III
April 5, 2019
Solved

STM32L0 use internal EEPROM

  • April 5, 2019
  • 3 replies
  • 2055 views

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.
Best answer by After Forever

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
April 5, 2019

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
April 5, 2019

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
April 5, 2019

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