I use my function to write a string to the eeprom bank of the stm32l073.
Directly after the function HAL_FLASHEx_DATAEEPROM_Program will be called, the sytem goes into HardFault:
Debug Stack
The address i want to write is in the correct space 0x080803b4: MemoryMap
Do you see any problem in that process? I tried also to erase this WORD before write, but same problem with that write function.
HAL_StatusTypeDef eepromDrv_WriteWORD(uint32_t address, const uint32_t* pData, uint16_t dataLength)
{
bool bSuccess = true;
uint32_t ui32Addr = 0;
HAL_StatusTypeDef status = HAL_ERROR;
HAL_FLASHEx_DATAEEPROM_DisableFixedTimeProgram(); // Only Erase befor Write, when EEPROM_READ != DATA
HAL_FLASHEx_DATAEEPROM_Unlock();
for (ui32Addr=0;ui32Addr < dataLength; ui32Addr+=4,pData++)
{
if ((HAL_FLASHEx_DATAEEPROM_Program( FLASH_TYPEPROGRAMDATA_WORD, address + ui32Addr, *pData)) != HAL_OK)
{
bSuccess = false;
}
}
HAL_FLASHEx_DATAEEPROM_Lock();
if(true == bSuccess)
{
status = HAL_OK;
}
return status;
}