Custom board using STM32F765VI
Atollic TrueStudio with SEGGER J-link
I am having trouble using the HAL_FLASHEx_Erase funtion on my STM32F7xx custom board. When I attempt to erase a segment I get a hard fault that sends me to never-neverland.
Thread #1 57005 (Suspended : Signal : SIGTRAP:Trace/breakpoint trap)
<signal handler called>() at 0xfffffff1
Here's the code snippet:
EraseInitStruct.TypeErase = FLASH_TYPEERASE_SECTORS;
EraseInitStruct.VoltageRange = FLASH_VOLTAGE_RANGE_3;
EraseInitStruct.Sector = 0x81c0000;
EraseInitStruct.NbSectors = 1;
if (HAL_FLASHEx_Erase(&EraseInitStruct, &SECTORError) != HAL_OK)
**** Hard Error ***
There seem to be others with this same problem (problem with use HAL_FLASH_Program ), but I have not seen a solution. FYI, I have tried clearing the flash error flags:
FLASH->SR = FLASH_FLAG_PGPERR;
FLASH->SR = FLASH_FLAG_PGSERR;
FLASH->SR = FLASH_FLAG_EOP;
FLASH->SR = FLASH_FLAG_OPERR;
FLASH->SR = FLASH_FLAG_WRPERR;
FLASH->SR = FLASH_FLAG_PGAERR;
...but cannot find the location of PGSERR (not in stm32f7xx_hal_flash.h), so I get a compile error.
Any guidance would be appreciated.