cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L433CCT6 flash memory write Problem

PMOHO.1
Associate II

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

5 REPLIES 5
Uwe Bonnes
Principal III

There is no EEPROM in the L4 series...

I'm save deta on internal flash memory & according to deta sheet there is flash memory

PMOHO.1
Associate II

Im used in my code flash memory by mistake Im write there EEPROM so, please give me any suggetions.

Piranha
Chief II

Read the reference manual on how the flash on L4 must is programmed and then look at your code once more...

siddhesh_ekhande
Associate

have you resolve this?