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.
1 Answer 1
Whats is the fuse setting of NVMCTRL_BOOTPROT
?
it should be:
NVMCTRL_BOOTPROT = 0x07
which will set your memory location to 0x00 (no bootloader).
NVMCTRL_BOOTPROT
sets the amount of space to allocate for the bootloader in flash memory. Setting this fuse to 0x07 tells the chip you are not allocating space for a bootloader and the programmer will start to write at address 0x00, which is the beginning of flash memory. If you are programming with an Atmel ICE, you are not using a bootloader.
-
Worked like a charm! Thanks! Did you find this in the Atmel ICE manual?Marzukr– Marzukr2017年04月22日 02:26:54 +00:00Commented Apr 22, 2017 at 2:26
-
Happy to help. No in the Samd21 datasheet. There is a whole section on NVM and boot allocation.PhillyNJ– PhillyNJ2017年04月22日 02:28:19 +00:00Commented Apr 22, 2017 at 2:28