Just wanted to share my experience with a hard bricked Mechaduino v0.2.
The SAMD21 is known to get his flags/fuses mixed up in some programming situations.
In this case, the bootloader area is set to write-protected and re-flashing the Arduino Zero bootloader via SWD port will fail.
(gdb) target extended-remote /dev/ttyACM0
Remote debugging using /dev/ttyACM0
(gdb) monitor swdp_scan
Available Targets:
No. Att Driver
1 Atmel SAMD21G18A (rev D) M0+
(gdb) attach 1
Attaching to Remote target
warning: No executable has been specified and target does not support
determining executable automatically. Try using the "file" command.
0x00001314 in ?? ()
(gdb) file samd21_sam_ba.hex
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from samd21_sam_ba.hex...(no debugging symbols found)...done.
(gdb) monitor unlock_flash
(gdb) monitor unlock_bootprot
(gdb) monitor erase_mass
Erase successful!
(gdb) load
Loading section .sec1, size 0x1968 lma 0x0
Start address 0x60c, load size 6504
Transfer rate: 37 KB/sec, 929 bytes/write.
Just wanted to share my experience with a hard bricked Mechaduino v0.2.
The SAMD21 is known to get his flags/fuses mixed up in some programming situations. In this case, the bootloader area is set to write-protected and re-flashing the Arduino Zero bootloader via SWD port will fail.
A possible solution, if you do not have an ATMEL-ICE is using a black magic probe (BMP). https://1bitsquared.de/products/black-magic-probe
Fortunatelly, a "Blue Pill" (STM32 dev board) can be programmed to function as a BMP. https://buger.dread.cz/category/stm32.html
The solution is coming from here: https://electronics.stackexchange.com/questions/438386/samd21-how-do-i-write-to-nvm-fuses
$ /home/peter/snap/arduino-mhall119/5/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/7-2017q4/bin/arm-none-eabi-gdb
(gdb) target extended-remote /dev/ttyACM0 Remote debugging using /dev/ttyACM0 (gdb) monitor swdp_scan Available Targets: No. Att Driver 1 Atmel SAMD21G18A (rev D) M0+ (gdb) attach 1 Attaching to Remote target warning: No executable has been specified and target does not support determining executable automatically. Try using the "file" command. 0x00001314 in ?? () (gdb) file samd21_sam_ba.hex A program is being debugged already. Are you sure you want to change the file? (y or n) y Reading symbols from samd21_sam_ba.hex...(no debugging symbols found)...done. (gdb) monitor unlock_flash (gdb) monitor unlock_bootprot (gdb) monitor erase_mass
Erase successful! (gdb) load Loading section .sec1, size 0x1968 lma 0x0 Start address 0x60c, load size 6504 Transfer rate: 37 KB/sec, 929 bytes/write.