This is not the chip you picked
The chip on the board reports less flash than the part chosen for it has. Programming it with the wrong geometry would erase it against the wrong map, and that cannot be undone, so nothing was written.
FLASH_TARGET_MISMATCH
Symptoms
- Flashing was refused before it started, and the message names both sizes.
- The board is a clone or a board of unknown provenance.
- The target was picked from the dropdown by family name rather than the full part number.
Likely causes
- Every STM32 carries its flash size in a read-only register. MCUHex reads it and compares it with the part you picked; a smaller chip than the target means the map is wrong.
- A clone or remarked part: the package says one thing and the silicon reports another. This is common on cheap board copies.
- The part was picked by family and the dropdown’s first match happened to be a larger variant.
How to fix it
-
Trust the number the chip reported
The message shows what the chip says about itself. Pick the part number whose flash size matches that, not the one printed on the package.
-
Check the package marking too
If the marking and the reported size disagree, the part is remarked. It still works — select what the silicon reports and flash normally.
-
Why this is refused rather than warned about
Programming runs an erase against the selected chip’s sector layout. Against the wrong layout that erase cannot be taken back, so nothing is attempted.