toggle quoted messageShow quoted text
Of late have only had to worry about converting between 3.3 and 5v. But I do remember replacing driver chips max232 on Unix servers when the RS232c interfaces failed.
Takes me back to 1982😀
Hmm, looks like an excellent opportunity for a rant. ;-)
Safely ignored if you already know about RS2332 signal levels, 5v vs 3.3v logic levels,
and going from USB to UART signalling.
> First, it is very important to have a level converter (e.g. DeLock Converter USB 2.0 male > Serial TTL)
> because the µCs serial Port on the Raduino-Board will be toasted if you connect it directly to the computers serial port.
> Yep, ttl<->cmos level conversion always very important with Serial comms.
A serial port from an old PC uses RS232 signal levels, typically logic levels of -12v for a mark, +12v for a space.
Those RS232 signal levels are from a 60 year old standard, now more than a little bit archaic.
So that old 9 pin PC serial port is RS232 signal levels, not compatible with TTL or CMOS logic levels.
A MAX232 chip will take RS232 to 5v logic levels of +5v for a mark, 0v for a space (it inverts the signal).
There are similar parts to take it to 3.3v logic levels, if that's what you need.
The ATMega328P chip on our Nano's uses the same UART protocol as the old RS232 standard,
but at voltage levels of +5v for a mark, and 0v for a space. So compatible with the logic side of the MAX232 chip.
A chip on our Nano clone (the CH340) allows a modern computer's USB port to talk to
the ATMega328P's 5v UART lines, no RS232 signal levels involved at all.
Generally, if operating from the same supply, TTL and CMOS logic can be directly connected.
If you have 5v TTL and 3v CMOS, it will mostly work except you need some way to protect
the 3.3v CMOS receiver from the 5v TTL high levels, perhaps just a resistive divider.
The threshold between logic 0 and logic 1 of a TTL receiver is typically down around 1v,
so transmitting from CMOS 3.3v into a 5v TTL receiver works just fine.
Transmitting from 3.3v CMOS into 5v CMOS can be unreliable, that depends on what the
threshold of the 5v CMOS receiver is, might be around 5v/2 = 2.5v (read the datasheet).
Some combination of voltage loss through the 3.3v driver, a high 5v CMOS receiver threshold
(often around 2.5v), a volt or so of hysteresis at the 5v receiver, a bit of noise in grounding
(or RF getting injected into the cables) is a recipe for trouble.
Some sort of 5v buffer device that has a lower receive threshold inserted between the two would solve this.
For long cables, a differential signaling scheme such as RS422/RS485 or LVDS
can go much faster than RS232. If ground currents might be an issue, optocouplers can be used
at the receiving end. But RS232 still works as well as it did 60 yrs ago if you don't need the speed.
On modern computers we don't have RS232 serial ports, we have USB ports.
There are several devices out there like the CH340 on the Nano clones
to convert from USB to UART at 3.3v or 5v logic levels.
Here a USB to UART module that works with either 5v or 3.3v logic:
The USB connection provides 5v power, the module has a voltage regulator to supply 3.3v
to the CP2102 chip from SiLabs. Logic levels on the TX UART line from the CP2102 is 0v/3.3v,
but 3.3v is usually high enugh to be seen as a high on a 5v processor such as the ATMega328P.
The RX UART line going into the CP2102 is tolerant of up to 5.8v, the threshold between
low and high is somewhere between 0.8v and 2.0v, so works fine with the 5v signal from the ATMega328P.
That module has user pins labeled GND, RXD (in), TXD (out), 3.3V (out), 5V (out), RST (in).
The 3.3v and 5v pins are there to power your logic, but don't draw more than 100ma or so from 3.3v.
The RST pin can be used to reset the USB interface, but I'd just leave it unconnected.
The CP2102 may require a special driver installed on some operating systems (such as MsWin),
my Ubuntu install came with the required software driver.
The FTDI chips (and cable assemblies) are also very popular for this sort of thing: