While uploading basic "blink" sketch the usb connection unplugs and plugs itself back on (no official error but sketch did not upload) -> What to do?

I plugged my MKRZero on my PC via usb connection and tried to run the basic "blink" sketch. While uploading -> the usb connection unplugs itself. After 1 second it plugs in again and no error message occurs. The sketch "is successfully uploaded" but the blink sketch did not run on the MKRZero. The console says:
"Upload done."
Atmel SMART device 0x10010005 found
Device : ATSAMD21G18A
Chip ID : 10010005
Version : v2.0 [Arduino:XYZ] Dec 20 2016 15:36:46
Address : 8192
Pages : 3968
Page Size : 64 bytes
Total Size : 248KB
Planes : 1
Lock Regions : 16
Locked : none
Security : false
Boot Flash : true
BOD : true
BOR : true
Erase flash
done in 0.837 seconds

Write 10996 bytes to flash (172 pages)
[==============================] 100% (172/172 pages)
done in 0.088 seconds

Verify 10996 bytes of flash with checksum.
Verify successful
done in 0.011 seconds
CPU reset.
Can you guys help me on this one? Whats the problem and how can I solve it?

Best regards,

Which LED are you trying to blink ?

What OS and IDE are you running?

Tom... :smiley: :+1: :coffee: :australia:

Hi guys,

@UKHeliBob : The build in LED "LED_BUILDIN".
@TomGeorge : Windows / Arduino IDE

But to be honest I think it works. When I wrote this topic I wasnt paying enough attention I think. The sketch did upload properly believe it or not. I asked a college in the office and he told me that when he was studying, some other students had the same "issue" but the code still ran. Maybe it is from client to client different?

I have a similar issue both on my Linux machine and the Web IDE. I usually have to compile 3-8 times to get the code onto the board, which in the Web Editor really eats into my compilation time.

Usually after a few clicks on the upload button it goes through though.

It is normal for the USB connection to reset (usually twice) when uploading a sketch. First, your old sketch is halted and the bootloader starts (and reinitializeds the USB connection to your PC.) After the bootloader had copied in the new sketch, it starts the sketch code, which will again set up a new USB connection.

This can occasionally cause problems if one of the times the USB comes back as a different COM port for some reason, but it usually works OK.

1 Like

Oh god. I returned a Nano Every because it kept doing this. One minute it was /dev/ttyUSB0, then it was /dev/ttyACM0, the next it was /dev/ttyUSB1.

I had to get lucky to actually upload stuff to the thing.