Go Down

Topic: Using a MEGA as ISP for a Pro mini (Read 1 time) previous topic - next topic

tochinet

Hi,

Since I need many Analog IO ports, I bought a MEGA (the "old" version with 1280) and a Pro mini as "extension". I want to connect both using the serial pour on the Pro mini to an "additional" serial on Mega (e.g. Serial2). This also means that to upload the Pro mini sketch, I should be able to use the MEGA as ISP. But is it possible ?

I found in the example the "ArduinoISP" sketch apparently last changed 2009. The Tutorial page http://arduino.cc/en/Tutorial/ArduinoISP talks about changing the bootloader, but not the sketch ! The other page, http://arduino.cc/en/Tutorial/ArduinoISP seems to do some weird things outside of the IDE, which would not be needed in may case (I guess)  And these are using the 3-wire SPI interface, while the bootloader is supposed to use the serial interface, right ?

I've also found http://arduino.cc/en/Tutorial/MultiSerialMega that shows how to replicate from one serial to another, but that won't work either. Any idea  how to solve that problem ?

Can anyone clarify how I can do this ?


johnwasser

So you want to use the MEGA as a USB-to-Serial converter so you can upload sketches to the Pro Mini.

1) You have to get the MEGA to leave the serial pins alone.  Write and run a sketch to set D0 and D1 as INPUT pins.
2) You have to connect the Pro Mini serial pins to the MEGA serial pins.  D0 to D0 and D1 to D1.
3) You have to prevent the MEGA from rebooting when an upload starts.  Connect a 1-10 uF capacitor between the Reset pin (+) and the Ground pin (-).
4) You have to manually reset the Pro Mini when you see the "Binary sketch size:" message in the IDE.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

tochinet

Hi John,

Thanks for the reply.

What you suggest is not exactly what I'd like to do, but it's OK to start with. I'll try that.

Now what I'd like to achieve is to use the MEGA as a "master" for potentially more than one Pro Mini. So I'd like to connect (permanently) the D0 and D1 of the minis to the Serial 1-2-3 of the MEGA, and have this one able to reprogram the minis. Is this possible ? I guess yes, it should be some kind of mix between the links in my first post (ArduinoISP and MultiSerialMega) but I need more info on the upload process and can't find any. Isn't this protocol fully open source ???

I've also found some references to "STK500", including a link at http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1176619707 but it seems to predates the chips that are used (MEGA1280 or 168 are not present in the tables ...). Strange.

johnwasser

The bootloader on the Nano supports a subset of the STK500v1 protocol; enough to write data into FLASH. You can get a feel for what commands to send by holding down the shift key when you click on the upload button.  This will show every step of the upload process.  Compare each message sent an received to the STK500 documentation you found to see what messages are sent, what order they  are sent, and what responses are received.

You wil need a way to reset each Nano to activate the bootloader.  Connecting a digital output pin to the Reset line of the Nano and briefly setting that output pin to LOW should do it.
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Go Up