2020-06-19 06:21 AM
Im working on stm32l433cctt6 ,& try to save deta on internal flash memory ,but while write on flash operation it returns status error & Hard fault in HAL_FLASH_Program,Here is my Code
// Variables
uint32_t StartAddress = 0x0808F800; //start address
uint32_t data_read[20] = {0};
uint8_t input_data[10]="SSSSS"; /
uint8_t len = 0;
len = strlen((const char*)input_data);
HAL_FLASH_Unlock();
FLASH_PageErase(511,2); //Page erase before Write
HAL_FLASH_Lock();
for(int i=0; i<len; i++)
{
Write(StartAddress+i,input_data[i]); //Passing variables in function,& call write function
}
for(int i=0;i<len;i++)
{
data_read[i] = (unsigned char)Read(StartAddress+i); //Read deta
}
//Function to write & Read Deta
void Write(uint32_t Address,uint32_t Data)
{
HAL_FLASH_Unlock();
HAL_FLASH_Program(FLASH_TYPEPROGRAM_FAST,Address,Data);
HAL_FLASH_Lock();
}
uint16_t Read(uint32_t address)
{
uint16_t Flash_Read;
Flash_Read = *(uint32_t*)address;
return Flash_Read;
}
How to solve this problem,Please give me any suggetion
2020-06-19 07:06 AM
There is no EEPROM in the L4 series...
2020-06-19 09:59 PM
I'm save deta on internal flash memory & according to deta sheet there is flash memory
2020-06-19 10:15 PM
Im used in my code flash memory by mistake Im write there EEPROM so, please give me any suggetions.
2020-06-20 03:14 AM
Read the reference manual on how the flash on L4 must is programmed and then look at your code once more...
2024-03-19 05:26 AM
have you resolve this?