SAMD21 Verifying Flash...Failed

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

Hi, I just recently picked up my Atmel-ICE and I am trying to program my Arduino M0 Pro (SAMD21G18A). It seems to program fine but it doesn't verify. I get an error:

Verifying Flash...Failed! address=0x0000 expected=0x50 actual=0xff

Here is a screen shoot of my settings. 

Any ideas?

"When all else fails, read the directions"

Last Edited: Mon. Dec 11, 2017 - 04:18 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why are you using an ATMEL-ICE when you have got a perfectly adequate EDBG chip on the board?

Having said that, I find that I always need to restore the Arduino bootloader after using Keil or Rowley.
AS7 works fine with EDBG. AS7 works fine with ATMEL-ICE. You might get a problem with two CMSIS-DAP debuggers connected at once.

David.

Last Edited: Fri. Dec 25, 2015 - 05:34 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
AS7 works fine with EDBG

Thanks David. However when I just tried to program via EDBG, it programs but I get the same error verifying.

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm getting the same problem with the EDBG interface and AS7. I did a Read device memory and confirmed the chip was successfully erased.  I think what is actually happening is Atmel programming tool is trying to program the device, but the flash isn't actually getting written, so when you do the verify it reads back the first byte "0xFF", which is an erased byte instead of the programmed byte (programmed byte in my case should be 0xFC).  So the verify fails and cancels/exits.  Could it be a fuse issue, where fuses are set to prevent programming the bootloader?  I'm not as familiar with the SAMD21 settings.

 

I picked up a cheapo Arduino M0 Pro from Microcenter a couple days ago.  Messed around yesterday with trying to load a program with the Arduino 1.6.5 IDE and it wouldn't load the program due to a bootloader issue. After researching a little, found out about the different bootloader between the Arduono M0 Pro (by arduino.org) and the official Arduino "Zero" (by arduino.cc).  So I found the bootloader for the "Zero" and was trying to load it into the M0 Pro through Atmel Studio to see if this would fix it, as they both use the same hardware, but finding the verify consistently fails.  

 

Here's a link to where I picked up the "Zero" bootloader hex file if it helps:

https://github.com/arduino/ArduinoCore-samd/tree/master/bootloaders/zero

 

Here are the fuse register values:

Last Edited: Fri. Dec 25, 2015 - 07:04 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Here are my Fuse Settings:

OTP1_WORD_0 = 0x10000300 (valid)
OTP4_WORD_0 = 0x40004007 (valid)
OTP4_WORD_1 = 0x8DF4ACDC (valid)
OTP4_WORD_2 = 0xFFFFFE00 (valid)
TEMP_LOG_WORD_0 = 0xFD95481D (valid)
TEMP_LOG_WORD_1 = 0xD40B6AFA (valid)
USER_WORD_0 = 0xD8E0C7F9 (valid)
USER_WORD_1 = 0xFFFFFC5D (valid)

Microcas wrote:
found out about the different bootloader between the Arduono M0 Pro (by arduino.org) and the official Arduino "Zero" (by arduino.cc).

Yeah this is frustrating to say the least.  I have to use the Arduino.org IDE with the M0 Pro. I thought picking up this M0 would be a benefit to some of my projects. Faster, more memory, why wouldn't it not be faster? Well from what I read and experienced, its not worth all the trouble. 

Microcas wrote:
I picked up a cheapo Arduino M0 Pro from Microcenter a couple days ago.

I love this store. How much was the clone? Their Inland Aurduino clone is $5.99 and is built solid. I also, picked up a Mega Clone for $9.99...

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Update on the M0 programming... I installed the other Arduino IDE and it didn't work either. I think I have a bad board and will be returning it for a refund. I'll have to get an authentic Zero this time.

The M0 was $34.99. Last time I bought Arduino hardware there I picked up several Uno's at $5.99ea and another Mega 2560 for $9.99. Both were the Inland brand, and yes I thought they were built pretty well also, compared to some of the Chinese knockoffs I've seen.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I doubt if you have any problem with the hardware.    It is more likely to be a feature of Atmel and its USB drivers.

 

I possess an early M0_Pro.   It was called Zero_Pro in those days.

 

1.   The original Bootloader works in Arduino v1.7.x 

2.   I replaced it with the Bootloader from Arduino v1.6.x

3.   I can build, program and debug just fine in Keil

4.   I can build, program and debug in Rowley.    Sometimes it says Verify error

5.   I can build, program and debug in AS7.

6.   I need to reinstall the Bootloader if I want to use the Arduino v1.6.x IDE

 

This morning I thought that I should check all this was true.

AS7 could not detect ANY Atmel debuggers at all.

Rebooting my Win7-64 PC did not help.

Fortunately,   "Repair" of the AS7 installation seems to have discovered my Atmel Tools.

Of course I have to type in all my "External Tools" again.

 

I have no idea what "lost" my "Atmel Tools".    I am just grateful that I have got them back.

I am pleased that I am NOT a commercial developer.     Losing days / hours of work is not appreciated.    

Keil or Rowley do not seem to have these AS7 features.     Paying for reliability is worthwhile.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks David - looks like a bug in AS7 -

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have no idea which component upsets the drivers.
It might be Atmel, Microsoft, some third party, ...

I am just grateful that the Repair of AS7 worked. Yes, verify is fine.

Everything seems to be be very big and convoluted.
Somehow, it would be nice to just build a project and have a reliable debugger display.

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

david.prentice wrote:
Somehow, it would be nice to just build a project and have a reliable debugger display.

I sense your frustration. I have reported the issue at atmel.com.

david.prentice wrote:
Keil or Rowley do not seem to have these AS7 features.

I do this as a hobby, so I don't dump too much money into this as the only return is the joy I making things that do stuff that I don't need :) - Mostly, I have built 1 or 2 projects I actually use daily. Nevertheless, about how much is Keil or Rowley?

 

  

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I only have the free Evaluation Keil. Size limited but many ARM projects are possible.
I do have a hobbyist licence for Rowley which was not expensive. I can build any size that I want. I cannot sell it commercially.

On balance, I would seriously consider buying a full licence for Keil if I had a paying project.

Somehow, most of the other ARM gcc incarnations suffer from bloat or awkwardness. Even the ones supported by NXP, Freescale etc. And the "supported" ones tend to restrict themeselves to the manufacturer's products. Much like AS7 restricts itself to Atmel.

Full licences are $5000 or so. I guess that there is a lot of negotiation involved.
As a hobbyist, you just have to keep your fingers crossed with AS7. After all AS4 was a pretty reliable IDE. I always thought that the debug limitations were down to the gcc information.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was able to get my M0 Pro working with the Arduino 1.6.7 IDE.  I will note, there seem to be some bugs with this latest IDE, but nothing major that would prevent sketches from compiling or uploading...  There were really just two things I needed to do to get this working: 1) run updates in the board manager (Tools > Board > Board Manager), and 2) burn the bootloader (Tools > Burn Bootloader).  Before burning the bootloader, make sure you have selected the Arduino Zero (Programming Port) from the Tools menu, 2) the correct COM port for the board connected (Tools > Port), and 3) Atmel EDBG programmer (Tools > Programmer > Atmel EDBG).

 

Note that IO pins 2 and 4 on the female headers are swapped compared to the Arduino Zero from arduino.cc.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Microcas wrote:
I was able to get my M0 Pro working with the Arduino 1.6.7 IDE

Hi - the issue is in AS 7 not the Arduino IDE. I can program fine in the IDE. But thanks for input.

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Solved - The Atmel support to was able to fix the issue.

 

My M0 Pro fuse setting for NVMCTRL_BOOTPROT = 0x01 and it should be 0x7. Once I changed the value of NVMCTRL_BOOTPROT from 0x1 to 0x7 it works.

 

NVMCTRL_BOOTPROT = 0x7

 

That fixed it! I am able to program and verify in AS7. What I noticed is that when I go back to the Arduino IDE and burn the boot loader (so I can program in the IDE), it changes NVMCTRL_BOOTPROT back to 0x01. Changing it back to 0x7 allows me to use it in AS7 again.

"When all else fails, read the directions"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

this solved my issue as well! I bought a generic M0 zero clone from robotdyn and the bootloader didnt work. after changing the NVMCTRL_BOOTPROT = 0x07 I was able to burn the bootloader and use arduino IDE. thanks!!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was also having this same problem with the RobotDYN Clone, I also havn't used Atmel Studio very much (usually use Visual Studio), so I don't rip my hair out for a couple of hours again is there a way to specify that the NVMCTRL_BOOTPROT is set to 0x07 in a template or is there a way to download the Fuse Register into a cfg file so I can re-import it once I know everything is setup right?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

hi, I created a custom circuit with samd21j18a and I program it with jlink. After loading the first firmware the flash verification error problem occurs for subsequent uploads, but I also correct the registers does not work. Do you have advice?