Pages: [1]   Go Down
Author Topic: Upload to multiple Arduino  (Read 479 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a way to upload a sketch to more than one arduino on a breadboard at the same time like the method here http://arduino.cc/en/Tutorial/ArduinoToBreadboard
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 618
Posts: 33959
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

No.
This is because the arduino is writing to its flash memory. The write time for this is not the same on all arduinos, nor the same thorough the arduino's life time. As the arduino has to signal back to the PC to get the next bytes to load you would have to multiplex all the arduino's serial responses to see when they were all ready.
Not impossible but definitely not worth doing. 
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what if you plug a bunch of USB to the computer with different COM.  Is there a way to upload one sketch do different COM connections at a time
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 618
Posts: 33959
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Only if you write it yourself.
Logged

Offline Offline
Edison Member
*
Karma: 19
Posts: 1041
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

what if you plug a bunch of USB to the computer with different COM.  Is there a way to upload one sketch do different COM connections at a time

in bash (or sh) you'd just do this (tested and uploads correctly to an uno and a duemilanove at the same time):
Code:
#!/bin/sh

FILE_TO_UPLOAD="$1"

ARDUINO_DIR="/home/adam/arduino-unstable"

for CUR_PORT in $(find /dev/ttyACM*)
do
    echo "$CUR_PORT"
    "$ARDUINO_DIR"/hardware/tools/avrdude -C"$ARDUINO_DIR"/hardware/tools/avrdude.conf -q -q -q -q -patmega328p -carduino -P/"$CUR_PORT" -b115200 -D -Uflash:w:"$FILE_TO_UPLOAD":i &
done

for CUR_PORT in $(find /dev/ttyUSB*)
do
    echo "$CUR_PORT"
    "$ARDUINO_DIR"/hardware/tools/avrdude -C"$ARDUINO_DIR"/hardware/tools/avrdude.conf -q -q -q -q -patmega328p -carduino -P"$CUR_PORT" -b57600 -D -Uflash:w:"$FILE_TO_UPLOAD":i &
done
just call the program with the argument being the name of the .hex file to upload.

And sparkfun did a series on it: http://www.sparkfun.com/tutorials/233

EDIT: I just tested the script with a bigger file to upload, and it doesn't work as well (ie fails). It seems like avrdude isn't reentrant. But there's not that big of an advantage to getting it parallelized, so if you just remove the & it works great.
« Last Edit: September 02, 2012, 02:09:21 am by WizenedEE » Logged

Pages: [1]   Go Up
Jump to: