I am trying to program my Adafruit M0 with the SAMD21G18 chip with Atmel studio and the Atmel ICE programmer. I have pin 1 on the ICE connected to 3.3V on the M0, pin 2 connected to SWDIO, pin 4 to SWDCLK, pin 10 to Reset, and pins 3, 5, and 9 to ground. This was all according to the ARM SWD connection section of the Atmel ICE manual. In Atmel Studio, I can read the device signature, but when I go to program the chip, I get the following error:
Timestamp: 2017-04-20 22:03:32.563
Severity: ERROR
ComponentId: 20100
StatusCode: 131103
ModuleName: TCF command: Modules:writeToMemory failed.
Failed to write segment at 0x0 to target for memorytype
I have searched the internet for hours, finding no solution to this problem.