USB RS232 Adapters - Confusion, Solution and Learned Something New Today - Page 1
Forum section: electronics / projects

author: TomKatt
author_rank: Frequent Contributor
timestamp: March 16, 2025, 12:31:50 am
content: I've been using USB serial adaptersliterallysince USB was invented, and while I understood the difference RS232 signal protocols (old school +/- 25 or 12 or 9 volt vs TTL 0-5v), I never really appreciated how some devices might interpret the bits to be reversed as a result. Over the years I've encountered devices that would communicate with one adapter but not another - and now I see why. Furthermore, while Windows has eliminated serial utilities those that remain (like PuTTY) don't offer any control over the adapter hardware.Recently I was working with a Noritake VFD display that has a serial interface. After struggling with my go-to TTL USB adapter based on a FTDI chip and getting garbage on the display, I grabbed my other USB adapter that I use for PLC devices - and it worked fine.Curious to see what's going on, I looked at the signals on my scope... The FTDI TTL adapter sends a 0-5 volt signal that idleshighat 5v and drops to zero with the start bit, then returns to 5v and remains there. Completely opposite of what I expected. Google suggests this is 'normal' and this method allows to confirm that the serial port is working because if the port is disconnected the voltage falls to 0. Furthermore, apparently most serial devices can work with this arrangement because they interpret the falling edge of the start bit as the beginning of the data packet.My other USB serial adapter uses a PL2303 chip that sends the more conventional +/- 9 volt signal, idling at -9 volts. Comparing the two adapters, what I observed is thebit pattern is inverted on the TTL adapter.OK - I've discovbered the issue. How to resolve it? I am unaware of any Windows serial utility that provides the option to invert the signals sent by the adapter... Google to the rescue again and I find theFT-PROG utilityfrom FTDI. This allows you to change various settings in the FTDI chip eeprom,including the ability to invert any signal. The process was fairly straightforward and now my TTL USB adapter can send the same signal as my old-school adapter, albeit at 0-5 volts, which doesn't seem to be nearly as much of an issue as the polarity of the bits. Furthermore, the utility allows you to create 'templates' that can be saved and recalled, so I can have various setups for the FTDI adapter and simply reflash them as needed.Now I know why serial adapters have proven so hit & miss for me over the years. And better, now I know what to do about itNote this utility only works on FTDI chips - and I believe that FTDI has gone out of it's way to fight counterfeit chips by making their drivers brick any counterfeit connected to your pc. So be certain to only use this utility on adapters with genuine FTDI chips. That discussion is a story in it's own right, so do some Googling if you want to know more about it.EDIT - FTDI serial adapter chips are so ubiquitous that it never occurred to me that they would provide a utility to modify their internal functionality at such a low level. This alone is amazing.EDIT 2 - I recall using MAX232 interface chips in my microcontroller projects long ago. The MAX232 converts TTL -> 'real' RS232 through onboard voltage converters that create the +/- voltages needed. Over time, more and more devices started using TTL serial signaling, eliminating the need for the bipolar voltages. But now and again you still run into gear that needs the older signaling -ORjust invert your bits

author: Andy Chee
author_rank: Super Contributor
timestamp: March 16, 2025, 01:01:35 am
content: The usual way to rectify this issue is to correct the polarity in the code in your target microcontroller, rather than correcting the USB-serial adapter itself.For a hardware solution, simply tack on a MAX232 charge pumped serial buffer onto your USB-serial adapter.

author: TomKatt
author_rank: Frequent Contributor
timestamp: March 16, 2025, 01:11:17 am
content: Quote from: Andy Chee on March 16, 2025, 01:01:35 amLOL - I remembered the MAX232 and edited my post, only to come back and see your comment. In fact, I nearly purchased a few cheap MAX232 boards to resolve my problem. But now understanding why this is happening - and discovering a solution to it - eliminates the need to buy and add more parts to my project.But you are correct - given the opportunity, modifying code or hardware is a solution. But in some cases like mine, you are working with a device that cannot be modified and you may need to change your adapter. In my case, I can't change how the VFD display interprets the signal from my pc - other than to change how my adapter works. Typically, this issue presents itself when working with pc -> device issues, where you have no ability to modify how the device works.But the other thing (for me) is the reaslization ofwhyI'm having trouble in the first place. I knew that the voltage levels were different, but I was unaware the bits were inverted. And also that FTDI offers that utility.EDIT - if I was programming a ucontroller for the VFD, odds are that I'd have struggled with why it wasn't working using the default serial libraries. Because I never would have thought to invert the bits - for that matter, I didn't know that inverting the serial port outputs was even an option to begin with until today (which turns out to be an optional parameter in many C libraries).

author: ejeffrey
author_rank: Super Contributor
timestamp: March 16, 2025, 01:32:37 am
content: Yes this is normal. Logic level serial ports idle a logic high. RS232 idles at negative voltage. Level translators like MAX232 are inverting. "TTL serial" isn't really a standard in the same way as RS232 signalling is but this convention is nearly universal.Keep in mind zero volts is undefined in RS232. Just inverting a logic signal doesn't actually make it compatible with RS232 signal levels.

author: TomKatt
author_rank: Frequent Contributor
timestamp: March 16, 2025, 01:38:39 am
content: Quote from: ejeffrey on March 16, 2025, 01:32:37 amI fully understand that - but in my case it seems like the device communicates perfectly with an inverted TTL signal, because it at least emulates the same rising / falling edges that a bipolar RS232 signal creates. I'm sure there are other (likely more 'pure') RS232 devices that will absolutely require something like a MAX232 converter.I still keep coming back to the fact that I'd never considered just inverting my serial port signal in the first place, let alone the fact that a utility exists to do that and it ends up working.Edit - while I understood the different serial 'types', I always thought it was avoltage aka amplitudeproblem, not a polarity problem. So MAX232 chips would get the voltage levels correct - not that they inverted the signal in the process.

author: TomKatt
author_rank: Frequent Contributor
timestamp: March 16, 2025, 02:02:03 am
content: Addendum - I should mention that my application only requires TX transmission to my VFD display. I don't need to read anything back. While the FTDI chip in the USB adapter is capable of handling 'standard' +/- serial signals, I highly doubt that microcontroller input pins would appreciate +/- 9V or +/- 25V levelsAny microcontroller project I build that needs a serial interface for external devices has a MAX232 converter included. That's a good insulator between the uc and the outside world if nothing else.