Discussion:
[OpenOCD-devel] ATSAMDA1E16/ATSAMC21E18 chip erasing with security bit set
William Hanna
2017-06-08 11:51:14 UTC
Permalink
Has anyone had any success with using openocd to erase ATSAMDA1 or ATSAMC21 devices which have the security enabled?

The command:'at91samd chip-erase’ says it will erase the device when security enabled. However when the security is set openocd doesn’t appear to be able to run the ‘init’ command on the device successfully.

According to the data sheet (ATSAMDA1 section 14.6.2 & timing diagram Figure 14-2) the CPU Reset extension must be used before chip-erase.

I have tried using Atmel-ICE and JLink-EDU adapters.

I log of the chip-erase command is at:
https://pastebin.com/3SFZXRpj <https://pastebin.com/3SFZXRpj>

I also have a log of what Atmel Studio does to successfully erase the chip:
https://pastebin.com/5m1WSKmh <https://pastebin.com/5m1WSKmh>

Any help would be much appreciated. TIA

William Hanna
HW Engineer
w: dbe.ca <http://dbe.ca/>
p: (902) 702 8716 ext:2
e: ***@dbe.ca
William Hanna
2017-06-08 15:34:27 UTC
Permalink
Ok, swapped over to cmsis-dap adapter and still no luck.
https://pastebin.com/6k6ULseG <https://pastebin.com/6k6ULseG>

Thanks for you help.
The cold-plug solution (4044) is for CMSIS-DAP adapter only.
No wonder it does not work with J-Link.
Tom,
I read your post, which I somehow missed when searching for a solution, and pulled the latest master. Changed atsamd91.c and cmsis_dap_usb.c to patch versions (4043 and 4044) and installed.
https://pastebin.com/7L6i1TqW <https://pastebin.com/7L6i1TqW>
As I understand it the fix merged into the git master is for the DSU. Other patches are required for SAMD CPU extended reset.
William
Post by William Hanna
Has anyone had any success with using openocd to erase ATSAMDA1 or ATSAMC21 devices which have the security enabled?
The command:'at91samd chip-erase’ says it will erase the device when security enabled. However when the security is set openocd doesn’t appear to be able to run the ‘init’ command on the device successfully.
Please see
https://sourceforge.net/p/openocd/mailman/message/35704580/ <https://sourceforge.net/p/openocd/mailman/message/35704580/>
http://openocd.zylin.com/4043 <http://openocd.zylin.com/4043> is already merged in git master.
Tom
William Hanna
2017-06-09 12:18:45 UTC
Permalink
Thanks Tom,
after fixing up my own mistakes I have had success programming and erasing ATSAMC21 with security enable using the Atmel-Ice.

Is it possible to do for JLink EDU debugger?

William
openocd -f interface/cmsis-dap.cfg -f target/at91samdXX.cfg -c cmsis_dap_init_samd_cold_plug -c init -c "at91samd chip-erase"
Post by William Hanna
Ok, swapped over to cmsis-dap adapter and still no luck.
https://pastebin.com/6k6ULseG <https://pastebin.com/6k6ULseG>
Thanks for you help.
The cold-plug solution (4044) is for CMSIS-DAP adapter only.
No wonder it does not work with J-Link.
Tom,
I read your post, which I somehow missed when searching for a solution, and pulled the latest master. Changed atsamd91.c and cmsis_dap_usb.c to patch versions (4043 and 4044) and installed.
https://pastebin.com/7L6i1TqW <https://pastebin.com/7L6i1TqW>
As I understand it the fix merged into the git master is for the DSU. Other patches are required for SAMD CPU extended reset.
William
Post by William Hanna
Has anyone had any success with using openocd to erase ATSAMDA1 or ATSAMC21 devices which have the security enabled?
The command:'at91samd chip-erase’ says it will erase the device when security enabled. However when the security is set openocd doesn’t appear to be able to run the ‘init’ command on the device successfully.
Please see
https://sourceforge.net/p/openocd/mailman/message/35704580/ <https://sourceforge.net/p/openocd/mailman/message/35704580/>
http://openocd.zylin.com/4043 <http://openocd.zylin.com/4043> is already merged in git master.
Tom
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot <http://sdm.link/slashdot>
_______________________________________________
OpenOCD-devel mailing list
https://lists.sourceforge.net/lists/listinfo/openocd-devel <https://lists.sourceforge.net/lists/listinfo/openocd-devel>
Loading...