Pages: [1]   Go Down
Author Topic: Using arduino to push code to second arduino  (Read 728 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hey all

would it be possible to have an arduino push code / functionality to a standalone ATMEGA328 using the RX/TX based on digitalRead of a button on the main arduino

in example
you push button 1, push codebase 1 to standalone
push button 2, push codebase 2 to standalone

my question is not necessarily understanding the processing / arduino ide, but more around hardware limitations

i have successfully built standalone arduino applications and have had experience using the isp programmer from a pc, so those are not limitations. i am looking for ideas around implementing a standalone arduino that accepts inputs to reprogram another standalone on the fly

thoughts?
Logged

0
Offline Offline
God Member
*****
Karma: 39
Posts: 988
Get Bitlash: http://bitlash.net
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you put Bitlash on the second Arduino, you could push serial Bitlash commands and new Bitlash programs to it from the first one.  

Works great here.  More at http://bitlash.net

Cheers,

-br
http://bitlash.net
http://entropymouse.com

Logged

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

You could do this but it is not straight forward. You need to engage the bootloader to take what is coming in on the serial port and treat it as a sketch. However this is a bit high risk because if anything goes wrong, like the signal is interrupted you end up with a brick. So what you need to do is to make a secure bootloader that operates with enough room for two versions of the sketch, one to operate and the other to download to. Only when the new sketch is downloaded and verified as correct by checksum can the arduino then switch to it. It is a technique that is used in over air software upgrading digital TV of set top boxes. It takes twice as much memory and the right combination of protective flash sectors. While I don't doubt it can be done with an arduino is is a lot of bother and you have to ask yourself if it is really worth it.
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

hmm. i think i understand what you are explaining.

in addition, would it be possible to prior to firing off the code to the second atmega is to fire off it's reset button and then upload?
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

This should help:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1260909294/all
and:
http://www.roguerobotics.com/wikidocs/code/bootloader_using_ummc

Mowcius
Logged

0
Offline Offline
Jr. Member
**
Karma: 1
Posts: 96
Why is it so?
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

thanks mowcius
checking the bootloader_using_ummc files the example provides only digital read on pin 4 and checks for a sketch named sketch.hex

shouldn't be too hard to put diginatl inputs on other pins then send other files

thanks for the link
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nope, should be pretty easy but that is on one arduino with a modified bootloader. You could no doubt find out the serial commands involved with sending a sketch to another arduino and then read from one and send to another (which is what I want to do but have never got round to it... smiley-sad

Mowcius
Logged

Pages: [1]   Go Up
Jump to: