cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L0 use internal EEPROM

Maximilian Pohl
Associate II

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

1 ACCEPTED SOLUTION

Accepted Solutions

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.

View solution in original post

3 REPLIES 3

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 II

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

sorry for that stupid mistake.

Thank you

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