SAMD51G18A can read/write fuses but NOT erase or program flash

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


This is my first time using a) Atmel ICE and b) programming SAMD chips without a bootloader. My aim is to add an Adafruit M4 bootloader to a custom board.

 

This is my schematic:

I have used the octopus cable from the ICE to a breakout board where I connect the three GND pins together and then take VTGT, GND, SWDCLK and SWDIO to individual pads on my PCB. I have tried programming with and without a 3.3k pullup on SWDCLK. I have tried with very slow SWD clock speeds (32kHz), as well as the default 2MHz. 

 

I can read the fuse registers and program them. I can get the device details and signature, and I am powering the target device straight into VDD at 3.1V from a power supply, via a Joulescope. I cannot erase the device or program the flash with a binary.

This is the device connected and shows I am targeting the right chip:

Target voltage is 3.1V. The chip is new and I don't know how to tell if the security bit is set but I haven't tried to set it.

 

I have successfully erased the SAMD51 on the Adafruit ItsyBitsy M4 that this device is loosely based on (also using the same octopus cable - so I think the cable is not part of the issue) and, once I set the BOOTPROT fuse correctly, could reflash the Adafruit bootloader binary onto the ItsyBitsy, so the overall toolchain seems fine.

 

I have installed the most up to date SAMD51 device pack and upgraded the ICE firmware on first connection yesterday. I have restarted the Win10 PC AS7 is running on.

 

Here is my error message for a chip erase:

and here it is for a program without chip erase checked (just throwing mud at this point):

Finally, here are my fuses:

 

I have noticed from the Joulescope that the current drops from ~10mA to ~7mA when I attempt to erase. If I then try to read the device signature it draws a blank until I repeat the request and the current rises and the signature appears. The other components are unknown current draw in this scenario and I'm loathed to take them off the board unless I can't progress with assistance from the community. I can say the accelerometer and LED will likely be under 2mA by themselves. So does the ~3mA current drop seem consistent with the ICE holding the SAMD51 cpu in a cold plugging situation? Any other ideas from what I've said?

 

Please help! Thanks

This topic has a solution.
Last Edited: Wed. Jul 24, 2019 - 02:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Comparing with the "Schematic Checklist" 1k is the recommended pullup for SWDCLK and the reset circuit is different. And have you really omitted 100nF decoupling for all power pins?

/Lars

 

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0


 yes Lars, you're a legend. The 100nF cap for the accelerometer is close to the SAMD but I had gone "schematic blind" where obviously all the power pins are spread around. I added another ceramic 100nF cap where it fitted and swapped the SWDCLK pullup to 1k Ohm. That didn't work. However, removing the cap from the reset circuit was what moved me along. I can now erase the board! 

 

No idea where I got that 10F cap on the reset pin from. I will mark this post as the solution for now - I don't mean to take credit from you because you helped me so much  but this post details the specific steps which fixed the problem smiley

 

Still can't load the bootloader but I think the ItsyBitsy may have the SAMD51G19A, not the 18A I have, so can't verify after programming the bootloader into flash: