title: Can't write to flash memory after erase
body: <p>So I can't write to internal flash memory directly after erasing it. If there's no erase operation before write operation, then I can. Any ideas as to why?</p>
  
  <p>Programming function returns 'successful write' value, but when looking at memory, no data is written. Here's the code:</p>
  
  <pre><code>uint32_t pageAddress = 0x08008000;
  uint16_t buffer = 0xAAAA;
  
  HAL_FLASH_Unlock();
  FLASH_PageErase(pageAddress);
  HAL_FLASH_Program(TYPEPROGRAM_HALFWORD, pageAddress, buffer);
  HAL_FLASH_Lock();
  </code></pre>
  
  <p>I've tried locking the memory between erasing and programming it, creating a delay between these operations, that doesn't help.</p>