Upload problems with MKR1000 - COM port switching

I have problems uploading to the mkr1000 I cannot even upload a short code like this

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

The error code I get is:

Sketch uses 9928 bytes (3%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM13
PORTS {COM3, COM13, } / {COM3, COM13, } => {}
PORTS {COM3, COM13, } / {COM3, COM8, COM13, } => {COM8, }
Found upload port: COM8
C:\Users\donsmajz\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM8 -U true -i -e -w -v C:\Users\donsmajz\AppData\Local\Temp\arduino_build_146933/sketch_mar13a.ino.bin -R 
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Dec 20 2016 15:36:43
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Atmel SMART device 0x10010005 found
write(addr=0x20004000,size=0x34)
writeWord(addr=0x20004030,value=0x10)
writeWord(addr=0x20004020,value=0x20008000)
Device       : ATSAMD21G18A
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v2.0 [Arduino:XYZ] Dec 20 2016 15:36:43
Version      : v2.0 [Arduino:XYZ] Dec 20 2016 15:36:43
Address      : 8192
Pages        : 3968
Page Size    : 64 bytes
Total Size   : 248KB
Planes       : 1
Lock Regions : 16
Locked       : readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
readWord(addr=0x41004020)=0xffff
none
readWord(addr=0x41004018)=0
Security     : false
Boot Flash   : true
readWord(addr=0x40000834)=0x7000a
BOD          : true
readWord(addr=0x40000834)=0x7000a
BOR          : true
Arduino      : FAST_CHIP_ERASE
Arduino      : FAST_MULTI_PAGE_WRITE
Arduino      : CAN_CHECKSUM_MEMORY_BUFFER
Erase flash
chipErase(addr=0x2000)
done in 0.817 seconds

Write 10184 bytes to flash (160 pages)
write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)

[============                  ] 40% (64/160 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)

[========================      ] 80% (128/160 pages)write(addr=0x20005000,size=0x800)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x800)

[==============================] 100% (160/160 pages)
done in 0.082 seconds

Verify 10184 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 1491
checksumBuffer(start_addr=0x3000, size=0x1000) = a4a5
checksumBuffer(start_addr=0x4000, size=0x7c8) = db5
Verify successful
done in 0.008 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)
Couldn't find a Board on the selected port. Check that you have the correct port selected.  I

The arduino has COM13 and the arduino bootloader has COM08. However during upload the board is reset and switches to COM08 and stops.
I have tried

  • reinstalling drivers : (driver date = 24-11-2015, version 1.2.3.0, Arduino LLC,) they were installed by downloading the non-administrator version of the IDE ( 1.8.8 )
  • setting the device in bootloader moder /com08 before upload ( double tapping reset button)
  • pressing reset during upload
  • double tapping while uploading

The problem is on/off, but I suspect that the problem could be related to the board which are preloaded with a sketch which does massive output to the serial port [ serial.Print("stuff")] -

Othertimes i get this message (port busy) when uploading:

Sketch uses 9928 bytes (3%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM13
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 'COM13'.
	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 - COM13; Method name - openPort(); Exception type - Port busy.
	at jssc.SerialPort.openPort(SerialPort.java:164)
	at processing.app.Serial.touchForCDCReset(Serial.java:101)
	... 6 more

Are you using the ONLINE editor or the regular desktop IDE ?

The swapping of COM ports is normal with the MKR1000.
The issue has been covered quite well in the MKR1000 section where you will find additional help and information.

Some possible causes are Antivirus software (turn off to try an upload), Power only USB cord (make sure it is both power and DATA), USB 3.0 ports (Try a USB 2.0 port), Insufficient user privileges (on windows Administrative privileges would be preferential).