Pages: [1]   Go Down
Author Topic: Program Loading via Serial Port?  (Read 736 times)
0 Members and 1 Guest are viewing this topic.
CT, USA
Offline Offline
Sr. Member
****
Karma: 3
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Boston area, metrowest
Offline Offline
Brattain Member
*****
Karma: 545
Posts: 27352
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

CT, USA
Offline Offline
Sr. Member
****
Karma: 3
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Centurion RSA
Offline Offline
Full Member
***
Karma: 0
Posts: 166
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Rather people think you to be a fool than you open your mouth and confirm it.

CT, USA
Offline Offline
Sr. Member
****
Karma: 3
Posts: 446
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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]


Logged

Pages: [1]   Go Up
Jump to: