Go Down

Topic: Program a Arduino with Another Arduino without a USB Cable (Read 2961 times) previous topic - next topic

drbogger

Okay, I have a project that is stationary in a totally different room than my computer is at.

I cannot just take the unit down to program it.

Is there a way I can program it with another Arduino chip?

Say "Connect Arduino 1 to Computer, program chip" >> "Bring Arduino 1 to Arduino 2, program Arduino 2"

Is it possible to do something like that?

johnwasser

It's certainly possible but I don't think anyone has implemented it yet.  You would probably need an SD card or external EEPROM to store the program.  You could start with the ArduinoISP sketch and divide it into two parts:  the part that accepts programing from the PC and the part that sends programming to the target processor.  In between you would buffer the data in a file on the SD card or on an EEPROM.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

retrolefty


Okay, I have a project that is stationary in a totally different room than my computer is at.

I cannot just take the unit down to program it.

Is there a way I can program it with another Arduino chip?

Say "Connect Arduino 1 to Computer, program chip" >> "Bring Arduino 1 to Arduino 2, program Arduino 2"

Is it possible to do something like that?


Wouldn't be easier (and much cheaper) to just download the program to the arduino #1 at the PC, then remove the 328p chip and bring it to your arduino #2 and replace the existing 328p chip in arduino #2?

For around $6 you can obtain a spare 328p processor chip with bootloader so you have a spare to play around with.

Lefty

CrossRoads

How about wiring a connecter that you can access? Then walk your laptop over with a AVR ISP programmer (connects to ICSP header) and reprogram that way.

Or if is has an accessible serial port, program it thru its serial port from your laptop and normal bootloader program.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

westfw

The "optiLoader" and "optiFix" sketches I've posted do this.  They rely on the hex file for the target sketch being small enough to fit inside the "programming" sketch, but could be changed to read the hex from from some sort of external media instead.

drbogger

Do you have a link I can see this at?

Also, I already have 2 Arduino chips, the biggest problem is Arduino #2 is inside a enclosure that is almost impossible to take the chip out of without causing damage to the wiring.

And I don't have a laptop... I only have a Android Phone, and unless that can upload sketches to a chip, then idk... lol

extent


The "optiLoader" and "optiFix" sketches I've posted do this.  They rely on the hex file for the target sketch being small enough to fit inside the "programming" sketch, but could be changed to read the hex from from some sort of external media instead.


That's basically what I'm planning to do for field updates, bootstrap with a 2nd 328 and read off an SD card for updated firmware, when the update completes hand off control of the SD card to the main chip.  Or perhaps have the bootstrapping chip switch over to slave SPI mode and act as a 4k write buffer inbetween the SD card and the main chip, then at least it's not total dead weight after booting.

westfw

Quote
Do you have a link I can see this at?

Search is your friend...  Oh, never mind:
https://docs.google.com/leaf?id=0B6dMB5dovDUZMDdmNmY3ZmMtY2I5NS00YzZlLTkxZjAtZmJiZTk3OWM4OWIz&hl=en_US
http://www.youtube.com/watch?v=YBFUGre0hY4

drbogger

Yes, but doesn't that just install the boot-loader? I want to upload a sketch, not a boot-loader...

CrossRoads

@westfw,
Does the target chip need to be on a board/breadboard with a crystal? Or can it be 'bare' on a breadboard with just the pins connected:
power, gnd, Master's D10 to Slave's Reset, D11-D11 (MOSI), D12-D12 (MISO), D13-D13 (SCK)?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

xtto

@westfw,

I have the exact question as CrossRoads. Woult it work on a breadboard without a crystal? with the bare configuration. And one more question. Could I use my ethernet shield´s ICSP to bootload blank atmels on my Arduino Uno rev2 board?

Thanks

westfw

It needs a crystal, since the first thing it does is set the fuses in an Arduino-compatible manner (16MHz external crystal.)  (You could change this, of course.  But one of the "features" is that Optiloader auto-detects the target chip type, and there isn't any way that I know of to tell the difference between a "bare chip" and a "chip with a crystal.")

Adafruit has taken the code and expanded it some (programs things larger than 512 bytes, for instance.)  See: http://ladyada.net/library/tools/standaloneisp.html

As for Arduino-Ethernet, it should work OK, but I haven't tested it, and since the ethernet circuitry is on the same SPI pins used for programming, it could have side-effects.
(Do NOT try to use the rather ill-advised "power the target from IO pin 9" feature if the target is an Arduino-ethernet.  It's one of those things that was just barely in-spec for nearly-bare chips, and the ethernet takes significantly more current!)

Go Up