Using OpenOCD to erase the flash, the following sometimes occurs:
INFO: Erase bank 0
INFO: Check erased bank 0 sector 0..4
successfully checked erase state
#121: 0x001e4000 (0x4000 16kB) not erased
INFO: Flash file
wrote 76284 bytes from
Erasing is needed prior flashing a new image.
I can work-around the problem by pulling the ERASE pin high letting the SoC erase itself.
There is a pattern:
- Erase never fails if an image has not been let to run at full-speed, i.e. when code is stopped and stepped.
- Short runs seems OK. I.e. from one BP to another.
- Erase "always" fails if code has been let running at full-speed.
- Erase always succeeds after ERASE pin has been triggered (i.e. SAM-BA image is running).
Target is reset using jtag reset using jtag command and halted prior erasing via OpenOCD's soft_reset_halt command.
I've checked that ASF's flash_lock() is not used in the built image and can't be the cause.
Is there a tamper mechanism that may be triggered?