shumatech / BOSSA

BOSSA is a flash programming utility for Atmel's SAM family of flash-based ARM microcontrollers. The motivation behind BOSSA is to create a simple, easy-to-use, open source utility to replace Atmel's SAM-BA software. BOSSA is an acronym for Basic Open Source SAM-BA Application to reflect that goal.
http://www.shumatech.com/web/products/bossa
BSD 3-Clause "New" or "Revised" License
362 stars 251 forks source link

Flashing fails with this compiled version while 1.7 is doing fine. #96

Open pjalocha opened 5 years ago

pjalocha commented 5 years ago

1.7 supplied with Arduino 1.8.9 works just fine, but when I compile and run this version here it fails as below.

The command given is like this:

bossac --port=ttyACM0 -i -U -e -w -R -v .bin

and the relevant part of the reply:

Done in 0.740 seconds Write 49716 bytes to flash (777 pages) [==============================] 100% (777/777 pages) Done in 0.255 seconds Verify 49716 bytes of flash [==============================] 100% (777/777 pages) Verify failed Page errors: 128 Byte errors: 7956

RatGit commented 5 years ago

I have the same issue I think...

I've compiled versions 1.7.0, 1.8 and 1.9.1 on a Raspberry Pi 3B+ which I use to program a SparkFun SAMD21 Mini Breakout board, (ie. an Arduino Zero clone).

Both 1.8 and 1.9.1 fail in the same way, (see below), whereas 1.7.0 works? One thing I've noticed is that 1.7.0 successfully detects the USB port and connects at the higher speed, (Connected at 921600 baud), whereas the later versions don't:

sudo bossac -i -d --port=ttyACM0 --usb-port=true -e -w -v -R '/home/programmer/Sampler_Controller.bin' Send auto-baud Set binary mode version()=v2.0 [Arduino:XYZ] Dec 20 2016 15:36:39 Connected at 115200 baud readWord(addr=0)=0x20007ffc readWord(addr=0xe000ed00)=0x410cc601 readWord(addr=0x41002018)=0x10010305 write(addr=0x20004000,size=0x34)

SAM-BA operation failed

I also find that I have to run the following command beforehand to ensure that bossac will work. (The SAMD21 board also occasionally needs to be unplugged and re-inserted).

sudo stty -F /dev/ttyACM0 speed 1200 cs8 -cstopb -parenb

If I don't do this I get the following error:

Set binary mode Send auto-baud Set binary mode No device found on ttyACM0

galak commented 5 years ago

Did some bisecting and got this commit causing issues:

commit ee5a651aacaf2c3fbcd539789574618a425d1a06 (refs/bisect/bad) Author: Scott Shumate scott@esquilo.io Date: Sun May 21 09:58:01 2017 -0500

Refactored to encapsulate all device-specific knowledge into the Device
class including flash creation to prevent Samba from being a dumping
ground for miscellaneous device features.
cmaglie commented 5 years ago

@RatGit the semantic of -U parameter has been changed from 1.7. You may want to try to replace --usb-port=true or -U true to just -U

cmaglie commented 5 years ago

@pjalocha @RatGit try also to add -o 0x2000 to the command line (I suppose you're running a SAMD21 based board), previously the offset to skip the bootloader size was built-in in bossac, now you must specify it via command line.

nzmichaelh commented 4 years ago

@RatGit re: the board needing to be unplugged and then plugged back in, I see the same due to a race between the 'stty' call, the board detaching, and Bossa attaching. If the board hasn't finished restarting then Linux puts the board on ttyACM1 instead of ttyACM0

rzr commented 1 year ago

I confirm zephyr's version is working fine on arduino_nano_33_ble

I can provide some traces if it helps

/usr/local/bin/bossac-1.9.1-14-g3532de8  --version # KO
Basic Open Source SAM-BA Application (BOSSA) Version 1.9.1-14-g3532de8

/usr/local/bin/bossac-1.9.1-17-g89f3556 --version # OK
Basic Open Source SAM-BA Application (BOSSA) Version 1.9.1-17-g89f3556

Relate-to: https://gitlab.eclipse.org/eclipse/oniro-core/docs/-/issues/141#notes