Go Down

Topic: Arduino MKR1000 changes COM port after upload (Read 2580 times) previous topic - next topic

mnoebauer

Following problem:

Everytime I upload a sketch to my MKR1000 the COM Port changes from e.g 6 to 7 and I get following error message:

Code: [Select]


Sketch uses 21,016 bytes (8%) of program storage space. Maximum is 262,144 bytes.
Forcing reset using 1200bps open/close on port COM7
PORTS {COM3, COM7, } / {COM3, COM7, } => {}
PORTS {COM3, COM7, } / {COM3, } => {}
PORTS {COM3, } / {COM3, } => {}
PORTS {COM3, } / {COM3, COM7, } => {COM7, }
Found upload port: COM7
C:\Users\Michael\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM7 -U true -i -e -w -v C:\Users\Michael\AppData\Local\Temp\arduino_build_744478/mkr1000_test.ino.bin -R
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
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] Nov 24 2015 11:35:16
Version      : v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
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.830 seconds

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

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

[===========                   ] 38% (128/334 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x1000)

[=================             ] 57% (192/334 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x5000, size=0x1000)

[======================        ] 76% (256/334 pages)write(addr=0x20005000,size=0x1000)
writeBuffer(scr_addr=0x20005000, dst_addr=0x6000, size=0x1000)

[============================  ] 95% (320/334 pages)write(addr=0x20005000,size=0x380)
writeBuffer(scr_addr=0x20005000, dst_addr=0x7000, size=0x380)

SAM-BA operation failed
An error occurred while uploading the sketch

[==============================] 100% (334/334 pages)
done in 0.171 seconds

Verify 21344 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 41ad
checksumBuffer(start_addr=0x3000, size=0x1000) = dfeb
checksumBuffer(start_addr=0x4000, size=0x1000) = 376d
checksumBuffer(start_addr=0x5000, size=0x1000) = 4088
checksumBuffer(start_addr=0x6000, size=0x1000) = 1a8d
checksumBuffer(start_addr=0x7000, size=0x360) = b3f4
Verify successful
done in 0.027 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)



The interesting thing is that the upload basically works. I tried two different sketches and after resetting the right COM port I could verify whether it was working or not.

I tried Arduino 1.6.11 as well as 1.6.12.
All my libraries are up to date and I am using Arduino SAMD Boards ver. 1.6.8.

Additionally I checked the whole upload sequence on my Arduino Uno with a different sketch and this works perfectly fine.

Of course I checked the forum (https://forum.arduino.cc/index.php?topic=394826.0
and
http://stackoverflow.com/questions/39479678/arduino-changes-com-port-when-uploading-code-windows).
But the first suggestion did not solve my problem and the second "solution" is to use a different programming environment - which I don't want to.

Any ideas?

Thx a lot!


ballscrewbob

#1
Nov 02, 2016, 01:32 am Last Edit: Nov 02, 2016, 01:34 am by Ballscrewbob
The com port changing is something the MKR does along with a couple of other boards.

The output you provided shows everything went well

I use 1.6.12 here under win 7, 8.1 and 10 with no issues to MKR's

There are ways to lock a COM port from inside windows but I would not recommend it anymore for the MKR or similar boards.

Output from an upload here is below and you will see that it is very similar.
It finds the first COM port then swaps to the upload / bootloader port.
If you want to do this manually just quickly double tap the MKR reset button whilst you have device manager open and see it in action. Mine uses COM 17 and 18 that's all


Code: [Select]

Sketch uses 9,216 bytes (3%) of program storage space. Maximum is 262,144 bytes.
Forcing reset using 1200bps open/close on port COM17
PORTS {COM1, COM3, COM17, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, } => {}
PORTS {COM1, COM3, } / {COM1, COM3, COM18, } => {COM18, }
Found upload port: COM18
d:\Users\Bob\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM18 -U true -i -e -w -v d:\Users\Bob\AppData\Local\Temp\arduino_build_950382/mkr_serial_test_blink.ino.bin -R
Set binary mode
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
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] Nov 24 2015 11:35:16
Version      : v2.0 [Arduino:XYZ] Nov 24 2015 11:35:16
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.611 seconds

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

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

[=========================     ] 86% (128/148 pages)write(addr=0x20005000,size=0x500)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x500)

[==============================] 100% (148/148 pages)
done in 0.047 seconds

Verify 9472 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = cd7c
checksumBuffer(start_addr=0x3000, size=0x1000) = bafa
checksumBuffer(start_addr=0x4000, size=0x500) = 19c4
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)
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

mnoebauer

Thx Ballscrewbob for your answer.

What basically got my attention was the error message "An error occured while uploading the sketch" and the line "SAM-BA operation failed". That is actually how everything started ;-)

So I am not sure if these things are related somehow or if we are looking at a different problem here.

ballscrewbob

Would you mind posting your sketch and I will try it on one of my MKR's

Easier to replicate an issue if we are both on the same page.
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

mnoebauer

Sure, here you go.

These are two simple sketches, copied from the homepage (the first just connects to my WiFi network at home and the other one scans for available WiFi networks). I get the same error message with both of them.

ballscrewbob

OK they both work just fine here on win 7 x64.

It looks like a serial issue but I cant be sure.
Just a few suggestions and maybe one of them will help. If not you may want to raise the issue on the arduino github

1. swap the USB cable
2. Ensure you use a USB 2.0 port and not USB 3.0
3. Turn off any antiviuses or similar software for a test
4. Try run the IDE as an Administrator. Not the same as a user with admin rights this is above that.
5. Turn off any power saving items especially concerned with USB.

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

mnoebauer

Just a little update on this problem:

Checked my MKR1000 with the same cable on a different laptop.
Uploaded the very basic "Blink" sketch and it worked perfectly fine. Was using the same IDE (1.6.12).

Then verified the "Blink" sketch with my original laptop and it did not work.

So I suspect somehow there seems to be a SW glitch with some other programs on my original laptop (e.g installed MS Visual Studio 2015 a few weeks ago but it's the first time trying my MKR1000 since then).

If I ever find the root cause for this issue I'll post it here.

ballscrewbob

Just out of curiosity what type of USB port was used on each machine ? 2.0 or 3.0
It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

mnoebauer

#8
Nov 06, 2016, 06:16 pm Last Edit: Nov 06, 2016, 07:57 pm by mnoebauer
It most likely was an USB 2.0 port on my old laptop (built in 2008)...

Anyway: You gave me the right hint. Just uninstalled the USB 3.0 drivers on my current laptop and the problem disappeared.
So now I have a pretty decent workaround. Apparently you can't have it all ;-)

I really appreciate your help, thx a lot!

LadyStardust

Hi,
I am having the same problem, but after looking for the drivers I was unable to find them, could you please provide this link?, I am not pretty sure if I have to change the Arduino IDE version too, now I am using 1.8.5. I just want to change the drivers before doing so.

Thanks for your help.

ballscrewbob

@LadyStardust

The Drivers are included in the install of the IDE.
Once it detects the board they should load up without any intervention.
The are in the subfolder of the IDE installation called DRIVERS.

Are you upgrading or downgrading the IDE ?

It may not be the answer you were looking for but its the one I am giving based on either experience, educated guess, google or the fact that you gave nothing to go with in the first place so I used my wonky crystal ball.

Go Up