Stand-alone Programming A Due....

I would like to be able to give other people a binary of my program and have a batch file to program the device for them. I've captured the command line the IDE uses to program the device, but it doesn't work. Here's the line I'm using, edited from what the IDE uses only to point to a different location for the binary file. and to add quites around the executable path:

"C:\Program Files (x86)\Arduino 1.5.8\hardware\tools\bossac.exe" -i -d --port=COM5 -U false -e -w -v -b "C:\Temp\WebServerTest.bin" -R

When I run it as a batch file, I get this:

C:\Users\RayL\Documents\Arduino\libraries\WebServer\Test\WebServerTest>"C:\Program Files (x86)\Arduino 1.5.8\hardware\tools\bossac.exe" -i -d --port=COM5 -U fal se -e -w -v -b "C:\Temp\WebServerTest.bin" -R Send auto-baud Set binary mode No device found on COM5


The device IS on COM5, and I can connect to it using either the IDE or a terminal program. So there must be some setup that is required before running bossac that I am missing. Any one know what that might be?

Regards, Ray L.

Assuming COM5 is the programming port, you need to connect at 1200 baud to erase the SAM and put it into programming mode. You can do this quite easily in a batch file :

mode COM5:1200

Unfortunately you then need to wait a second before continuing, and there is no timed pause in Windows (up to 7 anyway). The "pause" command will prompt the user so is almost good enough.

Here is a batch file I have used for similar purpose, hack around as you need :

@echo off
rem Download firmware to Due
rem NB this requires bossac utility (available in Arduino IDE)
rem change port as required 

set zzport=%1
if /%zzport%/ == // set zzport=COM18

set bossa_path=C:\Programs\arduino-1.5.2\hardware\tools\

mode %zzport%:1200
rem sleep 1
%bossa_path%bossac.exe --port=%zzport% -U false -e -w -v -b firmware.bin -R

set zzport=


Excellent! That works perfectly! Thanks much!

BTW - Here's an easy way to insert a delay in the batch file:

ping -n 1 -w 1000

The -n option tells it to only ping once, and -w option tells it how long, in mSec, to wait for the response. Works like a charm.

Regards, Ray L.