cancel
Showing results for 
Search instead for 
Did you mean: 

Infinite loop when read or write word in internal EEPROM STM32L0

parobin
Associate II

Hi!

When I read or write a word in the internal STM32L052 EEPROM, I enter into infinite loop but not for all addresses (0x08 and 0x10 work well) . Whereas when I read or write byte, all addresses work very well.

#define DATA_EEPROM_START_ADDR  0x08080000

HAL_StatusTypeDef write_eeprom_byte(uint32_t address, uint8_t data)

{

  HAL_StatusTypeDef status;

  address = DATA_EEPROM_START_ADDR + address;

  if(HAL_FLASHEx_DATAEEPROM_Unlock() == HAL_OK){ 

   status = HAL_FLASHEx_DATAEEPROM_Program(TYPEPROGRAMDATA_BYTE, address, data);

   HAL_FLASHEx_DATAEEPROM_Lock();

  }

  return status;

}

HAL_StatusTypeDef write_eeprom_word(uint32_t address, uint32_t data)

{

  HAL_StatusTypeDef status;

  address = DATA_EEPROM_START_ADDR + address;

  if(HAL_FLASHEx_DATAEEPROM_Unlock() == HAL_OK){

   status = HAL_FLASHEx_DATAEEPROM_Program(TYPEPROGRAMDATA_WORD, address, data);

   HAL_FLASHEx_DATAEEPROM_Lock();

  }

  return status;

}

Any idea of this problem ?

0 REPLIES 0