Arduino Serial Using LT1780

Most of the recent Arduino and compatible boards use some kind of USB to UART hardware (e.g. FT232RL in Arduino Duemilanove and Atmega8U2 in the latest Arduino Uno) for interfacing with computer USB ports. Since ATmega328 has native UART support, building an Arduino that interfaces with the serial port (RS232) directly is arguably much easier. And of course, there are still a lot of computers (especially servers) that support serial ports, so building an serial port only Arduino still makes sense in cases where USB connection is not necessary.

Of course, you could always just build a serial port compatible Arduino using the reference design. In the official design, two transistors are used for converting the RS232 signal levels to UART compatible TTL signal levels and vice versa. But with so many RS232 transceiver ICs on the market nowadays, this voltage translation can be done very easily.

The following schematic shows one such designs using Linear Technology‘s LT1780 RS232 receiver.

Arduino Serial Using LT1780

Arduino Serial Using LT1780

LT1780 has two RS232 receivers built-in. Since we are only using one channel, TR2 In should be tied to Vcc according to the datasheet. Other RS232/serial converter chips such as MAX232 can also be used.

One thing to note is that the program uploading procedure is slightly different when using the design above. You must press the reset button right after the upload command is initiated in order to upload your programs (sketches). This is due to the fact that the DTR signal is connected to the reset pin (pin 1) on both Arduino Uno and Arduino Duemilanove, and the DTR signal automatically resets the ATMega328 prior to uploading. This is not the case for our design however, since most RS232 to serial chips only convert the TX and RX signals and thus this reset has to be triggered manually.

The reset process is a little bit of tricky since the timing of the reset signal is important. You will not be able to upload successfully with the Arduino bootloader if the reset happens too early or too late. One way to ensure the correct timing is to use the “debug” mode within the Arduino IDE while uploading by pressing the SHIFT key. This puts avrdude’s output in verbose mode. You should see messages similar to the following when upload begins:

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

System wide configuration file is “arduino-0018\hardware/tools/avr/etc/avrdude.conf”

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]

You should press the reset button as soon as you see this line — ser_open(): setting dtr — in your status window:

avrdude: ser_open(): setting dtr <== Press the Reset button

Depending on the speed of your computer, it could mean anywhere between a split second to a few seconds after the upload process is initiated. Of course, you can always use an ICSP header for in-system programming the device. But being able to directly upload from the IDE makes programming and testing much more enjoyable.

Be Sociable, Share!

6 Comments

  1. Having not actually bothered to try it yet myself, I may be entirely wrong here, but couldn’t you just route the DTR signal through the second channel?

  2. sui says:

    It is possible to upload sketches directly from the IDE using an ISP (yes, just by clicking the ordinary upload button) and it’s really comfortable when you use an alternative serial monitor program which you don’t need to close/reopen after each upload any more.

    All you need to do is adding “[board].upload.using=[programmer]” into the /arduino-022/hardware/boards.txt configuration file.

    I’m using this config to upload sketches directly to a Atmega8 on a Duemilanove Board for example. diamexisp refers to my programmer defined in programmers.txt:

    atmega8isp.name=ATmega8 & ISP
    atmega8isp.upload.protocol=stk500v2
    atmega8isp.upload.maximum_size=30720
    atmega8isp.upload.speed=57600
    atmega8isp.upload.using=diamexisp
    atmega8isp.build.mcu=atmega8
    atmega8isp.build.f_cpu=16000000L
    atmega8isp.build.core=arduino

  3. Eric says:

    avrdude: ser_open(): setting dtr <== Press the Reset button

    That saved my day, thank you !!!!

Leave a Reply