Problems Uploading sketch

I am using a Windows 10 laptop in conjunction with Arduino MKRZero board and have produced a very small sketch to output a square wave.

The sketch conpiles successfully but unfortunately does not upload. I get a message "An error ocurred while uploading the sketch".

Initially I was able to compile and upload, but for some reason the uploading doesnt happen now due to the error.

I notice the original sketch is still contained within the MKRZero board as it is still producing the same square wave output. Do I need to delete the old sketch before uploading the new ? If so, how do I do this because simply disconnecting the power supply does not work.

I have tried hitting the RST switch on the Arduino board but to no avail. I have also tried numerous other things such as disabling Bluetooth on the laptop, trying all the different usb ports and updating drivers, nothing seems to work !

This is my first attempt to upload an Arduino sketch.

Please do this:

  • (In the Arduino IDE) File > Preferences
  • Uncheck the checkbox next to “Show verbose output during: compilation”
  • Check the checkbox next to "Show verbose output during: upload
  • Click “OK”
  • Sketch > Upload
  • After the upload fails, you’ll see a button on the right side of the orange bar “Copy error messages” (or the icon that looks like two pieces of paper at the top right corner of the black console window in the Arduino Web Editor). Click that button.
  • In a forum reply here, click on the reply field.
  • Click the </> button on the forum toolbar. This will add the forum’s code tags markup to your reply.
  • Press “Ctrl + V”. This will paste the upload output between the code tags.
  • Move the cursor outside of the code tags before you add any additional text to your reply.
Arduino: 1.8.9 (Windows 10), Board: "Arduino MKRZERO"

Sketch uses 11624 bytes (4%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM1
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
Uploading using selected port: COM1
C:\ProgramData\MATLAB\SupportPackages\R2018b\3P.instrset\arduinoide.instrset\idepkgs\packages\arduino\tools\bossac\1.7.0-arduino3/bossac.exe -i -d --port=COM1 -U true -i -e -w -v C:\Users\Tandr\AppData\Local\Temp\arduino_build_584524/SCLK.ino.bin -R 
An error occurred while uploading the sketch

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Make sure you have selected the port of your MKR Zero from the Tools > Port menu.

The port should be labeled "Arduino MKRZERO". If it only says something like "COM1", then that's not the port of your MKR Zero.

COM1 (Arduino MKRZERO)

Device manager also agrees with COM1.

No other usb devices are attached.

"COM1 (Arduino MKRZERO)"
This is strange. I've never seen a PC that doesn't use COM1 for the Host Controller Interface, which includes the USB ports on the motherboard. Downstream USB ports get different COM port assignments.

Go to your Device Manager and expand Com & LPT. If you see a yellow exclamation mark, then there's a problem with the device or its driver.

In this screenshot, I have one USB device attached, it is a Wemos D1 Mini:

It seems as though com3 & 4 are in use, even though I havent connected anything to them. Must be the host usb controller and something else ?

Any as you can see from the screenshot there isnt any yellow exclaimation mark.

What laptop? Do you have other USB ports to try?

derick007:
This is my first attempt to upload an Arduino sketch.

How did the sketch get into the board in the first place?

This just doesn't look right.

I think I have solved the uploading problem.

Just hit the RESET button twice, looks as though it clears the board of the current sketch and allows a new one to be uploaded.