Need Some RS232 Help - Page 1
Forum section: electronics / beginners

author: Electro Fan
author_rank: Super Contributor
timestamp: April 09, 2020, 12:29:23 am
content: I can decode UART (RS232) on a Rigol MSO2072 when receiving data (a text file) from a pc port, no problem. The scope shows a Pk-Pk voltage of ~12V.And I can also decode on an Intronix LogicPort, no problem, but in thinking about using another logic analyzer that is supposedly spec'd for +/- 5V I'm concerned that the RS232 voltage will be too high.So I have this board:https://www.amazon.com/RS232-converter-board-male-3-3V/dp/B0088SNIOQ/ref=sr_1_10?crid=2ELJEIUAKT174&dchild=1&keywords=ttl+to+rs232+converter&qid=1586387775&sprefix=ttl+to+rs%2Caps%2C160&sr=8-10Using the scope I tried to decode the PC data running from the RS232 port through the converter board to confirm that 1) I am able to still decode at a reduced voltage and 2) the voltages are lowered appropriately to the expected 3V or 5V - but I am not getting successful decodes and the Pk-Pk is only about 750mV.After reading some of the Amazon user comments it looks like maybe this board needs to be powered? Related to this, the board supposedly can run at 3 - 5V, but I'm not clear on what determines 3 vs 5 - maybe a jumper setting, but probably just the supplied voltage.Up to now when decoding I've been probing the TXD and GND pins with the scope. In thinking about powering the converter board I guessed that maybe it's as easy as supplying DC power via the VCC and GND pins?This got me thinking, do I want to use a DC power supply on the same GND pin as the probe ground clip (maybe not). So, just for curiosity I removed the probe ground clip from the GND pin of the RS232 connector while decoding some text and lo and behold, the decoding continued just fine without the probe ground clip attached. Maybe I've been using the GND clip to probe the RS232 port unnecessarily? (duh?)This gave me some more confidence to re-insert the RS232 to TTL converter with the board powered at 3V and/or 5V from a DC power supply (ie, connecting the power supply leads to the VCC and GND pins on the board). That in turn got me thinking about how much current to supply to the the converter board. That caused me to go back and measure the signals from the PC RS232 port's TX pin to the the scope probe - so I inserted a DMM in the middle and found that the current on the TX pin appears to only be about 80-90 uA. So I figured I'd power up the board with a DC power supply set to 3V and 1mA since that's the lowest current setting available. I gave this a try (and also tried 5V) but so far no luck.Any suggestions on how to get this converter board to run at 3 or 5V? Also, what are the chances that the scope will no longer decode the (ASCII or binary) since instead of being ~ +6V to -6V the signal will range between 0 and 3V or between 0V and 5V (ie, TTL)?Thanks

author: hexreader
author_rank: Frequent Contributor
timestamp: April 09, 2020, 12:42:27 am
content: A supply of anywhere between 3 and 5 Volts is fine - the signal levels will be approximately the same as the supply voltage.Signals will be inverted, so you will need to adjust oscilloscope and Logic Analyser settings for opposite polarity for successful decode.

author: Manul
author_rank: Super Contributor
timestamp: April 09, 2020, 12:44:20 am
content: Well, yes of course it needs power. There is a 6 pin header. And there is GND and VCC. So give it 3.3v or 5v. Negative to GND, positive to VCC. And set current limit to something like 100mA or more, not 1mA.

author: Electro Fan
author_rank: Super Contributor
timestamp: April 09, 2020, 01:26:25 am
content: Hi hexreader and Manul, Thanks!Before I saw your replies I tried another converter board (shown below). Powered it with 5V and it required 19mA and also tried with 3V and it required 8mA. I probably should have guessed that it would take something more than 1mA if nothing else just to run the LEDs. This 2nd board produced nice square-shaped waveforms with a bit of noise. Unfortunately, no decodes yet. I did try the invert setting but maybe I wasn't persistent enough with that. Everyone once in a while the green decode boxes on the scope display would render on the screen for a second or less but that's as far as I got. I'll give it another try.Will let you know if/when I get it going. Thanks again

author: Electro Fan
author_rank: Super Contributor
timestamp: April 09, 2020, 01:57:46 am
content: Quote from: Electro Fan on April 09, 2020, 01:26:25 amUpdate: not sure what happened but it is now doing some decodes. Definitely it wants "invert". It seems to give more errors at the Byte level than it used to (when Packet is Off), but with Packet On it decodes cleanly. Thanks for the help and encouragement.

author: WattsThat
author_rank: Frequent Contributor
timestamp: April 09, 2020, 03:02:56 am
content: FYI the max232 chips used on those boards are one of the most commonly counterfeited chips known to man. I’m not surprised that you see differences in the output, board to board.You can always convert the rx to ttl with a simple transistor level converter.

author: Electro Fan
author_rank: Super Contributor
timestamp: April 09, 2020, 04:19:45 am
content: Thanks again for the help...Going slightly off/beyond the original topic.....After gaining confidence that the converter board could preserve the data signal integrity while changing the logic, as shown by the scope's ability to decode the data while set to inverted polarity, I moved on a step or two.I took my first low voltage spec'd Logic Analyzer and hooked it to the converter board (which was still hooked to the RS232 PC port) and tried to do some decoding. Unfortunately, the decoding with Sigrok PulseView didn't work properly. After trying various settings it turned out that the LA wasn't happy until I set the polarity for normal rather than inverted.Then I tried second LA that also works with PulseView and sure enough it also worked only when set to normal polarity.So, the good news is that the voltage conversion from ~12V RS232 to both 5V and 3V works well with both LAs, but the hard to figure news is that for some reason the LAs needed to be set for normal polarity vs the scope that wanted inverted polarity. Given that two LAs - both based on the fx2lafw - behaved the same way I'm wondering if there is something about the fx2lafw that "re-inverts" the signal from the voltage converter board?

author: AndyC_772
author_rank: Super Contributor
timestamp: April 09, 2020, 06:40:48 am
content: I'm sure you already know this, but just for the sake of clarity and completeness:- on a logic level interface, such as the output of a microcontroller's UART, logic 0 is ground and logic 1 is the CPU supply voltage, typically +3.3V.- on a true RS232 interface, logic 0 ispositiveand logic 1 isnegative. This is counterintuitive and is why level shifters such as the MAX232 are sometimes referred to as "inverting". It's also why the scope has to be set to invert when probing the true RS232 side, but not the UART side.The UART interface idles high when there is no data transfer in progress, so the corresponding RS232 line sits at a negative voltage.Your scope is designed to decode either type of interface, but you may need to change the threshold level as well as the invert setting.

author: Electro Fan
author_rank: Super Contributor
timestamp: April 09, 2020, 08:17:06 am
content: Andy, thanks. I did “kinda” know that but your post helped me think through it and sort it out. Until now most (~95%) of my knowledge and experience with UART/RS232 decoding has been with the scope. So while I realize that “high” is logic 0, on the scope - the decoder refers to the polarity as “normal” (which it is for RS232). So when I saw that the converter (level shifter) board was going to invert the logic (for TTL) I got it in my head that now I was going to be dealing with inverted logic. But I think what is happening is that the 3V or 5v output of the converter board is now the inverted logic which is effectively back to what the logic analyzers consider normal.If this is correct (and it’s late so maybe it’s bassackwards) then in a week or so when I get a logic analyzer that can supposedly handle higher voltage - which will enable the converter board to be removed from the signal path - then I should see PulseView successfully decode when the polarity is set to invert. I think 🤔

author: MarkMLl
author_rank: Frequent Contributor
timestamp: April 09, 2020, 10:22:08 am
content: Quote from: Electro Fan on April 09, 2020, 08:17:06 amIt goes back all the way to Morse code, and the terminology is "mark" (pen making a trace on paper) and "space" (pen lifted off paper). In the case of RS232 mark (logical 1) is -ve (strictly, -12V) and space (logical 0) is +ve (strictly, +12V)... hence "inverting".Over the years theres's been a gradual diminution of signalling voltage, leading to the current state where the swing if often 0..3V. Many moons ago I did a mainframe comms course subtitled "Waiting for Baudot".MarkMLl