RS232 or USB to RS485

Started by QBA February 11, 2004
I need RS232 to RS485 converter or USB to RS485 converter, are there vendors
out there you recommend for these converters? More specifically, RS485 I am
using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate.



QBA wrote:
> I need RS232 to RS485 converter or USB to RS485 converter, are there vendors > out there you recommend for these converters? More specifically, RS485 I am > using is 2-wire (ground, don't need 4-wire version) at 19200 baudrate.
RS-232 to RS-485 needs two simple chips back-to-back: RS-232 to logic (e.g. MAX232) and logic to RS-485 (e.g. MAX485). The real problem comes from the control of the RS-485 transmitter enable, if your interpretation of two-wire RS-485 involves traffic in both directions (which is 4-wire with transmit and receive bus lines connected in parallel). There are simple boxes which contain the chips and usually a simple power supply (e.g. a plug transformer, 'wall wart'). Usually, they are four-wire, but the common bus two-wire is achieved by connecting the RS-485 bus sides in parallel. The boxes often control the transmit enable with the RS-232 RTS (request to send) signal. HTH Tauno Voipio tauno voipio @ iki fi
"Tauno Voipio" <tauno.voipio@iki.fi.NOSPAM.invalid> wrote in message
news:TCkWb.588$CO2.247@read3.inet.fi...
> RS-232 to RS-485 needs two simple chips back-to-back: > RS-232 to logic (e.g. MAX232) and logic to RS-485 > (e.g. MAX485). The real problem comes from the control > of the RS-485 transmitter enable, if your interpretation > of two-wire RS-485 involves traffic in both directions > (which is 4-wire with transmit and receive bus lines > connected in parallel).
Lately I see people here talking about 2-wire and 4-wire RS485. Isn't RS-485 *always* 2 wire? If 4-wire, it's RS422, right? Meindert
Meindert Sprang wrote:
> "Tauno Voipio" <tauno.voipio@iki.fi.NOSPAM.invalid> wrote in message > news:TCkWb.588$CO2.247@read3.inet.fi... > >>RS-232 to RS-485 needs two simple chips back-to-back: >>RS-232 to logic (e.g. MAX232) and logic to RS-485 >>(e.g. MAX485). The real problem comes from the control >>of the RS-485 transmitter enable, if your interpretation >>of two-wire RS-485 involves traffic in both directions >>(which is 4-wire with transmit and receive bus lines >>connected in parallel). > > > Lately I see people here talking about 2-wire and 4-wire RS485. Isn't RS-485 > *always* 2 wire? > If 4-wire, it's RS422, right? > > Meindert >
Right. Sorry for giving up to the common misuse. I felt that the OP was using the common incorrect terminology. Tauno Voipio tauno voipio @ iki fi
On Wed, 11 Feb 2004 07:13:55 GMT, Tauno Voipio
<tauno.voipio@iki.fi.NOSPAM.invalid> wrote:

>RS-232 to RS-485 needs two simple chips back-to-back: >RS-232 to logic (e.g. MAX232) and logic to RS-485 >(e.g. MAX485). The real problem comes from the control >of the RS-485 transmitter enable, if your interpretation >of two-wire RS-485 involves traffic in both directions >(which is 4-wire with transmit and receive bus lines >connected in parallel). > >There are simple boxes which contain the chips and >usually a simple power supply (e.g. a plug transformer, >'wall wart'). Usually, they are four-wire, but the >common bus two-wire is achieved by connecting the >RS-485 bus sides in parallel. The boxes often control >the transmit enable with the RS-232 RTS (request to >send) signal.
I have found that the converters using RTS to enable are not very useful to me. It is not possible to use them with Hyperterminal in windows because when hardware handshaking is turned on, RTS is permenantly asserted, so bi-directional transfer is impossible. It is also not possible to use them with windows application, because it is impossible to know when to reset the RTS line, because the application has no way to know exacltly when all data has been transmitted out the serial port. I think the only way to make a useful RS-232 to RS-485 adapter for windows is to use a hardware one-shot triggered by the start bit to control Transmit enable on RS-485 driver. Please let me know if I am wrong. regards, Johnny.
> "Tauno Voipio" <tauno.voipio@iki.fi.NOSPAM.invalid> wrote > > RS-232 to RS-485 needs two simple chips back-to-back: > > RS-232 to logic (e.g. MAX232) and logic to RS-485 > > (e.g. MAX485). The real problem comes from the control > > of the RS-485 transmitter enable, if your interpretation > > of two-wire RS-485 involves traffic in both directions > > (which is 4-wire with transmit and receive bus lines > > connected in parallel).
I show an example circuit, using those chips, at: http://airborn.com.au/layout/232to485.html "Meindert Sprang" <mhsprang@NOcustomSPAMware.nl> wrote
> Lately I see people here talking about 2-wire and 4-wire RS485. > Isn't RS-485 *always* 2 wire? > If 4-wire, it's RS422, right?
Yes, thats the way I see it also. However, the basic difference between RS485 and RS422 is that RS485 was designed to have more than one transmitter - although with only one transmitter active at a time. RS485 allowed higher common mode voltages to achieve that, together with parallel termination at each end. It is possible to have 4 wire RS422, 2 wire RS485, or 4 wire RS485. The 4 wire RS485 would typically have a master (such as a PC) transmitting on one pair all the time, and receiving on the other pair all the time, with a number of connected slaves (such as field devices) each receiving on one pair all the time, and transmitting on the other pair only when they were supposed to. One disadvantage of the 4 wire RS485 (besides the extra two wires) is that no slave can see the other slaves transmssions. So by definition it is only good for Master-Slave type protocols, not peer to peer protocols. One advantage is that the Master or "PC" does not need to control its transmit line - it can transmit all the time. Regards Steve http://www.airborn.com.au
tauno.voipio@iki.fi.NOSPAM.invalid> wrote:
> > >RS-232 to RS-485 needs two simple chips back-to-back: > >RS-232 to logic (e.g. MAX232) and logic to RS-485 > >(e.g. MAX485). The real problem comes from the control > >of the RS-485 transmitter enable, if your interpretation > >of two-wire RS-485 involves traffic in both directions > >(which is 4-wire with transmit and receive bus lines > >connected in parallel). > > > >There are simple boxes which contain the chips and > >usually a simple power supply (e.g. a plug transformer, > >'wall wart'). Usually, they are four-wire, but the > >common bus two-wire is achieved by connecting the > >RS-485 bus sides in parallel. The boxes often control > >the transmit enable with the RS-232 RTS (request to > >send) signal.
"Johnny" <john_wr@NOSPAM.hotmail.com.> wrote
> I have found that the converters using RTS to enable are not very > useful to me. It is not possible to use them with Hyperterminal in > windows because when hardware handshaking is turned on, RTS is > permenantly asserted, so bi-directional transfer is impossible. > > It is also not possible to use them with windows application, because > it is impossible to know when to reset the RTS line, because the > application has no way to know exacltly when all data has been > transmitted out the serial port.
Also, windows handling of timing for RTS is abysmal So even when RTS is not permanently enabled, and when the app DOES know when the packet has finished, the COMMs don't work very well.
> I think the only way to make a useful RS-232 to RS-485 adapter for > windows is to use a hardware one-shot triggered by the start bit to > control Transmit enable on RS-485 driver. Please let me know if I am > wrong.
But the one shot mustn't be retriggerable - and given possible variation in baud rate, the most reliable way to do it is using a microprocessor. Not very easy. Regards Steve www.airborn.com.au
"Johnny" <john_wr@NOSPAM.hotmail.com.> wrote in message
news:2mnj20hpmai46rg41j1d9ujentjpif0nur@4ax.com...
> On Wed, 11 Feb 2004 07:13:55 GMT, Tauno Voipio > <tauno.voipio@iki.fi.NOSPAM.invalid> wrote: > > >RS-232 to RS-485 needs two simple chips back-to-back: > >RS-232 to logic (e.g. MAX232) and logic to RS-485 > >(e.g. MAX485). The real problem comes from the control > >of the RS-485 transmitter enable, if your interpretation > >of two-wire RS-485 involves traffic in both directions > >(which is 4-wire with transmit and receive bus lines > >connected in parallel). > > > >There are simple boxes which contain the chips and > >usually a simple power supply (e.g. a plug transformer, > >'wall wart'). Usually, they are four-wire, but the > >common bus two-wire is achieved by connecting the > >RS-485 bus sides in parallel. The boxes often control > >the transmit enable with the RS-232 RTS (request to > >send) signal. > > > I have found that the converters using RTS to enable are not very > useful to me. It is not possible to use them with Hyperterminal in > windows because when hardware handshaking is turned on, RTS is > permenantly asserted, so bi-directional transfer is impossible. >
Personally, I have found Hyperterminal a real PITA, and highly inconsistent. There are a hundred and one free terminal programs for windows that are far better (and as many again commercial ones). At the risk of starting yet another "my terminal program is better than your terminal program" thread, I'd recommend "Tera Term Pro" for most serial work (because it is small, fast, neat, and does what enough for most jobs without doing too much) and "RealTerm" for more complex work (because it is big, powerful, with more options than I could imagine needing). In particular, "RealTerm" supports RTS control of RS-485 lines as you want here.
> It is also not possible to use them with windows application, because > it is impossible to know when to reset the RTS line, because the > application has no way to know exacltly when all data has been > transmitted out the serial port. >
It is perfectly possible to do exactly that - when setting the DCB flags in a SetCommState api call, you can choose to have the RTS line permanently high, or low, or hardware handshaking, or to have it active whenever there is something being sent out and deactivated when there is nothing being transmitted. It is simply a matter of choosing that flag, and your RS-485 communication should work perfectly. I haven't done any measurements as to the exact timings on the line, but I have found it far more reliable than using so-called "intelligent" RS-485 adaptors. Now, if anyone can tell me how to get the same effect in linux, I'd be most interested! David
> I think the only way to make a useful RS-232 to RS-485 adapter for > windows is to use a hardware one-shot triggered by the start bit to > control Transmit enable on RS-485 driver. Please let me know if I am > wrong. > > regards, > Johnny.
On Wed, 11 Feb 2004 08:20:53 +0100, "Meindert Sprang"
<mhsprang@NOcustomSPAMware.nl> wrote:

> >Lately I see people here talking about 2-wire and 4-wire RS485. Isn't RS-485 >*always* 2 wire? >If 4-wire, it's RS422, right?
No. RS-422 is point to point with the transmitters always on. "4 wire RS-485" usually refers to a single RS-422 master (with Tx always on) and multiple slaves with one pair constantly listening to the master transmission on the master Tx pair, but the slave transmitters can be tri-stated and all slave Tx chips are connected in parallel to the master Rx pair. The master can communicate with a single selected slave at the time in full duplex. Alternatively, the master can send broadcasts to all slaves and simultaneously receiving data from a single slave. I have not read the actual standard to check if 4 wire RS-485 actually is standardised, but this name is often used in practice for 4 wire multidrop systems. Paul
On Wed, 11 Feb 2004 07:13:55 GMT, Tauno Voipio
<tauno.voipio@iki.fi.NOSPAM.invalid> wrote:

> >There are simple boxes which contain the chips and >usually a simple power supply (e.g. a plug transformer, >'wall wart'). Usually, they are four-wire, but the >common bus two-wire is achieved by connecting the >RS-485 bus sides in parallel. The boxes often control >the transmit enable with the RS-232 RTS (request to >send) signal.
Unfortunately the 16550 family UARTs (as usually used in PC:s) are more or less useless for controlling the RTS/DTR etc. pin for data direction control, since these chips _do_not_ generate an interrupt, when the transmitter shift register is actually _empty_ (it only generates an interrupt when the last character is loaded from the FIFO to the Tx shift register). If a UART with hardware direction control is not available, one way is to connect the Tx data pin also to the Tx enable pin on the RS-485 chip and actively drive the line only when the "0" serial bits are to be transmitted (and use passive pull-ups for the "1" bits an idle) or use some micro controller to detect the stop bit and turn of the transmitter immediately after that (usually requires selecting the baud rate with DIP switches) and turning on the transmitter again, when the next start bit is detected. Paul