i using flash to save data, but sometime error happen when Erasing Flash, i don't understand why?
Thank for your help! sorry for my terible english
my program size: 30,46 kbyte.
Here is my function:
#define FLASH_PAGE_ADDR 0x08010000
uint16_t Mydata = 2345;
void WriteData(void)
{
FLASH_Unlock();
FLASH_ClearFlag(FLASH_FLAG_BSY | FLASH_FLAG_EOP | FLASH_FLAG_PGERR\
|FLASH_FLAG_WRPRTERR);
FLASH_ErasePage(FLASH_PAGE_ADDR);
FLASH_ProgramHalfWord(FLASH_PAGE_ADDR+2, Mydata);
}