Persistent Arduino Uno Pro & Arduino Uno M0 - (comport?) misery. No can do.

Hi,
I have both an Arduino Uno Pro & an Arduino Uno. I haven't had chance to use them for some months and then discovered that neither of them could download the example sketches. I have tried 2 different USB cables & both the programming port and the native ports but in both cases, I get the following errors (they take 30 seconds to turn up). I have tried resetting just before downloading.

I can promise that I've spent the last 2 days trying to find out what on earth is happening so please believe me when I say I DID try to find a solution and I haven't posted because I'm too lazy to work it out.

The error string is so big that I can't post here. For that reason I have posted it here:

http://txt.do/1sete

When code or output you want to post is longer than the forum's 9000 character limit, you should save it to a text file and attach it to the post. You should not use an external website because some forum members will not visit external websites and thus you'll be less likely to get help. If you are replying to a thread and want to add an attachment, you'll notice there is no "Attachments and other settings" link as there was when creating a thread. This feature is not available in "Quick Reply". If you click the "Reply" button you'll then see the "Attachments and other settings" link.

Here's the relevant part of the output:

Arduino: 1.8.8 (Windows 10), Board: "Arduino/Genuino Zero (Native USB Port)"
....
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
Couldn't find a Board on the selected port. Check that you have the correct port selected.  If it is correct, try pressing the board's reset button after initiating the upload.

You're giving some conflicting information. You mention three boards:
Arduino Uno Pro
Arduino Uno M0
Arduino Uno

Which board did you have connected for the output you provided? Of the three, I've only heard of the Arduino Uno. In order to upload to an Arduino Uno, you need to select Tools > Board > Arduino/Genuino Uno. You can't upload to an Arduino Uno with Tools > Board Arduino/Genuino Zero (Native USB Port) selected. As for the other boards, you'll need to provide a link to more information as I don't know anything about them.

Sorry to be unclear.

Arduino Uno M0 Pro
Arduino Uno M0

I will bear in mind your helpful method of posting long strings.

I have tried different USB ports as well. Everything goes swimmingly until:

Sketch uses 10008 bytes (3%) of program storage space. Maximum is 262144 bytes.
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
PORTS {COM5, } / {COM5, } => {}
Couldn't find a Board on the selected port. Check that you have the correct port selected. If it is correct, try pressing the board's reset button after initiating the upload.

Windows Device manager provides this:

EDBG Virtual COM Port (COM5)

Device Type: Ports (COM & LPT)
Manufacturer Atmel Norway AS
Location 0000 001a 0000 001 002 000 000 000 000

9600 BPS
8 Data Bits
Parity NONE
Stop Bits 1
Flow Control 1

I still have never heard of these boards. From the "M0", I'll take a guess on how the boards work.

The way uploads work is:

  • The Arduino IDE (or the upload tool used by the Arduino IDE) sends a signal for the microcontroller to reset.
  • The microcontroller resets.
  • The bootloader runs and waits (normally only for a short time) for an upload to start.
  • The upload tool sends the program to the microcontroller, where the bootloader writes it to flash memory.

On the boards with native USB (which I'm assuming is the case with yours), the way the IDE signals the microcontroller to reset is by opening a serial connection at 1200 baud. There is some special code running in the background on the microcontroller that does the reset when it detects that 1200 baud connection.

In some cases, the reset code that's supposed to be on the microcontroller could be missing or not working correctly, which will mean the bootloader never runs and the upload fails with the error you're seeing. The fix is to manually reset the board.

Try this:

  • Press the reset button on your board quickly twice. You should now see the LED on the board pulsing, which means the bootloader is running. The double press causes the bootloader to run indefinitely (until the board is reset, powered off, or an upload is done), which means you don't need to get the timing of the reset just right.
  • Select the port of your board from the Tools > Port menu. The port will be different when the bootloader is running so don't assume you already have the correct port selected.
  • Start an upload in the Arduino IDE.

The upload should now finish successfully. After this, you should be able to go back to doing normal uploads without needing to press the reset button. If you still need to do the reset trick to do uploads after this, the problem may be caused by your code. You can verify this by uploading a simple sketch like File > Examples > 01.Basics > BareMinimum.

Many thanks for your input. I think the boards were also called Adruino Uno Zero & Arduino Uno Zero Pro but here in the UK they use a slightly different name. The key thing is that they are an Atmel SAMD21G18A SoC. The Pro version has 2 USB ports since a second processor deals with debugging,

Now I have tried double-clicking to no good end. The LED stays resolutely on. I note that just before the download, the message 'Forcing reset using 1200bps open/close on port COM5'.

I checked the ports carefully and can see no issue. 1200 baud COM5 (Zero Pro), COM3 (Zero). I have even tried just trying every single COM port in case of some rare software glitch.

I have noted on the Pro that a 3rd LED lights briefly. When the attempt at download is made. It stays on for about 2 seconds.

Board Info for pro:

BN: Arduino M0 Pro (Programming Port)
VID: 03EB
PID: 2111

It does not return data via the native port of the Pro or from the Zero.

I have tried swapping everything but a different PC. Would this be of benefit has something befallen the reprogrammable space on the boards?

I do not post at the first sight of trouble and really have tried my best but I am at a loss as to why 2 boards left in their antistatic packaging under lock & key should both suddenly spring a leak.

I really do appreciate your help, pert. I'm just thinking of other things to try just to get some kind of response. The thing is pretending to be a brick!

Clubcard:
I think the boards were also called Adruino Uno Zero & Arduino Uno Zero Pro but here in the UK they use a slightly different name. The key thing is that they are an Atmel SAMD21G18A SoC.

Then my assumption about the native USB upload system should be reasonable, though I only have direct experience with the SAMD-based Arduino MKR boards.

Clubcard:
Now I have tried double-clicking to no good end. The LED stays resolutely on.

OK, the lack of a pulse makes me think the trick of double-click making the bootloader run permanently isn't working. Let's try the other approach, which requires specific timing:

  • Tools > Port > select the port of your board
  • Start an upload.
  • Watch the black console window. When you see something like "PORTS {COM5, } / {COM5, } => {}", press the reset button.

In this technique, it's important to wait until the Arduino IDE is already expecting the reset to occur before pressing the reset button because normally the bootloader only runs for a very short time. If you press the reset button too soon, the bootloader will have already given up waiting for an upload before the IDE is ready to start it (after you press the IDE's "Upload" button, it has to compile the sketch before starting the actual upload).

Clubcard:
Many thanks for your input. I think the boards were also called Adruino Uno Zero & Arduino Uno Zero Pro but here in the UK they use a slightly different name. The key thing is that they are an Atmel SAMD21G18A SoC. The Pro version has 2 USB ports since a second processor deals with debugging...

Some information for the sake of making sure that everyone is on the same page:
The Arduino Uno uses the ATMega328 (or similar) microcontroller.
The Uno Pro is an addon for the basic Uno.
The Arduino Zero and M0 Pro are very similar boards. They both use the same SAMD microcontroller and have an onboard EBDG for programming, as well as a native USB. The Zero is produced by the current Arduino company, the M0 Pro was produced by the 'other' Arduino (Arduino.org), and is a retired product.
There was also a basic version of the M0, which didn't have the EDBG.

Now the reset trick certainly had an effect on both boards. No longer do they repeatedly say that they can find no board. Instead, I get this (verbose output below image). I have only posted the text in orange/brown.

I do apologise for linking to the images but the just returned a blank screen (I really am an idiot). I don't know if it is of any import but from day 1 I installed Atmel Studio 7 & compiled & debugged through it. I was writing entirely in assembly language and so the writes started from address $00000000 because I set up all of the vectors the app used while the remainder were used as SWIs.

Imgur: The magic of the Internet Arduino M0 Pro

Open On-Chip Debugger 0.9.0-g932ec70 (2017-02-15-12:34)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
debug_level: 2
Info : only one transport option; autoselect 'swd'
adapter speed: 500 kHz
adapter_nsrst_delay: 100
cortex_m reset_config sysresetreq
Info : CMSIS-DAP: SWD Supported
Info : CMSIS-DAP: JTAG Supported
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 500 kHz
Info : SWD IDCODE 0x0bc11477
Error: Target not examined yet
in procedure 'program'
in procedure 'reset' called at file "embedded:startup.tcl", line 478
in procedure 'ocd_bouncer'

Runtime Error: embedded:startup.tcl:454: ** Unable to reset target **
in procedure 'program'
in procedure 'program_error' called at file "embedded:startup.tcl", line 479
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

Imgur: The magic of the Internet Arduino M0

processing.app.debug.RunnerException
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:152)
at cc.arduino.UploaderUtils.upload(UploaderUtils.java:77)
at processing.app.SketchController.upload(SketchController.java:732)
at processing.app.SketchController.exportApplet(SketchController.java:703)
at processing.app.Editor$UploadHandler.run(Editor.java:2042)
at java.lang.Thread.run(Thread.java:748)
Caused by: processing.app.SerialException: Error touching serial port 'COM3'.
at processing.app.Serial.touchForCDCReset(Serial.java:107)
at cc.arduino.packages.uploaders.SerialUploader.uploadUsingPreferences(SerialUploader.java:136)
... 5 more
Caused by: jssc.SerialPortException: Port name - COM3; Method name - openPort(); Exception type - Port busy.
at jssc.SerialPort.openPort(SerialPort.java:164)
at processing.app.Serial.touchForCDCReset(Serial.java:101)
... 6 more
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for suggestions.
Exception in thread "Thread-76" java.lang.NullPointerException
at cc.arduino.contributions.libraries.LibrariesIndexer.lambda$rescanLibraries$2(LibrariesIndexer.java:165)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:174)
at java.util.LinkedList$LLSpliterator.forEachRemaining(LinkedList.java:1235)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
at cc.arduino.contributions.libraries.LibrariesIndexer.rescanLibraries(LibrariesIndexer.java:167)
at cc.arduino.contributions.libraries.LibrariesIndexer.setLibrariesFolders(LibrariesIndexer.java:120)
at processing.app.BaseNoGui.onBoardOrPortChange(BaseNoGui.java:678)
at processing.app.Base.onBoardOrPortChange(Base.java:1312)
at processing.app.Editor$UploadHandler.run(Editor.java:2078)
at java.lang.Thread.run(Thread.java:748)