Go Down

Topic: Arduino MKR Zero sketch COM port switching issue (Read 883 times) previous topic - next topic

Ryaebi

Device in question is an Arduino MKR Zero. The issue I believe is that the COM port changes during the upload process. I've seen some similar problems but not quite like this one.

Sketch being used is the Blink sketch. I know the Arduino is at least partially accepting the sketch as I can change the blink value from say the classic 1:1 On:Off, to a 3:1 On:off and the LED responds accordingly. I'll post the error messages below.

Here is what I've done:
  • Updated the Board manager
  • Tried several USB cables
  • Ensured that USB is a 2.0 connector and tried different ports
  • Uninstalled and reinstalled drivers through device manger, including double tapping Arduino
  • Tried IDE through download and online version


I think the key problem is the change from COM7 to COM8 during its upload process (look at the bottom I put it in bold and underlined). Any suggestions? Also I've seen this SAM-BA error in other forums but none of their solutions help.


Error 1 before changing COM port but knowing that at least the Blink sketch responds with changing the timing. (I deleted some of the error lines due to character limit that focused on the file paths, nothing was deleted after the 'Maximum is 262144 bytes' line.)



Arduino: 1.8.5 (Windows 7), Board: "Arduino MKRZERO"


Compiling sketch...
Compiling libraries...
Compiling core...
Using previously compiled file:
Sketch uses 10080 bytes (3%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM7
PORTS {COM7, } / {} => {}
PORTS {} / {} => {}
PORTS {} / {COM8, } => {COM8, }
Found upload port: COM

C:\Users\Ryan\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM8 -U true -i -e -w -v C:\Users\Ryan\AppData\Local\Temp\arduino_build_595580/Blink.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:46
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:46
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       : 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.836 seconds

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

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

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

[=======================       ] 79% (128/162 pages)write(addr=0x20005000,size=0x880)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x880)

[==============================] 100% (162/162 pages)
done in 0.069 seconds

Verify 10336 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = cde2
checksumBuffer(start_addr=0x3000, size=0x1000) = bfd5
checksumBuffer(start_addr=0x4000, size=0x860) = 5262
Verify successful
done in 0.014 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)


ballscrewbob

There is a "SPECIFIC" MKRZERO section.

Also error messages and code you be posted using CODE TAGS ( </> ) to avoid corruption by the forum.

I find it a little odd thats it is only partially accepting a sketch as it is usually all or nothing.

Anyway moving you to correct section.

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.

Ryaebi

Thanks for moving to the correct section.

The only update I have so far is it is still appearing the COM port selected is opening and then another COM port is opening that is tagged as the bootloader. (the bootloader COM port is only open for about 1-2 seconds which I think I missed before.

I tried a couple things including:
- changing the COM ports around to match the once the bootloader COM opens
-uninstalling and reinstalling device
-changing COM ports

Also I keep getting a SAM-BA operation failed error. I'm starting to think I may have a bad bootloader is that possible?
Code: [Select]
./opt/arduino-builder/arduino-builder -compile -core-api-version 10611 -hardware opt/arduino-builder/hardware -hardware ./opt/cores -tools opt/arduino-builder/tools -tools ./opt/tools -built-in-libraries opt/libraries/latest -logger humantags -fqbn arduino:samd:mkrzero -build-cache /tmp -build-path /tmp/294623138/build -verbose -prefs runtime.tools.arm-none-eabi-gcc.path=./opt/tools/arm-none-eabi-gcc/4.8.3-2014q1 -prefs runtime.tools.bossac.path=./opt/tools/bossac/1.7.0 -prefs runtime.tools.openocd.path=./opt/tools/openocd/0.9.0-arduino6-static -prefs runtime.tools.CMSIS.path=./opt/tools/CMSIS/4.5.0 -prefs runtime.tools.CMSIS-Atmel.path=./opt/tools/CMSIS-Atmel/1.1.0 -prefs runtime.tools.arduinoOTA.path=./opt/tools/arduinoOTA/1.2.0 -libraries /tmp/294623138/custom -libraries /tmp/294623138/pinned /tmp/294623138/Blink

Sketch uses 10072 bytes (3%) of program storage space. Maximum is 262144 bytes.

Programming with: Serial

Restarting in bootloader mode

Get port list before reset

[COM7 COM7]

Touching port COM7 at 1200bps

Set DTR off

Flashing with command:C:/Users/Ryan/.arduino-create/arduino/bossac/1.7.0/bossac.exe -i -d --port=COM7 -U true -i -e -w -v C:/Users/Ryan/AppData/Local/Temp/arduino-create-agent525668497/Blink.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:46

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:46

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 : 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.837 seconds

Write 10328 bytes to flash (162 pages)

write(addr=0x20005000,size=0x1000)

writeBuffer(scr_addr=0x20005000, dst_addr=0x2000, size=0x1000)


[=========== ] 39% (64/162 pages)write(addr=0x20005000,size=0x1000)

writeBuffer(scr_addr=0x20005000, dst_addr=0x3000, size=0x1000)


[======================= ] 79% (128/162 pages)write(addr=0x20005000,size=0x880)

writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x880)


[==============================] 100% (162/162 pages)

done in 0.069 seconds

Verify 10328 bytes of flash with checksum.

checksumBuffer(start_addr=0x2000, size=0x1000) = 1108

checksumBuffer(start_addr=0x3000, size=0x1000) = 6ab3

checksumBuffer(start_addr=0x4000, size=0x858) = 7e32

Verify successful

done in 0.014 seconds

CPU reset.

readWord(addr=0)=0x20007ffc

readWord(addr=0xe000ed00)=0x410cc601

readWord(addr=0x41002018)=0x10010305

writeWord(addr=0xe000ed0c,value=0x5fa0004)

SAM-BA operation failed

ballscrewbob

So looking at that it does complete the upload.

And as far as it swapping to another COM port during the upload that is perfectly normal with a few boards especially the MKR series.

IIRC the upload should end about 5 lines up from the bottom of your list.

Same OS here but am using IDE 1.8.7 and haven't seen your error.
Think this might be one for Sandeep to take a peek at on Monday when hes back.




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.

jackrubin

Hello,

I'm having the same problem referenced above. My MKRZERO is on COM10 but the uploader resets and aims at COM11. I'm reloading "blink" and as with the earlier poster, I can modify the blink time (from 1000/1000 to 3000/1000 on/off) but the upload still throws a SAM-BA error.

Code: [Select]

Arduino: 1.8.8 (Windows 7), Board: "Arduino MKRZERO"
...

Compiling libraries...
Compiling core...
Using previously compiled file: C:\Users\Jack\AppData\Local\Temp\arduino_build_566086\core\variant.cpp.o
Using precompiled core: C:\Users\Jack\AppData\Local\Temp\arduino_cache_187890\core\core_arduino_samd_mkrzero_b0941e12511aeb790c50d48f1f0683ef.a
Linking everything together...
"C:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-gcc" "-LC:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086" -Os -Wl,--gc-sections -save-temps "-TC:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\hardware\\samd\\1.6.19\\variants\\mkrzero/linker_scripts/gcc/flash_with_bootloader.ld" "-Wl,-Map,C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.map" --specs=nano.specs --specs=nosys.specs -mcpu=cortex-m0plus -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -o "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.elf" "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086\\sketch\\Blink.ino.cpp.o" "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086\\core\\variant.cpp.o" -Wl,--start-group "-LC:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\CMSIS\\4.5.0/CMSIS/Lib/GCC/" -larm_cortexM0l_math -lm "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/..\\arduino_cache_187890\\core\\core_arduino_samd_mkrzero_b0941e12511aeb790c50d48f1f0683ef.a" -Wl,--end-group
"C:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O binary "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.elf" "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.bin"
"C:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-objcopy" -O ihex -R .eeprom "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.elf" "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.hex"
"C:\\Users\\Jack\\AppData\\Local\\Arduino15\\packages\\arduino\\tools\\arm-none-eabi-gcc\\4.8.3-2014q1/bin/arm-none-eabi-size" -A "C:\\Users\\Jack\\AppData\\Local\\Temp\\arduino_build_566086/Blink.ino.elf"
Sketch uses 9736 bytes (3%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM10
PORTS {COM1, COM10, } / {COM1, COM10, } => {}
PORTS {COM1, COM10, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM11, } => {COM11, }
Found upload port: COM11
C:\Users\Jack\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac.exe -i -d --port=COM11 -U true -i -e -w -v C:\Users\Jack\AppData\Local\Temp\arduino_build_566086/Blink.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:46
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:46
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       : 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.874 seconds

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

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

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

[========================      ] 81% (128/157 pages)write(addr=0x20005000,size=0x740)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x740)

[==============================] 100% (157/157 pages)
done in 0.089 seconds

Verify 9992 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = b672
checksumBuffer(start_addr=0x3000, size=0x1000) = 8c
checksumBuffer(start_addr=0x4000, size=0x708) = c22a
Verify successful
done in 0.015 seconds
CPU reset.
readWord(addr=0)=0x20007ffc
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)

Go Up