Using an Arduino as USB-TTL serial link, with automatic reset of the target
When uploading code to a home brew Arduino clone, one of the magic tricks are to the the target chip to reset at the right moment. Usually the challenge is to detect when the serial or USB interface between computer and target goes up, and then reset the target at that exact moment.
The Arduino folks described a method to do that where they simply use an Arduino board, remove the AVR there and then wire up the external target avr to the board, using the Arduino USB interface alone. Removing a 28pin chip without the proper tool involves the rick of breaking a log or two on the precious original Arduino AVR chip. Their guide is here: http://arduino.cc/en/Tutorial/ArduinoToBreadboard
I have "invented" method to do the same, but without the need for removing anything from the Arduino board. Instead of disabling the Arduino by removing the chip, I have written a small sketch that makes the Arduino silent on the serial interface while still listening for trigger-reset condition. While the sketch runs in "ready for new upload" mode it will blink pin-13 led slowly, to indicate that it's alive and ready to party! At the moment the method has only been tested on my Arduino Duemilanove, but I expect it to work elsewhere too.
After loading the sketch to the Arduino we block it's own automatic reset circuit. This han either be done by putting a 22uF, or similar, cap between reset pin and a gnd pin (remember to polarize it correct). Alternatively, if no suitable cap can be found, a simple wire between reset and vcc can be used. This method have one major disadvantage! If you press the reset button on the Arduino you will short your USB bus!!! You have been warned.
Now you are ready to wire up the connections between Arduino and target AVR.
- Arduino gnd goes to AVR pin.8 and pin-22
- Arduino vcc goes to AVR pin-7 and pin-20
- Arduino pin-0 goes to AVR pin-2
- Arduino pin-1 goes to AVR pin-3
- Arduino pin-2 goes to AVR-pin-1
Notice that all but the last wire (reset) are the same as in the original Arduino guide linked above.
Now go and upload "blink" to the target, while doing so, the Arduino led will blink fast.