Writing to & Reading from STM32H7 FLASH memory
Hello, i am trying to read and write from flash memory to hold some configuration datas. I am using STM32H723. When i try to write some part of flash memory, i can write for a few times, than my program goes to hardfault. When i run the code again, my program goes to hardfault instantly without reading even once. When i change the memory address to read to, i can read a few times again but then get the same result. I have some MPU regions but not in the flash area, also i enabled the Speculation default mode settings from Cortex M7 window so i have a 4GB of MPU region that is arranged as default. What might be causing this?
void Flash_Read_Data (uint32_t StartSectorAddress, uint32_t *data, uint16_t numberofwords)
{
while (1)
{
*data = *(__IO uint32_t *)StartSectorAddress;
StartSectorAddress += 4;
data++;
if (!(numberofwords--)) break;
}
}
