Skip to main content
PMOHO.1
Associate II
June 19, 2020
Question

STM32L433CCT6 flash memory write Problem

  • June 19, 2020
  • 4 replies
  • 1730 views

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

4 replies

Uwe Bonnes
Chief
June 19, 2020

There is no EEPROM in the L4 series...

PMOHO.1
PMOHO.1Author
Associate II
June 20, 2020

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

PMOHO.1
PMOHO.1Author
Associate II
June 20, 2020

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

Piranha
Principal III
June 20, 2020

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

Associate
March 19, 2024

have you resolve this?