Go Down

Topic: Program Loading via Serial Port? (Read 790 times) previous topic - next topic

AlphaZeta

I know that ATmega328 can interface with a physical serial port using a chip like MAX232. I have built such a circuit and have verified that I could send data and receive data via the serial port.

But my question is, does the current version of Arduino bootloader support program loading (e.g. through Arduino IDE) via the physical serial port (e.g. COM1)? The reason I am asking is that when I tried it didn't work and I didn't observe any activity on either the TX or RX line using an oscilloscope. But as I stated earlier, if I use Serial.read() and Serial.write() I could interact via a terminal directly. So I know that the circuit is working properly.

CrossRoads

Electrically, it should work as you've seen. You may have to press reset at the right point in time  when the IDE/ bootloader start their dance (just after the IDE says "xxx bytes used of 31xxx or similar").

COM port assignment wise, well that's between you and your OS.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

AlphaZeta

So, I take it that the bootloader should work with the hardware serial port? Any one has done this before?

The only thing I see that could be a problem is there is no DTR signal in most of the RS232 chips. Whereas in Arduino the DTR is connected to ATMega328's pin 1 (reset) via a capacitor.

Marius

The reset is a pain but you should try and use the DTR as on the Arduino boards. What you are doing is exactly what is done on the Arduino - less the reset off coarse. The reset is important in the sequence of events when programming like this. I am not to sure of the sequence but I am sure if you do a bit of research you will find the info. Just wire the DTR and get done with it.
Rather people think you to be a fool than you open your mouth and confirm it.

AlphaZeta

Mystery resolved. It turned out that since I only hooked up the RX/TX and ground pins to the serial port, I wasn't able to automatically generate the apparently required DTR signal. By pressing the SHIFT key while uploading I was able to see that avrdude was waiting on line:

avrdude: ser_open(): setting dtr


And after seeing this output, I pressed the reset button and bingo everything worked as desired!


        Using Port            : \\.\COM1
        Using Programmer      : stk500v1
        Overriding Baud Rate  : 57600
avrdude: ser_open(): setting dtr
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]
avrdude: Send: 0 [30]   [20]



Go Up