Go Down

Topic: [SOLVED] Cannot upload sketch on native or programming port (Read 18626 times) previous topic - next topic

prolucid

I can't get any sketch to upload, not even a simple LED blink.

Using Arduino 1.6.5, Windows 7.

I get different errors using the native and programming port.

With the native port, the sketch compiles, then proceeds to upload.  If COM12 is selected, it uploads, the device resets, and then it says "No device found on COM13".

With the programming port, I notice there is an incorrect driver in device manager.  That's probably my main problem.  The sketch compiles but fails to upload:


Sketch uses 11,076 bytes (4%) of program storage space. Maximum is 262,144 bytes.
Open On-Chip Debugger 0.9.0-gd4b7679 (2015-06-10-22:24)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x81000000 pc: 0x000028b8 msp: 0x20002c08
** Programming Started **
auto erase enabled
Error: SAMD: NVM lock error
Error: Failed to erase row containing 00002000
Error: error writing to flash at address 0x00000000 at offset 0x00002000
Runtime Error: embedded:startup.tcl:454: ** Programming Failed **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 510
at file "embedded:startup.tcl", line 454
the selected serial port at file "embedded:startup.tcl", line 454
does not exist or your board is not connected

Regarding the incorrect driver in device manager, it's called "EDBG Data Gateway" and I can't for the life of me find the driver.  I installed the extra Arduino Zero drivers and went to manually update the drivers from "C:\Program Files (x86)\Arduino\drivers" but it does not recognize them.

Any thoughts?  Thanks!

cmaglie

Hi,

it seems that you have two different issues here, so let's isolate the two problems:

1) Windows doesn't detect the EDBG Serial Port: this may be a driver problem, may you please post the USB VID/PID from the device manager?

2) The EDBG Programmer, instead, is correctly detected, the OpenOCD software correctly starts, but at some point it says:

** Programming Started **
auto erase enabled
Error: SAMD: NVM lock error
Error: Failed to erase row containing 00002000
Error: error writing to flash at address 0x00000000 at offset 0x00002000


This means that the Flash memory of your Zero board is locked in some way.

We didn't lock flash memory in factory: maybe you already programmed the board in some other way?
C.

patthoyts

The "EDBG Data Gateway" driver is part of Atmel USB driver bundle.

The error message reported is the same one I got using an Arduino Zero Pro with the the arduino.cc 1.6.5 IDE. The problem is the Zero Pro needs an update to the bootloader to work with arduino.cc software. You can update this by connecting the programming port and I selected "Atmel EDBG" as the programmer from the Tools/Programmer menu. Then select Tools/Burn Bootloader. Doing this has allowed me to use the arduino.cc Arduino 1.6.5 IDE to program the Zero Pro.

Zorro_X

I had exactly the same problem, and thanks to this post I've solved it by burning bootloader and everything is OK !
Thankyou !!!

cmaglie

C.

Zorro_X

#5
Jun 19, 2015, 06:57 pm Last Edit: Jun 19, 2015, 07:01 pm by Zorro_X
oops ! I had no idea ! But what was the right thing to do to make it work with the IDE ?!
I've a n Arduino M0 Pro R3 from an european (France) reseller... But now it is a "Zero"... No way to get the "original" bootloader back ?

scswift

The differences are minor. Pins 2 and 4 are swapped. There is no ATN pin. That's about it.  Don't sweat it.  It would only matter if you intended to design shields and didn't know about the difference or wanted to use a shield that used those pins.  But I don't know how many shields are even compatible with it, so that's probably not a big concern yet either.

And there is no "right" way to make it work with the new IDE aside from loading the newest bootloader on it.  I don't think the original bootloader will work with the new IDE, and even if it did, the bootloader does not control which pins are mapped to which ports.  That's controlled by the IDE and the variant.cpp file when you compile.

prolucid

Thank you everyone.  Installing the correct drivers and burning the bootloader did the trick.

IanCoombs

I am replacing the Arduino Uno boards in a testing robot with M0 PRO R3 boards. We use the Pololu VNH5019 shield info here.

Followed the instructions above and used the Zero bootloader.

Just had to swap the direction logic around for motor 1 which came from pins 2 and 4. Made sure that inputs were 3.3VDC safe and it all runs as expected.
Com Sci Curtin

rmetzner49

Quote
And there is no "right" way to make it work with the new IDE   
Okay, so Arduino.org hints that for the M0 the latest IDE version is 1.76.
I have that installed.

I was shipped my Neutrino about beginning October but I don't think my USB driver is working.

Do I still need to flash my Neutrino with "the latest bootloader" or are the recent shipments already flashed that way?  Given IDE version 1.76, does this version of the IDE have a bootloader for the Neutrino in it's variants folder?

To fix the USB issue I was planning to download Atmel Studio_7 which should get me a working USB driver.

Any other thoughts, Shawn?

scswift

Neutrinos are shipped with the .cc bootloader installed. 

If you're trying to program the Neutrino you should have the Arduino.cc IDE installed.  The .org one will not work.  You will need to go into the boards manager and download the files for programming the Zero. 

You should also set the IDE to program with the Native USB port.

If all else fails, try pressing the reset button before programming.


Chris_H

You can update this by connecting the programming port and I selected "Atmel EDBG" as the programmer from the Tools/Programmer menu. Then select Tools/Burn Bootloader.
This works as expected in March 2017 on a newly-purchased Arduino M0 Pro.

Utterly painless experience.  The uploaded .hex file is apparently enough code to cause Pin 13 to toggle, as the LED connected to it blinks (at, I don't know, a 1 Hz rate, I suppose).

I didn't do anything interesting to enable writing the stock (recovery) bootloader to the M0 Pro target board.

*New* M0 Pro boards apparently do not pose further obstruction, from what I can tell.  Hooray!

My usual sketch (the one supporting the parts connected to the Arduino on a neighbor solderless breadboard, inclding a piezo transducer (buzzer), some LED's and a PCF 8574 i2c port expander) .. my sketch uploads fine, and seems to run well.

* * *

Don't know about pin-swapping and so forth; my standard for 'IT WORKS' is fairly rudamentary, at this juncture. ;)


Transcript:

Code: [Select]
Script started on Mon 13 Mar 2017 04:18:33 AM UTC

mylogin@myhost: ~/temp.d$ uname -a
Linux myhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux

mylogin@myhost: ~/temp.d$ arduino
Picked up JAVA_TOOL_OPTIONS:
Open On-Chip Debugger 0.9.0-g688b0b6 (2017-01-12-14:57)
Licensed under GNU GPL v2
For bug reports, read
       http://openocd.org/doc/doxygen/bugs.html
debug_level: 0
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x000071fc msp: 0x20007fb0
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x000028f4 msp: 0x20002c00
** Programming Started **
auto erase enabled
wrote 32768 bytes from file /home/mylogin/.arduino15/packages/arduino/hardware/samd/1.6.12/bootloaders/mzero/Bootloader_D21_M0_Pro_150427.hex in 4.428293s (7.226 KiB/s)
** Programming Finished **
** Verify Started **
verified 25440 bytes in 2.157267s (11.516 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
mylogin@myhost: ~/temp.d$ exit
exit

Script done on Mon 13 Mar 2017 04:20:52 AM UTC

Go Up