Pages: [1]   Go Down
Author Topic: Program a Arduino with Another Arduino without a USB Cable  (Read 2668 times)
0 Members and 1 Guest are viewing this topic.
Ballston Spa, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8821
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17292
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 533
Posts: 26935
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6739
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Ballston Spa, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Full Member
***
Karma: 0
Posts: 167
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6739
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Ballston Spa, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 533
Posts: 26935
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

@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)?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

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

@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
Logged

SF Bay Area (USA)
Offline Offline
Tesla Member
***
Karma: 132
Posts: 6739
Strongly opinionated, but not official!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!)
Logged

Pages: [1]   Go Up
Jump to: