0

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

0

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.

Boot Allocation and Program Space

2
  • Worked like a charm! Thanks! Did you find this in the Atmel ICE manual?
    – Marzukr
    Commented 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
    Commented Apr 22, 2017 at 2:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.