What Is the MAX232? Wiring Diagram and Capacitor Selection

Ürün İncelemeleri Intermediate 9 min read Published:
MAX232 nedir: 16 bacaklı entegre çizimi ve kare dalga sembolü

The MAX232 is a 16-pin driver/receiver IC that converts the UART signals of a 5 V microcontroller to RS-232 levels, and RS-232 signals to 5 V logic levels. Its internal charge pump, with four external 1 µF capacitors, generates the positive and negative voltages the RS-232 line requires from a single 5 V supply. It contains two drivers and two receivers and, according to its datasheet, operates at data rates up to 120 kbit/s.

This article explains how the IC works, what connects to which pin, the value and orientation of the capacitors, the DB9 connector wiring and the mistakes most often made in the field, using datasheet values. Products covered: MAX232N (Texas Instruments, DIP), MAX232CWE (Analog Devices/Maxim, wide SO) and MAX232EPE (Analog Devices/Maxim, DIP, extended temperature range).

What does the MAX232 do?

A microcontroller’s UART output operates between 0 V and 5 V. The RS-232 standard, however, carries the same bit with a very different voltage: a logic 1 on the line is a voltage between −3 V and −15 V, and a logic 0 is between +3 V and +15 V. The range between −3 V and +3 V is undefined. So there is a difference in both voltage amplitude and polarity between the two sides, and connecting the UART pin directly to the serial port does not work; moreover, the negative voltage coming from the line can damage the microcontroller input.

The MAX232 connects these two worlds. The driver (T) channels take the logic signal and raise it to RS-232 level, and the receiver (R) channels bring the signal from the line down to 5 V logic level. The signal is inverted in both directions: according to the function table in the Texas Instruments datasheet, TOUT is high when TIN is low, and ROUT is low when RIN is high.

Chart comparing the voltage levels of 5 V logic and the RS-232 line: on RS-232, logic 1 is between minus 3 and minus 15 V, logic 0 between plus 3 and plus 15 V
Voltage levels of 5 V logic and the RS-232 line. The orange lines show the minimum output swing the MAX232 driver guarantees into a 3 kΩ load.

How does the charge pump work?

A charge pump is a circuit that doubles or inverts a voltage by switching capacitors. There are two pumps inside the MAX232. As the Maxim datasheet describes it, the first uses capacitor C1 to double 5 V and stores it on C3 at the V+ pin. The second uses capacitor C2 to invert this voltage and stores it on C4 at the V− pin. With no load these values are ±10 V. The Texas Instruments typical circuit shows approximately +8.5 V and −8.5 V for the same pins.

V+ and V− are unregulated and drop as the load increases. The Maxim datasheet states that only a small current can be drawn from these pins for external circuitry, and that they must not be loaded enough to cause the driver output to fall below ±5 V. These pins should not be treated as a power supply for another circuit.

MAX232 features and key parameters

Parameter MAX232 (Texas Instruments) MAX232 (Analog Devices/Maxim)
Supply voltage 4.5 V – 5.5 V 5 V ± 10%
Absolute maximum VCC 6 V 6 V
Number of drivers / receivers 2 / 2 2 / 2
Charge pump capacitors 4 × 1 µF 4 × 1 µF
Data rate 120 kbit/s 120 kbit/s
Driver output (3 kΩ load) min. ±5 V, typ. ±7 V min. ±5 V, typ. ±7.3 V
Receiver input range ±30 V ±30 V
Receiver input resistance 3 kΩ – 7 kΩ, typ. 5 kΩ 3 kΩ – 7 kΩ, typ. 5 kΩ
Receiver hysteresis typ. 0.5 V typ. 0.5 V
Supply current (no load) typ. 8 mA, max. 10 mA typ. 5 mA, max. 10 mA
Driver slew rate max. 30 V/µs max. 30 V/µs

The MAX232 from both manufacturers has the same pinout, and their basic values overlap. The choice is usually determined by package and temperature range:

Product Manufacturer Package Operating temperature
MAX232N Texas Instruments 16-pin DIP 0 °C – 70 °C
MAX232CWE Analog Devices/Maxim 16-pin wide SO 0 °C – 70 °C
MAX232EPE Analog Devices/Maxim 16-pin DIP −40 °C – 85 °C
MAX232NTexas Instruments · EE01284$2.762 In StockView

MAX232 pinout

The first six pins belong to the charge pump, pins 7–14 to the two drivers and two receivers, and the last two pins to the supply. The Texas Instruments datasheet states that pins 9–12 go to UART or general logic lines, while the pins on the RS-232 side go to the connector or cable.

MAX232 pinout: 1 C1+, 2 VS+, 3 C1−, 4 C2+, 5 C2−, 6 VS−, 7 T2OUT, 8 R2IN, 9 R2OUT, 10 T2IN, 11 T1IN, 12 R1OUT, 13 R1IN, 14 T1OUT, 15 GND, 16 VCC
MAX232 pinout, top view. Pin numbers are the same in DIP and SO packages.
Pin Name Function
1, 3 C1+, C1− Positive and negative terminals of capacitor C1
4, 5 C2+, C2− Positive and negative terminals of capacitor C2
2 VS+ (V+) Positive pump output, C3 storage capacitor
6 VS− (V−) Negative pump output, C4 storage capacitor
11, 10 T1IN, T2IN Logic input (from UART TX)
14, 7 T1OUT, T2OUT RS-232 output (to the line)
13, 8 R1IN, R2IN RS-232 input (from the line)
12, 9 R1OUT, R2OUT Logic output (to UART RX)
15 GND Ground (GND)
16 VCC +5 V supply

MAX232 wiring diagram

The most common use is a single channel: the microcontroller’s TX pin connects to T1IN (11) and its RX pin to R1OUT (12). T1OUT (14) and R1IN (13) go to the connector. On a computer’s 9-pin serial port, pin 2 is RXD, pin 3 is TXD and pin 5 is signal ground. If a female DB9 is placed on the board and connected to the computer with a straight-through cable, T1OUT goes to pin 2, R1IN to pin 3 and ground to pin 5.

MAX232 wiring diagram: C1 between pins 1 and 3, C2 between pins 4 and 5, C3 from pin 2 to ground, C4 from pin 6 to ground, T1IN 11 microcontroller TX, R1OUT 12 microcontroller RX, T1OUT 14 DB9 pin 2, R1IN 13 DB9 pin 3
Single-channel connection between a 5 V UART and DB9 with the MAX232. All capacitors are 1 µF.

Capacitor value and orientation

Both datasheets give a value of 1 µF for the MAX232. Texas Instruments writes that non-polarized ceramic capacitors can be used, and that if polarized tantalum or electrolytic capacitors are chosen, the orientations in the schematic must be followed. The orientations are as follows:

  • C1: positive terminal to pin 1, negative terminal to pin 3.
  • C2: positive terminal to pin 4, negative terminal to pin 5.
  • C3: positive terminal to pin 2 (VS+). In the Texas Instruments schematic the other terminal goes to ground, and the same datasheet notes that it can also be connected to VCC. In the Maxim schematic it is connected to VCC.
  • C4: negative terminal to pin 6 (VS−), positive terminal to ground. Since VS− is negative with respect to ground, the positive terminal stays at ground.
  • C5: 1 µF supply bypass capacitor between VCC and ground.

Capacitor traces on the PCB must be kept short. Texas Instruments states that this is especially important at the C1 and C2 nodes, which have the fastest edges.

Things to watch when selecting and using it

The supply must be 5 V

The operating range of the MAX232 is 4.5 V to 5.5 V; it cannot be powered from 3.3 V. Texas Instruments recommends taking VCC from the same supply as the logic circuit that drives the TIN pins. If you take the 5 V rail from a linear regulator, the 7805 vs. AMS1117 comparison helps with regulator selection.

Use with a 3.3 V microcontroller

Since the driver inputs accept 2 V and above as logic 1, a 3.3 V TX output can drive T1IN. The problem is in the other direction: R1OUT delivers at least 3.5 V at a 1 mA load and rises to a level close to VCC. For a 3.3 V microcontroller whose input is not 5 V tolerant, this level is above the limit. On a board that runs entirely on 3.3 V, it is better to choose RS-232 transceivers that operate from a 3 V supply. These parts are listed in the drivers, receivers and transceivers category.

Unused channels

The driver inputs have internal pull-up resistors (400 kΩ in the Maxim datasheet), so an unused T2IN can be left floating. When a receiver input is left open, ROUT stays high. If needed, the second channel can be used for RTS/CTS flow control.

There is no galvanic isolation

The MAX232 only shifts levels; the grounds of the two devices are joined through pin 5. If isolation is required between devices connected to different grounds, an optocoupler is added on the UART side and the MAX232 side is powered from a separate, isolated 5 V supply. For optocoupler selection on fast data lines, see the article optocoupler resistor calculation and CTR design.

Common mistakes

  • Swapping TX and RX. The microcontroller’s TX pin goes to T1IN and its RX pin to R1OUT. On the RS-232 side, one device’s output connects to the other device’s input.
  • Fitting C4 backwards. The positive terminal of an electrolytic or tantalum C4 must be at ground. A polarized capacitor fitted backwards is subjected to reverse voltage.
  • Fitting 0.1 µF on a MAX232 without thinking. Texas Instruments gives the values for the MAX232 as 1 µF. The Maxim selection table also lists the MAX232 with 0.1 µF, but in that case shows the data rate as 64 kbit/s. The version designed for full speed with 0.1 µF is the MAX232A.
  • Mistaking a negative idle line for a fault. When the UART is idle, TX is high; since the driver is inverting, T1OUT sits at a negative voltage. This is normal.
  • Drawing current from the VS+ and VS− pins. These pins are unregulated; as they are loaded, the RS-232 output swing drops.

Example calculation: is the MAX232 suitable for 115200 baud?

At 115200 baud, the duration of one bit is 1 / 115200 ≈ 8.68 µs. This rate is below 120 kbit/s, the highest rate recommended in the datasheet.

The edge time must also be considered. The Texas Instruments datasheet gives the transition-region slew rate as typically 3 V/µs into a 3 kΩ and 2.5 nF load. For the receiver, the meaningful transition is the 6 V region between −3 V and +3 V:

t = 6 V / 3 V/µs = 2 µs

2 µs is about 23% of the 8.68 µs bit time. With a short cable and a light capacitive load the edges are faster; with a heavy load, a significant part of the bit is spent in the transition. This is why errors are seen at 115200 baud with long, high-capacitance cables.

The line current is also easy to find. The input resistance of the receiver on the other side is typically 5 kΩ. The Maxim datasheet gives the driver output loaded with a 5 kΩ receiver as typically ±8 V. In this case the line current is 8 V / 5 kΩ = 1.6 mA. In the Texas Instruments version, the no-load supply current is typically 8 mA, so the idle power consumption is around 5 V × 8 mA = 40 mW. In the Maxim version, at a typical 5 mA, this value is 25 mW.

Measurement sequence if the circuit does not work

  1. Verify that there is 4.5 V – 5.5 V between pins 16 and 15.
  2. Pin 2 (VS+) should be at approximately +8.5 V to +10 V with respect to ground, and pin 6 (VS−) at a negative voltage of similar magnitude, often slightly smaller. If these voltages are missing, check the capacitor values, orientations and solder joints.
  3. When the UART is idle, T1OUT (14) should be at a negative voltage. The value guaranteed into a 3 kΩ load is −5 V or more negative.
  4. Short T1OUT (14) to R1IN (13) and send data. If the data sent comes back unchanged from R1OUT (12), the IC and capacitors are good, and the problem is on the cable or connector side.

Frequently asked questions

Does the MAX232 work with 3.3 V?

No. The supply range of the MAX232 is 4.5 V – 5.5 V. In 3.3 V systems, RS-232 transceivers designed to operate from a 3 V supply are used.

Which capacitors are used with the MAX232?

Four 1 µF charge pump capacitors and a 1 µF supply bypass capacitor between VCC and ground are used. They can be ceramic, tantalum or electrolytic. With polarized capacitors orientation matters; the positive terminal of C4 is connected to ground.

What is the difference between the MAX232 and the MAX232A?

According to the selection table in the Maxim datasheet, the MAX232 operates up to 120 kbit/s with 1 µF capacitors (64 kbit/s with 0.1 µF). The MAX232A uses 0.1 µF capacitors and reaches 200 kbit/s. Their pinouts are the same.

What voltage is measured at the MAX232 output?

The driver output into a 3 kΩ load is at least ±5 V, typically around ±7 V. On an unloaded line, the voltage approaches the charge pump outputs. A negative voltage is seen on an idle TX line.

Is the MAX232 short-circuit protected?

According to the Texas Instruments datasheet, the driver outputs are protected against short circuits to ground, and the short-circuit current is typically ±10 mA. It is also stated that more than one output must not be shorted at the same time.

Conclusion

The MAX232 is a straightforward way to connect a 5 V board to an RS-232 port. One IC, five 1 µF capacitors and the correct TX/RX orientation are enough. Settling three points at the start of the design makes the job easier: is the supply 5 V, is the package through-hole or surface mount, and does the operating temperature go beyond the 0–70 °C range? For breadboards and perfboards the MAX232N, for surface-mount boards the MAX232CWE, and for environments down to −40 °C the MAX232EPE are suitable options.

MAX232CWEAnalog Devices Inc. · EE00882$0.55656 In StockView
MAX232EPEAnalog Devices Inc. · EE02122-4$13.001 In StockView

References

Products in this article

More from Ürün İncelemeleri