Go Down

Topic: Using arduino to push code to second arduino (Read 765 times) previous topic - next topic

32teeth

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?

billroy

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


Grumpy_Mike

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.

32teeth

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?


32teeth

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

mowcius

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... :(

Mowcius

Go Up