SAM-BA error, Metro M0 Express board will not upload sketch

Please tell us which board you are using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
nathb1028
 
Posts: 2
Joined: Thu Apr 18, 2019 6:36 pm

SAM-BA error, Metro M0 Express board will not upload sketch

Post by nathb1028 »

Tested:

USB cable -- works fine for my other boards
I've tried every port on my computer, they all work fine
the board comes up as a device just fine, enters boot mode just fine
Updated the drivers multiple times back and forth
Installed and uninstalled Arduino.exe
Reset the board Manager
bootloader -- updated to most recent .UF2
board usually dies after upload then comes back under a different port in the COM menu.

Always throws SAM-BA Error

please help

Code: Select all


Arduino: 1.8.9 (Windows 7), Board: "Adafruit Metro M0 Express"

Sketch uses 10504 bytes (4%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM7
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
PORTS {COM1, COM7, } / {COM1, COM7, } => {}
Uploading using selected port: COM7
C:\Users\########\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac -i -d --port=COM7 -U true -i -e -w -v C:\Users\#########\AppData\Local\Temp\arduino_build_59901/sketch_apr18a.ino.bin -R 
Set binary mode
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v1.1 [Arduino:XYZ] May  8 2018 12:08:04
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20002dd8
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)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v1.1 [Arduino:XYZ] May  8 2018 12:08:04
Version      : v1.1 [Arduino:XYZ] May  8 2018 12:08:04
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.675 seconds

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

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

[======================        ] 75% (128/169 pages)write(addr=0x20005000,size=0xa40)

writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0xa40)
SAM-BA operation failed

[==============================] 100% (169/169 pages)
done in 0.071 seconds

Verify 10760 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = 1cee
checksumBuffer(start_addr=0x3000, size=0x1000) = 5b5a
checksumBuffer(start_addr=0x4000, size=0xa08) = bbea
Verify successful
done in 0.020 seconds
CPU reset.
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)
An error occurred while uploading the sketch

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

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: SAM-BA error, Metro M0 Express board will not upload ske

Post by danhalbert »

See if this helps. Try a simple Blink sketch first. Double-click so you get a pulsing red LED, and then choose the right port in the Port menu.

If you upload a program that crashes, the automatic upload will not work, because it's dependent on code in your program. It's not a separate tiny microcontroller controlling USB as with the regular Arduino.

See if these help: https://learn.adafruit.com/adafruit-met ... ro-m0-help

User avatar
nathb1028
 
Posts: 2
Joined: Thu Apr 18, 2019 6:36 pm

Re: SAM-BA error, Metro M0 Express board will not upload ske

Post by nathb1028 »

I have tried the Blink sketch and it does something weird.

The code works, LED_BUILTIN blinks at the correct rate.

However Serial Monitor doesn't work on my other code, and I still receive the same error:

another wired thing,
it uploads to COM7 but my board is on COM10 -- but his might be standard.

Code: Select all

Arduino: 1.8.9 (Windows 7), Board: "Adafruit Metro M0 Express"

Sketch uses 9496 bytes (3%) of program storage space. Maximum is 262144 bytes.
Forcing reset using 1200bps open/close on port COM10
PORTS {COM1, COM10, } / {COM1, } => {}
PORTS {COM1, } / {COM1, } => {}
PORTS {COM1, } / {COM1, COM7, } => {COM7, }
Found upload port: COM7
C:\Users\#########\AppData\Local\Arduino15\packages\arduino\tools\bossac\1.7.0/bossac -i -d --port=COM7 -U true -i -e -w -v C:\Users\#########\AppData\Local\Temp\arduino_build_563543/sketch_apr18a.ino.bin -R 
Set binary mode
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
version()=v1.1 [Arduino:XYZ] May  8 2018 12:08:04
chipId=0x10010005
Connected at 921600 baud
readWord(addr=0)=0x20002dd8
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)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
Chip ID      : 10010005
version()=v1.1 [Arduino:XYZ] May  8 2018 12:08:04
Version      : v1.1 [Arduino:XYZ] May  8 2018 12:08:04
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.694 seconds

Write 9752 bytes to flash (153 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

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

[=========================     ] 83% (128/153 pages)write(addr=0x20005000,size=0x640)
writeBuffer(scr_addr=0x20005000, dst_addr=0x4000, size=0x640)

[==============================] 100% (153/153 pages)
done in 0.066 seconds

Verify 9752 bytes of flash with checksum.
checksumBuffer(start_addr=0x2000, size=0x1000) = eb71
checksumBuffer(start_addr=0x3000, size=0x1000) = d70a
checksumBuffer(start_addr=0x4000, size=0x618) = 2dc8
Verify successful
done in 0.019 seconds
CPU reset.
readWord(addr=0)=0x20002dd8
readWord(addr=0xe000ed00)=0x410cc601
readWord(addr=0x41002018)=0x10010305
writeWord(addr=0xe000ed0c,value=0x5fa0004)

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

User avatar
danhalbert
 
Posts: 4653
Joined: Tue Aug 08, 2017 12:37 pm

Re: SAM-BA error, Metro M0 Express board will not upload ske

Post by danhalbert »

Could you post the sketch that does not work? It may be crashing. That will cause upload difficulties.

On a classic Arduino, the USB connection is handled by a separate microcontroller (the tiny 16U2 chip on the board). The 16U2 can detect the 1200 baud speed change that Arduino uses to signal an upload, and then forcibly load the main AVR microcontroller. But on the SAMD boards, the main chip itself provides USB. But if it's not doing well, due to a crashed or buggy program, then the 1200 baud detection logic isn't running. So you have to double-click to get to the bootloader.

The SAMD boards present multiple USB devices, with different USB ids (vendor/product, aka VID/PID): one ID is the UF2 bootloader, another is presented by Arduino programs, and a third is presented by CircuitPython. Windows in its infinite wisdom assigns different COM ports to all of these, and the Arduino IDE can get quite confused. That's why you're seeing COM7 and COM10. The situation is simpler on MacOS and Linux, where the device name corresponds to the physical port, not the device ID.

Locked
Please be positive and constructive with your questions and comments.

Return to “Metro, Metro Express, and Grand Central Boards”