Burning bootloader on to SAMD21 XPRO

I've been unable to burn the bootloader onto a SAMD21 XPRO board via the EDBG port. (Disclaimer: I'm very familiar with the SAMD21 and Atmel Studio, I'm a relative newcomer to Arduino.)

Details:

I've installed the Atmel SAMD21 Xplaiined-pros v0.3.0 board package from Atmel University France. I also -pre-erased the SAMD21 using Atmel Studio.

In Arduino, I've selected the SAMD21 Xplained Pro (via EDBG) under the Tools menu. I've verified that Tools => Programmer is set to "Atmel EDBG".

But when I click on Tools => Burn Bootloader, I get:

C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/bin/openocd.exe -d2 -s C:\Users\xxx\AppData\Local\Arduino15\packages\arduino\tools\openocd\0.10.0-arduino7/share/openocd/scripts/ -f C:\Users\r\AppData\Local\Arduino15\packages\atmel-samd21-xpros\hardware\samd\0.3.0/variants/atmel_samd21_xpro_v1/openocd_scripts/variant_atmel_edbg.cfg -c telnet_port disabled; init; halt; at91samd bootloader 0; program {C:\Users\xxx\AppData\Local\Arduino15\packages\atmel-samd21-xpros\hardware\samd\0.3.0/bootloaders/atmel_samd21_xpro_v1/samd21_sam_ba.bin} verify reset; shutdown 
Open On-Chip Debugger 0.10.0+dev-gf0767a31 (2018-06-11-13:36)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
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: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 03.25.01B6
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 0x2ba01477
Info : at91samd21j18.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
Error: SAMD: NVM Error
Error: SAMD: NVM lock error
Error: SAMD: NVM programming error
Error: Failed to erase row containing 00804000
Error: Couldn't erase user row

Error while burning bootloader.

Environment:

  • Arduino V 1.8.16
  • Windows 11 Pro 21H2

Solved while I was typing in this issue.

I had another unrelated board connected -- a SAME54 Xplained Pro. Evidently when the bootloader burner starts up, it looks for the first available EDBG, and thus found the SAME54 EDBG, not the SAMD21 EDBG.

The problem was fixed by unplugging the SAME54 Xplained Pro so that the SAMD21 Xplained Pro was the only EDBG device on the USB hub.

With that, the bootloader completed without error.

1 Like

I think there is a discussion related to how this sort of situation might be provided for by the Arduino development software here:

1 Like