Flash verification failed

The programmed data does not match the source file.

FLASH_VERIFICATION_FAILED

Symptoms

  • Programming completes but verification reports mismatched data.
  • Failures are intermittent — a retry sometimes passes.
  • Mismatches cluster in the same address region every time.

Likely causes

  • A marginal SWD link corrupted data during programming or read-back.
  • Part of the region is write-protected, so some pages silently kept old contents.
  • The firmware started running after programming and modified flash (e.g. its own config/EEPROM-emulation pages) before verification read it back.
  • Worn flash cells on a heavily reflashed development board.

How to fix it

  1. Retry once

    A clean retry rules out a one-off transfer glitch — MCUHex halts the target for the next attempt.

  2. Stabilize the debug link

    If failures are intermittent, treat it as a signal problem: shorter wires, direct USB connection, lower SWD clock (see the SWD protocol error guide).

  3. Check protected sectors

    If the same region mismatches every time, inspect WRP/PCROP in the option bytes — protected pages keep their old content without a hard error on some families.

  4. Watch for self-modifying firmware

    If your firmware writes flash at boot (EEPROM emulation, config pages), exclude those pages from the image or expect verification differences there.