2021-06-22 10:41 AM
I want to write to FLASH and read. Why doesn't it record?
HAL_FLASH_Unlock();
FLASH_Erase_Sector(FLASH_SECTOR_7, VOLTAGE_RANGE_3);
HAL_FLASH_Program(FLASH_TYPEPROGRAM_WORD, FLASH_SECTOR_7, 300);
HAL_FLASH_Lock();
set_time = *(__uint32_t*) FLASH_SECTOR_7;
Compiles without error.
Andrzej
Solved! Go to Solution.
2021-06-25 03:51 AM
Hello ADebs.1,
it seems to me the code is not complete. Take a look at the provided example FLASH_EraseProgram available in STM32F7Cube FW package. Recommended function for erase should be HAL_FLASHEx_Erase which next to the FLASH_Erase_Sector function also obtain few other operations needed for correct erasing process.
Please click on Select as Best if my reply fully answered your question. This will help other users with the same problem to find the solution faster!
2021-06-25 03:51 AM
Hello ADebs.1,
it seems to me the code is not complete. Take a look at the provided example FLASH_EraseProgram available in STM32F7Cube FW package. Recommended function for erase should be HAL_FLASHEx_Erase which next to the FLASH_Erase_Sector function also obtain few other operations needed for correct erasing process.
Please click on Select as Best if my reply fully answered your question. This will help other users with the same problem to find the solution faster!
2021-06-25 04:20 AM
Thank you.
After compiling, I have no error, the program hangs and I have to erase all memory with the programmer.
An error at 0xFFFFFFFE is then reported.
I will try as suggested and let me know.
greetings
Andrzej
2021-06-25 09:17 AM
Hello Petr
I am sending the program I wrote as you advised. But something is not right. If I reset the STM32 memory with the programmer, I enter debag without a problem. The second time I want to enter the same, it throws debag. I need to reset the memory with my programmer. It seems to write to FLASH, but when I look at the address 0x080C000 (FLASH_SECTOR_7), I do not see the data saved.
What is the cause?
greetings
Andrzej