3

Running Ubuntu 12.04.4 LTS (64 bit) I try to upload my code to the Arduino Due through the Native port. I have tried both the bossac that ships with the Arduino IDE (which is a modified version of BOSSA), and the master BOSSA branch.

Running this command:

sudo ./bossac -p /dev/ttyACM0

I get this error:

No device found on /dev/ttyACM0

However, it works perfectly inside the Arduino IDE.

What can the problem be?

5

from the IDE's menu you can activate the verbose upload (and compile) mode, that will print all the command executed; Probabibly what you miss is the necessity to open the serial at 1200baud, that will trigger the reboot and consequent bootloader's start ont DUE chip, and bossac need to find the bootloader. see autoReset

edit: i've now a pc with a physical Serial, so i've tryed to upload in verbose mode:

Sketch uses 10,380 bytes (1%) of program storage space. Maximum is 524,288 bytes.
Forcing reset using 1200bps open/close on port /dev/ttyS0
/home/xxx/arduino-1.5.6-r2/hardware/tools/bossac -i -d --port=ttyS0 -U false -e -w -v -b /tmp/build8035422101690460839.tmp/sketch_apr14a.cpp.bin -R 

as you can see he is resetting the board by opening the serial at 1200, forcing the bootloader to start. You have to do the same on your script befor launching bossac. How this can be done depends on your OS

Please note that the reset is triggered by the 8u2 chip used as USB to serial adapter on the arduino board, so bypassing it by connecting through tx/rx pin (like using your own conversor, like in my example with hardware serial) won't work unless you do a manual reset at the right time

  • I can't see what it's doing because there are too many lines outputted. The first lines where it's calling BOSSA are being clipped away. – Friend of Kim Apr 14 '14 at 19:01
  • I found a way. Press the upload-button while in the middle of uploading. It will fail, and will not output too many lines anymore. I'm going to try it out now. – Friend of Kim Apr 14 '14 at 19:03
  • you can also try with a non-due (or a physical serial port with nothing attached) – Lesto Apr 14 '14 at 19:10
  • I believe the problem was either the command line arguments, or that the board needed to be reset before connecting to it. I can't connect to it through the master bossash.exe, so it seems they've changed something on the Due rendering the master BOSSA useless. I don't quite know yet, but I'll try to leave a comment later when I've figured it all out. – Friend of Kim Apr 14 '14 at 19:14
  • edited my answer, as expected the reset opening theserial port with a baudrate of 1200 is a foundamental passage. Also please note that the bootload probably as a little timeout, so you have to script the execution of reset + upload to make it in the time slot. – Lesto Apr 14 '14 at 19:19
3

Easiest way I've found to do this purely from the terminal:

stty -f /dev/cu.usbmodemfa121 1200;stty stop /dev/cu.usbmodemfa121;./bossac -i -d --port=tty.usbmodemfa121 -U false -e -w -v -b Blink.cpp.bin -R

Swap out the serial device for whatever /dev you are using; in Linux you may have to sudo to get direct access to the device. This is assuming you are in the directory where bossac lives and your .bin file is there too. Adjust to suit your needs. If using the native USB port you should change -U to true

1

The Arduino CLI uses a slightly different version of bossa from the one that is on master:

https://github.com/shumatech/BOSSA/tree/arduino

On Linux, I was able to do the following:

$ git clone git@github.com:shumatech/BOSSA.git
$ cd BOSSA
$ make bin/bossac -j4
$ stty -F /dev/ttyACM0 1200
$ ./bin/bossac --port=/dev/ttyACM0 --force_usb_port=true -e -w -v -b /path/to/my/firmware.bin -R

(I got the answer from this Arduino forum thread.)

Not the answer you're looking for? Browse other questions tagged or ask your own question.