Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
7 years, 8 months ago.
Nucleo-L031K6 internal EEPROM
Hi in my project, I need to store data to internal eeprom of my board Nucleo-L031K6. I have tried this code:
HAL_StatusTypeDef writeEEPROMByte(uint32_t address, uint8_t data) { HAL_StatusTypeDef status; address = address + 0x08080000; HAL_FLASHEx_DATAEEPROM_Unlock(); //Unprotect the EEPROM to allow writing status = HAL_FLASHEx_DATAEEPROM_Program(TYPEPROGRAMDATA_BYTE, address, data); HAL_FLASHEx_DATAEEPROM_Lock(); // Reprotect the EEPROM return status; } uint8_t readEEPROMByte(uint32_t address) { uint8_t tmp = 0; address = address + 0x08080000; tmp = *(__IO uint32_t*)address; return tmp; }
but it's work fine for me only for address 0. Can someone suggest me whats I can do? .....or alternative code? Thanks
Please add
posted by Erik - 05 Mar 2017<<code>> and <</code>>
(on seperate lines) around your code to make it readable.