stm32f407 Programming parallelism error firing for no reason
I am using the stm32f4 discovery board and writing bare-metal drivers for the embedded flash memory.
I am facing a strange problem when writing to flash memory, to save you time for reading code and when the error happens, here is the status:
Before Error:
FLASH_CR register:

FLASH_SR register:

as you can see, PSIZE if configured correctly, but when this line of code run:
*global_pu32MemWriteVar = *(uint32_t *)argConst_pu8WriteData;
or in assembly it will be:
416 *global_pu32MemWriteVar = *(uint32_t *)argConst_pu8WriteData;
08000762: ldr r3, [pc, #216] ; (0x800083c <HAL_FLASH_Write+604>)
08000764: ldr r3, [r3, #0]
08000766: ldr r2, [r7, #4]
08000768: ldr r2, [r2, #0]
0800076a: str r2, [r3, #0]
I see PGPERR: Programming parallelism error get raised even though PSIZE is configured correctly and PG bit is set to 1.
After Error:
FLASH_CR register:

FLASH_SR register:

