5
\$\begingroup\$

I am willing to build an AVR JTAG debugger (I grabbed from here: http://aquaticus.info/jtag) but the circuit uses COM port and it has MAX232 transceiver. My Laptop does not have COM port, so I need a USB-to-Serial cable. My question is, do I have to add the MAX232 circuit if I'm going to use USB-to-Serial cable?

I have done some search and found that some cables are implemented with RS232 transceiver, on the box of my cable they say it supports the RS232 interface... is it the same? (http://www.unitek-products.com/en/product_detail.php?id=12)

If I didn't have to add the MAX232, is it necessary to invert the signals going to MCU? If it is, why?

I am sorry for the long questions, but it is my first time to deal with the RS232. Thank you very much in advance.

\$\endgroup\$
4
\$\begingroup\$

The asynchronous serial protocol can use different voltage levels and polarities.

RS232 refers to a specific set of voltage levels, inverted polarity, and (nowadays) a DB9 connector.

A USB-to-serial chip (like the FT232) outputs asynchronous serial at 3V or 5V level, not inverted. A MAX232 or similar chip is used to convert this to RS232 level.

The serial pins of a microcontroller use asynchronous serial at the 3V or 5V level. A max232 chip can be added to bring the signals to RS232 level.

Most USB-to-serial cables (including the on you refer to) include both the usb-to-serial chip AND the max232, with no possibility to access the in-between level.

So, for a successful asynchronous serial PC-to-microcontroller connection there are two possibilities(FT232 can be swapped for an equivalent chip from another vendor):

  • PC-FT232-microcontroller: this is the easy way, often used for a PCB with the microcontroller and the FT232 chip.

  • PC-usb_to_serial_cable-max232-microcontroller: this might seem a bit convoluted, because the signals are first converted from 3V or 5V to RS232 (inside the usb_to_serial cable), and then converted back by the max232 to the level that the microntroller can handle. But usb_to_serial cables are so common and check that this is often the aeasy option.

(A third option is to use a microcontroller that is itself USB-capable.)

Your debug board has a max232 and a DB9 connector, so you should use an off-the-shelve usb_to_serial converter cable, like the one you link to.

\$\endgroup\$
  • \$\begingroup\$ Thank you very much... but I guess there is one thing I didn't understand. First you said that most USB-to-serial cables (including the one I have) include both the MAX232 chip and the USB-to-Serial chip... which means I don't have to add another MAX232 in the circuit. But then, you said for a successful asynchronous serial PC-to-microcontroller connection I should add MAX232 to the circuit! Can you explain a little bit please? \$\endgroup\$ – Siraj Muhammad Aug 28 '13 at 17:29
  • \$\begingroup\$ Read again. A max232 converts between 3V/5V level and RS232 level. The FT232 outputs 3V/5V level, your microcontroller needs 3V/5V level. Hence you must have an even number of Max232 chips inbetween. \$\endgroup\$ – Wouter van Ooijen Aug 28 '13 at 17:49
  • 1
    \$\begingroup\$ Oh, and I forgot to repeat in the comment above: a max232 inverts, which is another reason you need an even number of these (or similar) chips. \$\endgroup\$ – Wouter van Ooijen Aug 28 '13 at 19:47
  • \$\begingroup\$ Just to make sure that I got the idea... the USB-to-Serial cable outputs RS232 signal (which is done by the internal MAX232) and needs external MAX232 in the circuit to convert it to TTL, right? Another question please, what do you mean by "inverts"? is it the polarity? So can I just use NOT gate to reverse it? \$\endgroup\$ – Siraj Muhammad Aug 28 '13 at 20:05
  • \$\begingroup\$ Another question if you don't mind, does not the MAX232 convert from TTL level to RS232 level and "vice versa"? \$\endgroup\$ – Siraj Muhammad Aug 28 '13 at 20:18
7
\$\begingroup\$

FTDI is the best-known manufacturer for USB-to-UART bridges. "UART" means that the signals are at microcontroller level, i.e. 3.3V or 5V. You can connect such a bridge directly to a microcontroller.
enter image description here
If you want to connect to another computer via a DB9 connector you'll have to add the MAX232, since that connector expects RS232 voltage levels (+12V and -12V).

When we talk about USB-to-RS232 converters, those are USB-to-UART bridges with a MAX232 level converter built-in. They will terminate in a DB9 connector, which is almost always a sign that it uses RS232 levels.

\$\endgroup\$
  • \$\begingroup\$ Ok that's good, but what if I'm using USB-to-Serial cable and it already has RS232 transceiver? Still I need to use the MAX232 in the circuit? \$\endgroup\$ – Siraj Muhammad Aug 28 '13 at 17:10
  • \$\begingroup\$ @SirajMuhammad: Yes. I guess it has a DB9 connector. That is the indicator that it uses RS232 levels. (that not the law, but will be so in 99.9% of cases) \$\endgroup\$ – radagast Aug 28 '13 at 17:19
  • \$\begingroup\$ If you buy a consumer-intended cable with the RS232 transceiver, yes, you'll need your own transceiver circuit to match. But if you buy a cable with a bare USB-serial chip and no transceiver such as is sold by electronics suppliers for working with embedded boards (and formerly, for configuring certain now obsolete mobile phones), you won't need a transceiver if the voltage ranges are compatible. \$\endgroup\$ – Chris Stratton Aug 28 '13 at 17:20
0
\$\begingroup\$

There are USB to UART chips from FTDI, TI, Maxim and others. check one which has the same supply and IO voltage as the debugger's chip.

\$\endgroup\$
0
\$\begingroup\$

My experience is that MOST motherboards, at least in the last 10 years or so, do just fine with TTL levels, but you need to invert the UART. Your mileage may vary.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.