HardFault_Handler in writing 64bit to Flash
I'm using a Stm32f429VI, and I try to write in 64bit mode to the flash.
The system goes every time to HardFault_Handler.
In 32bit mode I have no problems.
I think there is a bug in FLASH_Program_DoubleWord() function ( in
stm32f4xx_it.c) :
the function writes first 32 bit and IMMEDIATLY writes seconds 32 bit not attendig if the prevoius operation is terminated.
I solved the problem as you can see, writing two 32bit words.
What did you think?
static void FLASH_Program_DoubleWord(uint32_t Address, uint64_t Data)
{
/* Check the parameters */
assert_param(IS_FLASH_ADDRESS(Address));
/* If the previous operation is completed, proceed to program the new data */
CLEAR_BIT(FLASH->CR, FLASH_CR_PSIZE);
FLASH->CR |= FLASH_PSIZE_DOUBLE_WORD;
FLASH->CR |= FLASH_CR_PG;
//ORIGINAL
/* Program the double-word */
//*(__IO uint32_t*)Address = (uint32_t)Data;
//*(__IO uint32_t*)(Address+4) = (uint32_t)(Data >> 32);
//NEW
FLASH_Program_Word(Address,Data);
Data>>=32;
FLASH_Program_Word(Address+4, Data);
}
