Has anyone figured out a way of programming multiple arduino's at once. I'm designing a new product and using the arduino to control it. However, I need to be able to reprogram them (at least 30 at a time) at once. Any advise is greatly appreciated.
When uploading a sketch or using a programmer (for sketch or bootloader), the software does not just write the code, it actually communicates with the microcontroller.
You can't program them all at once. But you can program them one by one in some automatic way.
There are a number of possibilities, but that depends on what you want to do.
- If you want to update the sketch, you have to connect every Arduino board. Wether you connect all of them or one by one, that is the same amount of labor.
- If you only want to change settings, you could use the EEPROM.
- If the project involves all the Arduinos, you could connect them all together in a chain, and let them program each other. This is possible in theory, but perhaps no one has done this yet.
- It should be possible to connect all of them to a pc, and write a script that uses avrdude and a hex file to upload the new sketches to all of them.
omniaxis: Has anyone figured out a way of programming multiple arduino's at once. I'm designing a new product and using the arduino to control it. However, I need to be able to reprogram them (at least 30 at a time) at once. Any advise is greatly appreciated.
Program upload is a two way conversation, you can't have more then one chip talking at any given time on a single cable.
You need a PC with 30 serial ports and some clever uploading software
If you build your own standalone programmer you could setup all of their ICSP pins in a parallel bus except the reset lines. Each reset line will need to remain separate, then using some kind of multiplexer selector, you would select one reset at a time to program that unit. You could use an Arduino running a modified version of Nick Gammon's hex uploader (http://www.gammon.com.au/forum/?id=11638) that could run through and automatically select each unit one at a time (using the selector) to program very quickly.
I created a sketch and loaded it into one of these
Not simultaneus, but takes < 30 seconds to set fuses and download bootloaderless sketch.
Plug it onto ICSP header on a board, press the red button, wait for green light to stop flashing.
Is being used to program control boards in these clocks:
I like hiduino’s idea. Could adapt Nick Gammon’s programmer, use it on a mega with 30 unique reset lines, one per board.
Make a breakout board with the ICSP and 30 reset lines in, 30 ICSP output headers for connecting to the boards.
Wouldn’t take long to wirewrap up.
Connect them all up, press the button, watch them go.
actually 2 way communication is not necessary to program avr. for the past couple years ive been flashing as many as 16 at a time. it does require a custom pc program. one of the great drawbacks of avrdude is the inability to do mosi only flashing.
For one-way programming how can you verify if programming was successful?
Have you ever seen it not? I've seen first byte mismatch errors, but that's usually a verification problem, and the part has been programmed correctly. The other error is signature mismatch, plug in the right part and that is taken care of. The usual problem is data speed mismatch between bootloader and IDE, if you've loaded the right bootloader and selected the proper board type, that is taken care of as well.
ive never found verfication of any practical use whatsoever. does little more than triple flashing time. in fact its turned off in all my avrdude command lines. in my experience if you can read a fuse or signature for a given setup then unlikely to be any issues with writing flash or eeprom. it may be useful to check new programming hardware or software but even then ive found things either work or dont. for those who require peace of mind and time/productivity not so important then maybe does serve a purpose. as usual everyones mileage may vary.
First and foremost thank you everyone for your input and responses. My question is for john1993, for your setup to work would you run all the ardunio RX pins in parallel? Then just run the sketch which would then transmit to all my arduino's? If that is the case and in that configuration do the arduino's not need to TX (transmit) back to the sketch loader that the upload was successful?
I don't really need them to respond that they successfully uploaded only have the upload work to all of them simultaneously. Again any and all input is great appreciated.
They can output on their Tx pins, you just ignore it.
actually i was referring to isp which is easy because no responses at all are required from the chip and they are all simply wired in parallel. its doable with serial bootload also but data from the chip is needed so not as easy and again requires custom software. but imo if you need to do many chips at once using a bootloader dont make too much sense.
Having a bootloader end up on the chip with a simple sketch might be the intended result.
If just the final sketch is desired, that’s a different result and loading via Reset & SPI pins makes sense.
yes, thats true. i was thinking of final application like mentioned in op. but like you say the guys who sell large quantities of arduino chips probably dont do one at a time. or maybe they have digikey or other atmel vendor put the bootloader in. not too expensive in quantty.
Heck, you buy enough from me, I'll make a programming adapter and will do them for you. Got a teeanager that can dump parts out of a tube, into a programmer, and back in the tube ...
A shift register and a bunch of buffered ZIF sockets would make an easy batch programmer. I would opt for a scheme that uses the shifter to basically trigger an Enable pin for each socket. Whether that controls Reset, Vcc, or transistors on the data lines is up to you.
If you had a commercial op and would be doing this a lot, I would even go so far as using a fleet of ATtiny's to write each socket in parallel. The real hassle would be loading and unloading the chips. Hacking together an automated robot arm could be a good complement for, or alternative to, parallel flashing.
I would never consider bypassing the verify stage. The meager time you save on rushing the process will rob you of your lunch money the first time there's a bad flash cell, a noisy PSU, or bad RFI. If you're serious enough to need to bulk program chips, you should be serious enough to do some QA. Just MHO of course. :-)
In my somewhat extensive experience, the search for “simultaneous” programming is somewhat useless. With the programming speed of modern devices, you will spend more time connecting or inserting a device in your programmer, than it will actually take to program the memory. Once you get two or three programmers programming sequentially, YOU become the limiting factor in programming speed. Even more so if you’re doing things like pin-straightening, chip labeling, or putting the programmed chips into pretty packaging.
(Up to the point where you have expensive automated machinery to move chips from tubes/reels to your programming adapter. At which point you should be thinking about using digikey (or equiv) to do your programming for you.)
john1993 excuse my ignorance I'm new to the Arduino world. When you say ISP program can you give my a little more info on how to do that or perhaps send me to a link that does? Even a brief explanation will be incredibly helpful as to how to set it up. Thank being said thank you for all your input thus far.
generally there are 2 ways we program an avr. isp makes use of hardware built into the chip (miso/mosi/sck) and is normally the way to flash a raw chip from the factory. arduino chips have a bootloader program put into them which allows loading code via a serial port using the avr self program (spm) instructions. but a bootloader must be intalled using isp for this to work. so ALL chips can be isp flashed but only those with bootloader previously programmed can use a serial port. the datasheets and atmel app notes go into much more detail. google is your friend.
SOLVED... Frist thank you all for you input I found it to be extremely invaluable. It was a simple fix but I found out how to upload a sketch to many Arduino's at the same time. This was key!!! - You connect all the GRN in parallel (from the FTDI - the DTR connection and the Arduino's GRN) , the TX from the master serial (in this case my FTDI) connects to all the RX on the slave Arduino's in parallel and the GRD on all connected together as well in parallel. The only down side is that you can't receive a verify from the uploaded. But it's not needed in this case. Again thank you for the help.