Skip to main content
PMOHO.1
Associate II
Jun 19, 2020 1:21 PM UTC
Question

STM32L433CCT6 flash memory write Problem

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

This topic has been closed for replies.

5 replies

Uwe Bonnes
Chief
Jun 19, 2020 2:06 PM UTC

There is no EEPROM in the L4 series...

PMOHO.1
PMOHO.1Author
Associate II
Jun 20, 2020 4:59 AM UTC

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

PMOHO.1
PMOHO.1Author
Associate II
Jun 20, 2020 5:15 AM UTC

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

Piranha
Principal III
Jun 20, 2020 10:14 AM UTC

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

Associate
Mar 19, 2024 12:26 PM UTC

have you resolve this?