I’m trying to write to the flash but every time I try to do a FLASH_ProgramWord(), it ends up in the HardFault_Handler. I'm using the approach that is used in ST’s Write_Portection examples.
Code:
/* Unlock the Flash Program Erase controller */
FLASH_Unlock(); FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP|FLASH_FLAG_PGERR |FLASH_FLAG_WRPRTERR); /* Get pages write protection status */ WRPR_Value = FLASH_GetWriteProtectionOptionByte(); ProtectedPages = WRPR_Value & 0xFFFFFFFF; if (ProtectedPages == 0x00) {/* Pages are write protected */ /* Disable the write protection */ FLASHStatus = FLASH_EraseOptionBytes(); } FLASH_ErasePage(APPLICATION_ADDRESS); FLASHStatus = FLASH_ProgramWord(0x00001111,APPLICATION_ADDRESS); I hope anyone can help me. Søren P.