Verify Flash Failure - ICE fails with SAMD21E16B but works fine with SAMD21E18A

Go To Last Post
2 posts / 0 new
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I have a SAMD21E16B and am having trouble programming it with an Atmel ICE debugger over SWD but the flash fails to program properly. Reading back the flash contents shows it is mostly there but a few bits have been flipped from 0 to 1.

If anyone has any tips for debugging this issue they would be greatly appreciated <3



Things I have tried / checked:

  • The power supply is a nice clean 3.3V
  • Various programming speeds from 32kHz to 2MHz
  • Various combinations of erasing / not erasing the chip in Atmel Studio
  • The chip itself is on a custom PCB but strangely the same PCB with a SAMD21E18A programs fine with this setup
  • I have a few PCBs with SAMD21E16Bs on and they all present this issue



I have tried it with Atmel Studio and OpenOCD to no avail - the OpenOCD output is:

sudo openocd -f openocd.cfg -c "program TEST16.hex verify reset exit"
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
Info : auto-selecting first available session transport "swd". To override use 'transport select <transport>'.
none separate
adapter speed: 400 kHz
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD  Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 1.0
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 400 kHz
Info : SWD DPIDR 0x0bc11477
Info : atsamd21E16B.cpu: hardware has 4 breakpoints, 2 watchpoints
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x00000124 msp: 0x200008a0
** Programming Started **
auto erase enabled
Info : SAMD MCU: SAMD21E16B (64KB Flash, 8KB RAM)
wrote 8192 bytes from file TEST16.hex in 1.461668s (5.473 KiB/s)
** Programming Finished **
** Verify Started **
Error: checksum mismatch - attempting binary compare
diff 0 address 0x00000100. Was 0xa0 instead of 0x00
diff 1 address 0x00000101. Was 0x08 instead of 0x00
diff 2 address 0x00000304. Was 0xb8 instead of 0x98
diff 3 address 0x00000401. Was 0xeb instead of 0x4b
diff 4 address 0x00000501. Was 0x1b instead of 0x11
diff 5 address 0x00000502. Was 0x80 instead of 0x00
diff 6 address 0x00000503. Was 0x02 instead of 0x00
diff 7 address 0x00000505. Was 0x0d instead of 0x05
diff 8 address 0x00000507. Was 0x80 instead of 0x00
diff 9 address 0x00000600. Was 0x8b instead of 0x0b
diff 10 address 0x00000700. Was 0xeb instead of 0xe3
diff 11 address 0x00000701. Was 0x6b instead of 0x69
diff 12 address 0x00000702. Was 0x9a instead of 0x1a
diff 13 address 0x00000706. Was 0x4b instead of 0x43
diff 14 address 0x00000a01. Was 0x22 instead of 0x20
diff 15 address 0x00000b03. Was 0x62 instead of 0x60
diff 16 address 0x00000d00. Was 0x08 instead of 0x00
diff 17 address 0x00000d01. Was 0xd3 instead of 0xd1
diff 18 address 0x00000e01. Was 0xa2 instead of 0x22
diff 19 address 0x00001101. Was 0x08 instead of 0x00
diff 20 address 0x00001200. Was 0xae instead of 0x2e
No more differences found.
** Verify Failed **
shutdown command invoked



Last Edited: Tue. Mar 10, 2020 - 03:21 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


this problem I also have sometimes (once in a month) with my custom board (SAME51) and Atmel ICE:

Verifing after Flash Programming fails and reading back the Flash shows some (1..5) bit flips

every time on different locations.

Changing the transfer clock didn't take any effect.

The only way I found to flash correctly is to reboot windows.

BR Bernhard