title: Stm32F103C8T8 - error when I erase flash
body: <p>i using flash to save data, but sometime error happen when Erasing Flash, i don't understand why?</p>
  
  <p>Thank for your help! sorry for my terible english</p>
  
  <p>my program size: 30,46 kbyte.</p>
  
  <p>Here is my function:</p>
  
  <pre><code>#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);
  }
  </code></pre>