nimaltd / ee

EEPROM emulation for stm32.
GNU General Public License v3.0
311 stars 74 forks source link

Returns false, Please add example #3

Open pooyasa opened 4 years ago

pooyasa commented 4 years ago

Hi, first of all, thank you for this library I wanted to use this to store permanent data on my STM32F030K6T6 However,EE_Write() and EE_Writes() both return false on if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD((i+StartVirtualAddress)*4)+_EEPROM_FLASH_PAGE_ADDRESS,(uint64_t)Data[i])!=HAL_OK) which is on line 172 of eeprom.c what could be the cause of the problem?

nimaltd commented 4 years ago

Do you config correctly eepromconf.h ?Send to meOn 15 Jan 2020 14:16, pooyasa notifications@github.com wrote:Hi, first of all, thank you for this library I wanted to use this to store permanent data on my STM32F030K6T6 However, EE_Write() and EE_Writes() both return false on if(HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD((i+StartVirtualAddress)*4)+_EEPROM_FLASH_PAGE_ADDRESS,(uint64_t)Data[i])!=HAL_OK) which is on line 172 of eeprom.c

—You are receiving this because you are subscribed to this thread.Reply to this email directly, view it on GitHub, or unsubscribe.

hosseinghaheri commented 1 year ago

Hi. I have the same problem with STM32F030K6T6. The ee_write function returns false in all cases.

If the microcontroller is programmed in Erase Full Chip mode. The ee_write function returns false, but the storage is done.

Pay attention to the following code (Erase Full Chip mode):

uint8_t to_write = 125;
uint8_t to_read = 0;

ee_init();

ee_write(0,1, &to_write);            // return False
ee_read(0,1, &to_read);              // to_read is 125

to_write=150;

ee_write(0,1, &to_write);            // return False
ee_read(0,1, &to_read);              // to_read is 125

eeConfig.h:

#define   _EE_USE_FLASH_PAGE_OR_SECTOR              (31)
#define   _EE_USE_RAM_BYTE                          (256)
#define   _EE_VOLTAGE                               FLASH_VOLTAGE_RANGE_3 //  use in some device