Shop OBEX P1 Docs P2 Docs Learn Events
Buffers and RS-232 — Parallax Forums

Buffers and RS-232

Peter JakackiPeter Jakacki Posts: 10,193
edited 2009-10-09 08:25 in Propeller 1
Just thought I would share this interesting bit of information with the forum as many of you know that you NEED buffers to interface to various devices. That's right! isn't it?

Take RS-232 for instance, the "standard" (not) requires minimum of +/- 3V drive, doesn't it? Ok then, it won't work without that will it? Now take a look at a typical buffer we all use, the MAX3232. What does it require to receive RS232?

MAX3232 Vih = 1.8V --- output from receiver will go low
Vil = 1.2V --- output from receiver will go high

Nowhere in there do you see something that says it needs a negative going threshold, do you?
Now take a look at the Propeller's input level requirements.

Propeller Vih = 2V --- guaranteed high
Vil = 1V --- guaranteed low

Not much different is it? So all you really need for RS-232 inputs is a current limit resistor and as the Prop inputs are extremely high impedance as are CMOS inputs then you can get away with a 100K resistor, even 10K is fine, diodes are entirely optional. To stop this from floating just add a little pull-down on the 232 side. Since the Prop handles serial in software it isn't a problem that the serial data is not inverted by a receiver chip whereas many UARTs are unable to handle this. Chalk up another one for the Prop.

The same goes for the output, just insert a suitable current limit resistor of around 220R and you get the 0 to 3.3V swing into a typical 232 load of 5K, no problem! How many 100's of feet are you going to run this anyway?

The RS-232 standard itself is a relic that is clung to without question in some ways, yet even the ancient MC1489 receivers didn't care about negative swings and the receiver itself was comprised of 3 npn transistors with a few resistors. The spec says you have to handle +/- 25V which is not a problem with a big enough current limit resistor anyway. Anybody trying to pump out +/-25V? Any equipment you know of that does that? Most 5V 232 chips will only put out +/-6V under load anyway, now you know the negative is useless and even the +6V is way over the top.

Of course for my industrial designs I still use compliant RS232 drivers, I have too to be "compliant". But I can also be compliant with low-voltage variations of RS-232 such as used with portable equipment and GPS.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*

Comments

  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-06 04:32
    Peter and I discussed this at length today. His idea although I had been thinking along similar lines of just using 74LCV04, '34 of 74LCV86 (XOR which can be used as inverters or buffers depending on the second pin.

    RS232 has changed so much since it's inception. RS232E reduced the voltage swing significantly, and NMEA (as used in marine equipment) just swings from 0V to +5V and works almost everywhere. I have fed NMEA direct into RS232 on computers and also the USB-RS232 converters as well with no problems.

    BUT, Peter's idea is even simpler. I am in total agreement. It is just so simple! Thanks for sharing Peter smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • LeonLeon Posts: 7,620
    edited 2009-10-06 08:53
    I've done that occasionally for bit-banged serial comms between MCUs and PCs for about 30 years. I've never had any problems.

    Leon

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Amateur radio callsign: G1HSM
    Suzuki SV1000S motorcycle

    Post Edited (Leon) : 10/6/2009 9:01:36 AM GMT
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-10-06 11:49
    The picaxe uses this technique to download directly to the chip with no need for a max232. The inversion is done in software.
    22k series resistor to limit current.
    10k pulldown. Not on the chip side of the 22k. On the other side - which pulls the line low if the plug is disconnected.
    For the data from the chip back to the PC, no components needed at all, as the PC's internal chip will interpret 0V the same as anything less than minus 3V, and I think that has been true for at least 15 years.

    It depends what you want from RS232. I've been running 0V/5V serial busses all over the place for years using picaxe chips. I've had the bus taken out by lightning. Maybe RS232 would have survived. Maybe a max232 might have protected a more expensive micro. Maybe not, as the lightning ended up in the cat5 somehow and took out a router too.

    For me, the advantages of true RS232 are:
    1) you can short the pins
    2) You can connect outputs to outputs.
    3) You can accidentally feed low voltage AC or DC up the pins and not damage anything.
    4) You can apply power to a RS232 port with no power applied to a chip and not get parasitic powering with partial running of the chip.
    5) You can have a 3 wire Tx/Rx/Gnd and randomly connect those pins in any configuration and not damage anything.
    6) If a device has a D9 plug/socket and is labelled RS232, it will connect to any other serial device.

    The minor advantage of real RS232 is the longer range. But I've gone 500 metres at 1200 baud with a 0V/5V system.

    Having said all this, I have a feeling that a 22k/10k picaxe circuit may satisfy most, if not all of the above criteria. Possibly the only problem is the parasitic powering problem.

    The true RS232 (eg out of a PC) is resting at -12V and active at +12V.

    Your system would be resting at 0V and active at 3V3?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build

    Post Edited (Dr_Acula) : 10/6/2009 11:55:29 AM GMT
  • he1957he1957 Posts: 58
    edited 2009-10-06 11:54
    WADR: Interesting, however what is your point?

    RS-232 (and derivitives) evolved from earlier 20mA serial current loop communications protocols over time and were (probably more) allowable (partially) because of tighter (RF) noise controls imposed/adopted/arrested by other surrounding equipments. Line lengths of various serial protocols and their associated voltages (and "swings") allowed (by specifications) were stipulated to "assure" reliable communications - within their specified limits.

    In your example, you (generically) have stated a 200mV "allowance/difference" between the Propeller and a MAXx232 device; what about a 200mV ripple - perhaps induced by an AC hum from a nearby power cable? The above specifications attempted to allow for this by imposing such specifications. [noparse][[/noparse]I've worked on serial communications lines using RS-232 "specifications" way outside limits at some 500+ metres; at reduced bit rates and also using just 2 wires to phase cancel RF induced interference and can add; some "driver/buffer" circuits work and some don't - even though they are within specifications] The point here is specifications exist to assure reliable operations.

    BTW: The 1488/1489 drivers were easier/less expensive to replace after nearby lightening strikes than their interfaced-to logic cards and were quite robust with such "high" voltage specifications.

    It is imperative Designers understand specifications and limitations exist for reasons that can NOT be ignored.

    What, How, Why - is a good start wink.gif

    Yeah - well, it sorta works... - sometimes ;-/
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-06 12:40
    I've been doing stuff like this for years, and I'd just add two caveats, both involving interface to real RS232 ports:

    1. Giving some ports 0V instad of -V for logic 0 will cause major interference problems. I once had a system which would print gibberish as long as a walkie talkie was keyed nearby; feeding true RS232 cured the problem.

    2. Some RS232 receivers will not accept +3.3V as logic 1. I found this out the hard way when I replaced a BS2 with a Prop in an old design. Running 3.3 to a 5V logic input seems to work pretty reliably, but I won't run it to an actual RS232 input any more as even if you test the particular configuration, there's no guarantee it will continue to work if the receiving device is ever changed. (Also, in my case, the answer to the question "How many hundreds of feet are you running this?" is often "several.")

    Also, when using the current limiting resistor to turn a prop pin into an input, do not forget that pulldown.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-06 13:49
    Well he1957, all I can say is that maybe you missed the point. The RS-232 spec was written at a time when there wasn't much else, it was the network and it had to run long distances etc etc. The proper RS-232 had DB25 connectors and lots of signaling and secondary channels. The PC set a more modern (1980's) de facto standard with the DB-9.

    As for running any great distances I don't have a problem with using anything but RS-232, there are much better ways of running serial coms at higher speeds over longer distances. Even back in the 70's I would run coax with special 5V drivers (8T31s I think) rather than even think about RS-232 which has never been suitable for that type of thing. Anyone who uses RS-232 for distant runs is asking for trouble as I design and supply all kinds of balanced and isolated drivers for that kind of thing to industry.

    As for protection against shorts the original spec had 300 ohm resistors in the drivers to limit the slew rate and protect against short circuits. That was then when chips were very expensive and very fragile. Modern I/O is rather robust and forgiving but even so I just use a 220R resistor for that little extra protection while the receiver could handle as many volts as you like as long as the resistor value is high enough etc.

    BTW, I didn't draw any significance to the difference that you quoted between the MAX3232 threshold and the Prop as these values are nominal. The point is that a "proper" RS-232 receiver doesn't offer any extra magic nor any more protection than a one cent resistor affords. Didn't you notice the abysmal noise margin of the proper RS232 chip?

    So the point is very very simply that we don't have to conform to some old old standard out of tradition because even the interface chips don't, so why do we. Exceptions happen in exceptional circumstances but the norm is the norm or should all aircraft be fitted with inflatable Zeppelins in case of simultaneous engine failures?
    he1957 said...
    It is imperative Designers understand specifications and limitations exist for reasons that can NOT be ignored.

    It is because I have extensive experience in datacoms and am fully aware of the specifications and limitations and why they existed back then that I deprecate them in 21st century usage otherwise I WILL be carrying on in ignorance. What is the big problem with relegating RS-232 to the role it actually plays today rather than what was expected of it decades ago? If we actually address this issue we can stop piling on all those 232 chips and capacitors etc onto every board when MOST uses for RS-232 signals require only a few feet of travel.

    @localroger: Low impedance outputs with termination beats medium impedance drivers in handling noise so I guess the logic level driver was a little on the weak side as in the case of 8051 quasi-bidirectional I/O. Once again, RS-232 is just not cut out for noisy environments, the +/-12V with "proper" threshold receivers was an attempt at the time given the technology to make serial communication a little more noise and ground immune. I can't say why in your particular circumstance that you couldn't drive a PC with 3.3V (was it actually 3.3) but for those exceptions it's easy to plug in an active cable with the RS-232 drivers in the headshell a bit like the PropPlug.

    Anyway, we shoot people here who use RS-232 for any long runs other than kludges smile.gif That's why I said who really runs it that long as the main use for it is simple local low-speed communications. Haven't you defenders of the RS-232 bastions heard of RS-422 or RS-485? Run it isolated without those "ground" wires and it won't give you any problems for thousands and thousands of feet and at higher speeds.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • he1957he1957 Posts: 58
    edited 2009-10-06 15:14
    Missed the point? - precisely why the response wink.gif

    Substance is good - thanks for elaborating. Signals are good. Voltages [noparse][[/noparse]E] and Currents have their place. Without either there is no Power [noparse][[/noparse]P]. No power is difficult to measure. In context, WRT binary data communications; what counts is not necessarily P, I or E; but T; where T = Transitions. [noparse][[/noparse]Serial or Parallel]

    The number of T/S (Transitions per Second) dictate the amount of data throughput.

    Various schemes have been devised to get more "T/S" but that is another subject.

    Not being a defender of any specific protocol [noparse][[/noparse]"standard"], the response was simply intended to allude to specifications and _why_ they exist - perhaps derived from technology limits from any given time slice. What should be remembered is the rules only apply when it doesn't work as intended. If it doesn't work it either doesn't follow the rules or new rules are needed.

    IIRC RS-232 defines the physical specification; not the T/S protocol.

    Why do 1488/1489 chips cost as much (or more) today as they did 20 years ago?

    If Propeller chips all included E translation there would be no need to bother about 3.x voltages either. A good example is the latest USB Servo Module - the auto-sensing bi-directional "driver" chips excusing their limited E range however.

    Replace all wires for optical fibre. Replace all physical interconnects with non-physical ones. Do not use RF. Do not become a Krell.
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-10-06 19:29
    Sony iLink ( firewire ) on loads of their DV/DVCAM stuff, comes strait from custom BGAs on the main PCBs. Without any cheap interface chips to take on any fault conditions, the whole board has to bes changed, £300 +++

    A sacroficial "cheapie" is always good.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-07 00:00
    A little history...

    The original RS232 spec had a maximum distance of 15 meters IIRC. It was mainly used for synchronous comms in the 70's for comms between mainframes. The clocks were on pins 15 & 17. Sometimes a clock was provided for these on pin 24. Often we went 50m but that was at a maximum of 9600 baud. Original voltage swings were +-15V. There were no 1488 & 1489 originally.

    In 1976, Motorola released the D1 kit (the first 6800 board) which included an async 6850 chip and both current loop (for ASR33 teletypes) and RS232 if you could find a terminal. Over time asynchronous took over, particularly DEC (Digital Equip) and the famous VT52 & VT100 terminals. PC's jumped on the bandwagon (Apple, etc).

    Also over time the RS232 has evolved, with RS232E being the latest that I was involved with.

    Now, what Peter is saying, and I wholehearted agree, we are not doing that here. We are mainly using RS232 over very short distances and at speeds unattainable inthe old days because of slew rates and chip speeds. The noise factor is no longer an issue for hobbyists.

    As long as these shortcomings are clearly understood, what Peter is saying, we can dispense with the overkill, and make a nice simple RS232 "mostly compatible" interface with a few resistors. If it doesn't work, then buy a cheap PMOD RS232 from Digilent (www.digilentinc.com).

    If you are going long distances or in a noisy environment, then use a modern method, not the ancient RS232. It's days are numbered, but high speed serial is not.

    BTW, the modern chips will handle spikes including ESD (electrostatic discharge) significantly better than the older chips. However, lightening will often take out everyting in its path. My modem designs used 2 series smt 4R7? resistors, one in each leg, followed by a 275V MOV across them. Mostly this protected the modems - just a replacement of the resistors. However, occasionally the whole modem and the PC were fried. We have a very high incidence of lightening strikes in Northern Territory, Australia. IIRC 7KV-20KV were the norm. A telephone handset had to withstand 6KV testing, but you wouldn't use one in a storm.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-10-07 00:59
    This is from the max232 datasheet:

    "These receivers have a typical threshold of 1.3 V, a typical hysteresis of 0.5 V, and can accept ±30-V inputs.
    Each driver converts TTL/CMOS input levels into TIA/EIA-232-F levels."

    So I guess the 'standard' of +/-3V threshold has now become 1.3V.

    There are all sorts of different 'standards' anyway with RS232, eg the picaxe chips assume a +/-12V signal like from a real PC D9, but many people instead use a USB to serial device ($2-$3 on ebay) and almost all don't work. Sometimes this is due to +/-9V, sometimes even lower voltages. There are so many 'my circuit won't work' queries that the picaxe community has got to the point of recommending just one brand of USB/serial download cable.

    And I've had those USB to serial devices not work on other equipment eg a spirometer that worked fine off an older PC serial connection.

    Hmm - smaller/faster/cheaper. The standard serial connector is D9 or D25. Are all the handshaking lines really needed? Everything I do with micros uses just 3 lines - Tx/Rx/Gnd. I wonder about a different plug that is smaller/faster/cheaper - eg a standard 3 pin polarised header? What would be a male/female equivalent - would you put two pads on a board - eg Gnd/Tx/Rx and next to it - Gnd/Rx/Tx and use either depending on whether it was male or female? Or what about a non polarised 5 pin sil header - Tx/Rx/Gnd/Tx/Rx and you plug it in either way round depending on whether it is transmitting or receiving. Or a non polarised 3 pin SIL Tx/Gnd/Rx and you can plug it either way (but it will only work one of those ways).

    Call such a system PropSerial. For practical purposes it would be compatible with RS232 and PCs and other micros such as picaxe/basic stamp.

    For a 3 wire to standard D9, maybe add loopback on the D9 eg join pins 7 and 8, and join 1,4,6 as sometimes programs like hyperterminal will hang if there is no loopback.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-07 01:24
    I have been running RS232 long distances since around 1984; it's still the standard in my industry. We do prefer to run a different protocol, but when the customer wants the scale (which supports RS232, RS422, and 20mA) to talk to their PC (which supports RS232) and they don't want to pay for a converter, you run RS232.

    The main problem we have is common mode voltage differentials on the mains power. Most PC's and industrial devices have the serial ground lines, power neutral, and power ground (and for extra bonus points the stainless steel instrument case that you're about to bolt to some sketchily grounded bit of superstructure) all connected together. Get a difference in potentials between the grounds and current will flow, messing up everything. I have seen 200 ft of Belden cable blown like a fuse by this. It usually convinces the customer to spring for a current loop converter when we put it back together.

    I hardly ever run anything faster than 9600 baud, and you can push that hundreds of feet with modern drivers. We use Belden 8723 or equivalent, dual individually shielded twisted pair, and run transmit and receive in separate pairs each twisted around a ground. You hook up both grounds at one end and only one at the other to avoid a ground loop. I have run RS232 at 9600 baud over 500 feet wired like that in a tray shared with 480VAC power feeds. If you don't have common mode voltage problems on the power supplies, it works quite well.

    What works better when you need better is 20 mA current loop. It's slower than RS422 and takes more power, but I can send the guy wearing Nomex who uses his voltmeter twice a year out to check the voltage and current readings and from what he says I can figure out what died. It's optically isolated, so it handles really severe common mode and lightning problems; most RS422 drivers aren't that well isolated. And while a Black Box CL050 costs almost $200 when it gets fried to save the $2,500 scale instrument, that's a win. (There are cheaper converters but I don't use them, they are harder to use, don't work as well, and don't provide the isolation to save my more expensive stuff.)

    Incidentally, the scale instruments I deal with all use real RS232 drivers, but lightning will go right through them; one I use has one of the serial ports coming straight off the surface mount CPU to the MAX232 chips, and factory replacement on the mobo is $800.

    I have on several occasions run BS1 or BS2 pins to serial ports via resistors, always with success (but always at much shorter runs). I've found the Prop much more of a problem transmitting to other devices that way. Receiving works fine, as long as you use both current limiting and pulldown resistors. I actually use 1K for each; most drivers can supply this, and it helps with line noise on long runs.

    I wish more basic Prop boards had RS232. There's no SpinStudio RS232 board; if there were, I'd probably be buying them at a steady clip to put on protoboards. Instead I'm buying PropRPM's. They're more expensive and you can only use one of the Max232 channels because the other resets the prop, but if I need a second port it's usually input only so I can use the resistors and it gives me a real serial port. If there was something like the protoboard but with NTSC instead of VGA, or both (thanks to the extreme cheapness of headrest DVD monitors) and serial either instead of or in addition to propplug programming, I'd be all over it. The socketed EEPROM of the PropRPM just came in real handy but otherwise I just find the board to be quite large for what I'm needing it to do, and most of the sockets just represent things that can get knocked out when a truck hits the kiosk pole.

    And in my industry true RS232 support is the nuts. You can convert it to anything if you need to and convert it back. But if your board supplies only RS422 and the one at the other end only understands 20mA (as many devices I know do), you are in for quite a conversation with your customer about that extra converter.
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-07 01:34
    Dr_Acula -- The original RS232 standard called for +-5 to +-15 volts; if the picaxe will not accept +-5 then it is not, even by the oldest and most conservative standard, RS232 compatible. Many laptop computers only output +-5, though I've never seen any so-called standard RS232 device output less or fail to swing negative. I have had some devices give trouble with some laptops presumably because of this. And my primary development machine's multiport serial card (which is a very common and expensive solution in industrial circles) simply refuses to see 3.3V as logic 1 at all.
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-07 01:39
    If you really require RS232 try this pcb $15 from Digilent http://digilentinc.com/Products/Detail.cfm?NavPath=2,401,463&Prod=PMOD-RS232

    localroger: I fully agree with all that you are saying. However, most of us are not doing that anymore - we are just communiction between various pcbs over extremely short distances or PC's in which RS232 is now becoming rarer (and almost never on laptops). For distances and ground loops, optoisolated connections should be used these days anyway. Gone are the days when we used to demand computer operators were not permitted to wear nylon nickers (true story).

    After a discussion with Peter shortly, I am going to propose a circuit for using PS2 and/or RS232 on the same pins.

    There is always the alternative 3 or 4 way 3.5mm connector as used in some projects - just have to find if the tip is tx or rx, and the next pin. When video is used on these pins the 2 main standards (yes there are more variants) are... tip to ring: audio, audio, video, gnd OR audio, audio, gnd, video. Nokia uses one, Apple uses both but the iPod/iPhone is opposite to Nokia. If this were used then it would make sense to have tip to ring: tx/rx, tx/rx, dtr, gnd. Just not sure which way for tx and rx. More research required. However, the PS2 connector makes the most sense for now.

    Note: These days only TX & RX + GND are really used. Of course, we use DTR (or RTS) to reset the prop. If your device requires them, link RTS back to CTS+DCD and DTR to DSR.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

    Post Edited (Cluso99) : 10/7/2009 1:48:38 AM GMT
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-10-07 02:11
    I can see a use for this, but I also have some misgivings calling it RS232.

    Would a compromise be to call it something else, eg buffered propserial. It is a serial link but it is better than just a wire link because you can short it or put the wires in the wrong way round and it doesn't matter.

    Its purpose is short distance interboard connections.

    Define the values of the protection resistors and define some sort of connector and I think this could be very useful.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-07 02:36
    RS232 is the voltage specification, and if it's not +-5 to +-15 it's not RS232. If it's +-3 it might be RS232E, but I have never in my professional life seen anything labelled "RS232E compatible." If it's 0-5 or 0-3.3 it's not RS232, just as RS422 isn't RS232 and 20mA isn't RS232, even though you can convert all of them to each other with a few resistors and maybe an opamp. There is the serial protocol, which is how data is sent on them all and is the same on them all and uses the same driver on them all, but the voltages are another matter.

    If you are connecting to other random devices you need to observe the specification; not doing that can lead to really weird problems like the kiosk (someone else built that I had to install and troubleshoot) which went nuts when a walkie-talkie was keyed nearby because of the floating negative receiver. Fortunately, most hobbyists don't have to deal with this problem, or they can test and go with solutions that work under test; I can't do that because I can't be sure that even though the device I have in front of me takes 3.3V as logic 1, I can't be sure that the version of it I have to buy as a replacement in 2014 will do that too. Consider that I am currently laying plans to replace a device that was designed in 1982 and installed in 1988 and is still in service today. Specifications are there for a reason. We're laying plans to replace this device because even though "in industry you don't mess with things that work" we can't get parts for it any more, and it's at a bottleneck in a process that could end up costing someone hundreds of thousands of dollars a day if it goes down. Yeah customers are cheap but they eventually grok stuff like that.

    I don't expect prop peripherals supporting 422, 485, or 20mA; you don't see them very much. But true RS232 support is something some of us really do need quite often, and when we need the others converters from RS232 to those other things are readily available. I find it kind of strange that I can't get a board with a pre-soldered surface mount Prop and an actual serial port, and that the only board I know meant for application deployment is all through-hole and socketed and the serial port is only there for programming when I'd so much rather have my proppplug do that and use both channels of the max232 chip for data.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-07 03:32
    localroger, you would love me if you saw the prop boards I've got loaded up with true RS-232 ports, one unit with 6 ports. But for multiple ports I tend to use modular RJ-45 as there are a couple of "standards" for pinouts, though I prefer the YOST as DTE and DCE are the same and all you do is flip the cable. There is where the RS-232 standard is a nightmare as computers are regarded as DTEs or mere terminals smile.gif The RJ45 allows patch cables to be used in the aviation industry (also roads etc) where we still have a lot of RS-232, RS-422 etc. But the highway and traffic control stuff uses a lot of isolation and protection. One of my newer units uses serial coms over single-mode fiber, good for at least 15kms.

    But I disagree that we need true RS-232 support, though I find it almost amusing that RS-232 is kludged to the extent it is.

    Here's a shot of a couple of units I use for isolation and driving long lines as well as conversion.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
    640 x 480 - 177K
    640 x 593 - 72K
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-10-07 03:55
    Re localroger "I find it kind of strange that I can't get a board with a pre-soldered surface mount Prop and an actual serial port, and that the only board I know meant for application deployment is all through-hole and socketed and the serial port is only there for programming when I'd so much rather have my proppplug do that and use both channels of the max232 chip for data."

    Yes I agree. I've got one I designed two weeks ago and it is in transit as of yesterday. It is half what you want - it has two real RS232 ports with D9s, though one of those is the programming port. I guess if you want real RS232 you have to make the board yourself. Or get addon boards (for a number of RS standards) like the ones futurlec sell.

    I like the idea of both real RS232 with D9s, and also Peter's serial port standard on the same board. Not D9 for that standard though. I'm not sure about 3 pin stereo sockets. How do you do crossover cables? Or are all cables crossover? I'm veering towards 3 way non polarised sil headers Tx/Gnd/Rx, and I'd be keen to brainstorm the values of the resistors a bit further.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-07 06:53
    3pin stereo sockets are used for serial on some pic pcbs and other demo boards I have seen. Certainly some of the phones use them and possibly even some of the iPod clones. Not that I am a fan of these, just they are used.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-07 12:33
    Most of the stuff I've been dealing with lately doesn't even have connectors; they have terminal blocks like the ones on Peter's converters, or Wago spring clips. It's a given that you will have to make up a cable with a soldering iron. I don't even bother referring to the specs any more; the pin with negative voltage on it is TX and the other one will be RX. If you check it with a voltmeter and then make the cable, it will be right; if you try to follow all the crossovers and specs that say TX when they mean TX for the OTHER DEVICE and so on you will have an 80% chance of getting it wrong.

    I'm not too fond of RJ connectors because it's hard to troubleshoot them, and they are a bit flimsy if they're cycled a lot. DB connectors are over-engineered but the good ones with solder pins are built like rocks; they work pretty much no matter what you do to them. Take off the hood and you can get to the pins with a voltmeter while they're hooked up. The extra pins can come in handy too; I've been hotwiring my PropRPM's to supply power and feed the second resistor-based serial port through the unused DB pins. The DB is much more reliable than the regular power connector.

    As for things like audio jacks, they suck, they make poor contact and short as they're cycled and break if they're cycled a lot. The phono connectors are the infamous weak link in the TI-8x/9x calculator peripheral system.

    The problem is that serial is the only somewhat standard method of getting a stream of data, as opposed to blocks, out of an instrument. TCP is terrible due to the Nagle delays and timeouts, and other ethernet standards tend to be complicated and not too common and often need expensive licensed software libraries (*cough* PLC's *cough*). And of all the multifarious serial voltage schemes, the one you can be 99% sure of finding on any given instrument is RS232. And if you need something else and you have RS232, you can be 100% sure of finding something that will convert to what you need.

    Anyway, this is a great conversation; always interesting to see what strategies have worked for others.
  • Dr_AculaDr_Acula Posts: 5,484
    edited 2009-10-07 12:46
    Some very interesting comments there localroger.

    D9 is what I have used for everything serial up till now. Ribbon cable and IDC connectors are a good price at futurlec. But it is a bit wasteful having 9 ribbon cable wires but only ever using three of them.

    I really like your idea of terminal block connectors. I've got a drawer full of 3 way screw connectors. 0.2" spacing (do they come smaller than that?). Use any sort of cable. Easy to do xover like you say. Easy to rejig things (eg one Tx to two Rx devices). Probably the cheapest method of all. Easy to connect up.

    Hmm - I think that might be what I put on my next board. Thanks!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    www.smarthome.viviti.com/build

    Post Edited (Dr_Acula) : 10/7/2009 12:51:18 PM GMT
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-07 13:33
    localroger: Used 100,000's of RJ11's on my modems (and other boards) connecting to DB9 and DB25 with RJ45's. Never any problems with returns for that. The RJ45 cable was flat and 1m in length, no twisted pairs, etc. Anyway, that is moot now as 3 pins surfice on most things, 4 if you use the reset for the prop. You should look up NMEA also (5V & 0V) works to RS232. It is a marine specification.

    Here is my proposal. Need to do some verification when I get back to Sydney, but I am going ahead to put it on a board. If it works, then I will have saved users from buying a max3232 circuit if they want RS232 instead of PS2.·It's a 5 cent option - nothing wrong with that if it works fine turn.gif

    attachment.php?attachmentid=64267

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm

    Post Edited (Cluso99) : 10/7/2009 1:39:53 PM GMT
    1112 x 452 - 75K
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-09 00:06
    Cluso, I've had OK experience with RJ; used a number of Comtrol Rocketport 8J's back in the day before the PCI socket moved too close to the back of the enclosure and Comtrol stopped making them. If you don't mess with the wiring often they work OK but I've seen them get messed up when constantly cycled, clips torn off while rearranging cabling, and so on. And you can't get to the wiring while it's connected, which is a major nuisance in troubleshooting.

    0-5V works with intended-for-RS232 inputs 99% of the time. I've used plenty of Basic Stamps over the years just this way. But it was replacing one of those with a Prop I had a problem. I think 0-3.3 is much more marginal, at least with some receivers. It's fine if you're a hobbyist and you can test the configuration and punt if it fails, but it's not a good idea in production, or even in a one-off industrial project if you're going to some generic component you might need to replace with a possibly different model one day, say, 20 years from now.

    Your proposal looks workable though I've been using pulldowns instead of pullups for RS232; you might want to consider a couple more jumpers to allow switching from pullup to pulldown. The problem I had first time I tried the current limiting resistor trick was that the input always saw logic 1 without the pulldown, and a pullup won't help that.
  • localrogerlocalroger Posts: 3,452
    edited 2009-10-09 00:16
    Dr_Acula, they do make 0.1 inch screw and Wago spring connectors. I've put some of the orange Wago connectors on Protoboards, getting a row of I/O pins and power in one swell foop. But the Wago connectors can be difficult to load -- they're really small, the entry point is deep in the connector, and one misfiring strand keeps the wire from entering the clip. And if you get the force on the release lever just a little sideways on the end of the connector it can come apart which really blows when you are in the field trying to hook up a serial cable to a $800 circuit board. The screw connectors aren't such a problem (and the ones with integral plugs, so you screw in the wires and can then unplug the screw connector from the board, are WONDERFUL) but they require teeny, teeny screwdrivers.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-09 01:05
    localroger, I tend to agree with your view on RJ connectors especially in industrial use. When I do use RJ connectors they are usually in a nice aircon environment and anyone who messes with them is usually careful. DB9s and pluggable screw terminals rule in industrial and "rough" environments. The standard pluggable screw terminal I use is the 0.2" pitch Combicons which only require a standard "electrical tester" screwdriver. Now if you call that teeny teeny then I can only draw pictures in my head of some hairy gorilla carting around a big monkey wrench looking for things to "fix" smile.gifsmile.gifsmile.gif

    I think cluso's idea with the pullups is to keep it simple and let the serial comms software handle any perceived break conditions resulting from a disconnection. Admittedly too, I usually use 0-5V for signaling rather than 3.3V but I make sure the connector has power on it so that I can plug in a active cable (RS232 in the headshell).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-09 01:39
    The reason for the pullups instead of pulldowns is compatibility with the PS2 Keyboard/mouse standard. As I understand it, the newer USB keyboards (via a passive PS2 adapter) use this to determine if a USB or PS2 connection. I am extremely tight for room so I am trying to keep the links down but I want to be able to use each of the 2 channels independently.

    I have just thought of another possibility. If the driver were changed to run tristate (possibly slower) then the pullup will pull to 5V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-10-09 01:43
    Ray, even if the outputs are tristate or inputs they will still clamp the voltage to within VDD+0.3V because of the substrate "diode". Of course through the current limit resistor this may be slightly higher but not 5V.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
  • Cluso99Cluso99 Posts: 18,069
    edited 2009-10-09 08:25
    Peter, of course you are correct. Not thinking clearly :-(

    It is interesting to examine the published RS232 transistor circuit on the parallax website - transistors connect to 3v3 smile.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Links to other interesting threads:

    · Home of the MultiBladeProps: TriBlade,·RamBlade, RetroBlade,·TwinBlade,·SixBlade, website
    · Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
    · Prop Tools under Development or Completed (Index)
    · Emulators: Micros eg Altair, and Terminals eg VT100 (Index) ZiCog (Z80) , MoCog (6809)
    · Search the Propeller forums·(uses advanced Google search)
    My cruising website is: ·www.bluemagic.biz·· MultiBladeProp is: www.bluemagic.biz/cluso.htm
Sign In or Register to comment.