How to test RS485 in loopback?

Hi. When I want to test RS232, I simply cross Tx and Rx pins (2 and 3 in DB9). In RS485, on the other hand, there are four pins used for transmission, ie Tx+, Tx-, Rx+, Rx-. Is it enough to connect Rx+ to Tx+ and Rx- to Tx-, or is there any connection that should also be done? What are the possible reasons for the lack of transmission?

Reply to
kaczfan
Loading thread data ...

Strictly speaking, RS-485 is a 3-wire half-duplex bus, while RS-422 is a

5-wire full-duplex bus. However, the newer RS-485 drivers/receivers are superior to the older RS-422 versions - the specs are electrically different - and tend to get used in RS-422 5-wire applications perfectly happily.

From your description, you're using a 5-wire bus. The loopback you describe should do the trick. You may or may not need terminators, depending on the baud rate you're using.

I assume you've tried the above above and are seeing nothing. Be aware that RS-485 transceivers tend to have both driver enables and receiver enables, so you would need to enable both for the loopback to work. (RS-485 is a tristate-able bus, unlike RS-232.)

Have you tried looking at the signals with a 'scope?

Steve

formatting link

Reply to
Steve at fivetrees

I would have no idea where to plug them :/ [I'm working with 9600 bauds] On the board there are four pins, described as Rx+, Rx-, Tx+ and Tx- for rs485/rs422. There is also an rs232 port that is used at the same address, depending on the device's settings, so the ground pin can be shared

To tell the truth, I have no idea how to do it. The device is an almost regular PC. You think this can be set in the UART?

Yes, the output is visible (I can also read it from another device and it works correctly), the only problem is that I can't read the input

Cheers

Reply to
kaczfan

Ok. 9600 baud is fairly low; with short cables you can probably get away without terminators. Since you've looked with a 'scope, maybe you can tell whether the edges are clean. If you do need terminators, this would show up as excessive ringing on the edges. Anything longer than about 1/10th of a bit time is too much.

Should you need terminators, or want to try eliminating that as a possibility, grab a pair of 120R resistors. Wire one between RX+ and RX-, and the other between TX+ and TX-.

Beware of a potential gotcha, though: with RS-485 and RS-422, when the bus is tristated the receiver can see either a mark or a space, since the normal idle state is no longer enforced. Some devices get around this with a small bleed current, but nowhere near enough to ensure a known state with terminators fitted - i.e. adding terminators can sometimes cause problems. A classic way round this is to pull the RX lines up and down, as using the pullups as part of the terminators (effectively three resistors in series from 5V to 0V, with the RX lines across the middle resistor). If memory serves, you need around > 0.3V across the terminator to ensure a true idle state.

On a PC or a standalone RS-232 to RS-422/485 converter, the modem handshake outputs (RTS, and/or DTR) are typically used to control the enabling of the transmitter and receiver.

Ok, that helps. Perhaps the receiver isn't enabled: if it's configured as a half-duplex RS-485 system, you might find that enabling the TX disables the RX. More usually, each is controlled individually - it's sometimes convenient to be able to receive one's own transmission in order to know when it completes...

HTH,

Steve

formatting link

Reply to
Steve at fivetrees

Hmmm. To be clearer: for a loopback test, you only need one resistor (since RX=TX). And, as I said, for short cables it's probably not a problem. I'd be inclined to look into whether the receiver is enabled. All of this should be in the manual for the converter/board - do you not have one? Where did the board come from?

Steve

formatting link

Reply to
Steve at fivetrees

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.