advertisement
from the Automation List department...
RS485 Troubleshooting
Communications systems and equipment. topic
Posted by Leo Palacios Garcia on 2 July, 2003 - 12:39 am
Hi,

I am a student who's working on project that needs to communicate a PC (master) with a microncontroller based system (slave) through RS485. I've made some research on the Internet and got this:

The conversion from RS232 to RS485 is supposed to be done by a MAX232 which converts the signals (Tx, Rx and RTS) to TTL levels and then a SN75176B converts the TTL signals to RS485 levels. The RS485 bus is terminated on both sides (at this point there are only two devices communicating) with a 100 Ohm resistor between the two lines of communication and two bias resistors of 470 KOhm.

The software at the master uses the RTS signal to release the bus so that the slave can use it to send data (half-duplex, no parity, 2400 bauds).

The slave is controlled by ATMEL's AT89C51 microcontroller using its serial port for the communication.

At this days I finished implementing the system but the communication between master and slave doesn't seem to work even at short distances of about 1 meter. Do you have any idea of how to "debug" the system or how to find out what the problem is?

Thanks a lot,
Leo Palacios Garcia


Posted by David Alvarez Quiroga on 2 July, 2003 - 10:53 pm
Hi,

I assume you have developed your own hardware for making translation from 232 to 485. There are also signal converters for quite reasonable price that could make the work without problem.

Anyway the 470 Kohm BIAS resistance seems quite strange to me, I guess it should be 470 ohm. You could also try without them since network is so small. Please tell me if it works.


Posted by Anonymous on 3 July, 2003 - 4:51 pm
Thanks for the reply, I'm using a 470 Ohm resistor, it was an error when typing the message. The network isn't working yet, today I made some tests and detected this errors:

1) The signal that enables the RS485 driver was too short for the whole byte to be sent over the network, the problem is to find a way to know exactly when the hardware of the PC ends the byte transmission. Another idea is to wait an arbitrary time before disabling the driver. I read a post that suggests using a timer configured depending on the number of bits and the speed.

2) Some bits were incorrectly represented in differential voltages, maybe because of noise in the signal from the ST232 feeding the RS485 transceiver.


Posted by Nilesh Pradhan on 3 July, 2003 - 10:33 am
First, you would want to make sure that the
communication cables are wired correctly.

Start with the cable from the PC, and connect
Rx to Tx. Open up a hyperterminal window, and
see if you can echo back the characters you type.
If that works, connect Rx- to Tx- and Rx+ to Tx+
at the other end of the convertor.
See if you can get your typed commands back
using hyperterminal once again.
If not, you will have to make sure all the
connectors are wired right.

hope this helps.
Nilesh Pradhan


Posted by John on 3 July, 2003 - 10:49 am
Hi,

Make sure that all of the "a" terminals are connected to "a" terminals and "b"s to "b"s.

Also, that RTS is enabling the receiver to listen for data.

A source for PDFs relating to troubleshooting is designing 485 networks can be found at http://www.bb-elec.com

John


Posted by Hung Lam on 5 July, 2003 - 8:20 am
Hello,

First, you have to isolate your problems. Modify your 8051 code into burst mode (send data only in period), then make sure your PC in received mode. If the PC receives nothing, check baudrate, cable, software in PC and uC, etc. If the PC can receive data, do the reversed role: the PC transmits data only and the uC receives data only. The uC could turn on/off a LED when receiving a byte from the PC. If you can pass both two steps above, the potential problem may be the RTS signal of the PC ComPort. I got similar problem when I made a RS485/232 converter based on the website www.rs485.com . Buy a good converter will avoid many communication problems. If you still have problems, make another design using RS232 link only to make sure the program in PC and uC can communicate together.

Good luck!

Hung Lam


Posted by Lynn at Alist on 5 July, 2003 - 12:30 pm
There are many possible problems:

1) A and B are "standard" ... but not really. Some vendors "A" may be your "B". The same is true of +/- labels or data/not-data labels. This is because EIA/RS-485 talks about logical binary "0" and "1", not about voltage levels. The SN75176B labels the A/B pins assuming 0v = "1" and 5v = "0". I assume this NOT what the AT89C51 is doing! So try swapping A/B so your A goes to their B. You cannot hurt the chips - this is one of the EIA/RS-485 benefits. Even if you are designing both the Master and Slave, if you are not aware of this "detail", your design will be running the async line inverted from everyone else.

2) RS-485 is a 3-wire circuit. Besides the A/B, you'll need to make sure your signal ground (C) is shared at both ends. The EIA/RS-485 spec covers this in great detail - so should any app note from an RS-485 chip vendor. Worst case, follow the EIA/RS-485 recommendation and put a 100 ohm 1watt resister from each device to a shared "ground wire".

regards - LynnL, www.digi.com


Posted by Dick Caro on 5 July, 2003 - 4:52 pm
Here is a great information source on TIA/EIA-485 from Maxim, one of the chip-makers producing an RS-485 Transceiver.

http://www.maxim-ic.com/appnotes.cfm/appnote_number/763

In their diagram (Figure 1), they show a common line running parallel to the two-conductor transmission line. However, they neglect to show how this "wire" would be used in the circuit. I also read in the Modbus specification that an RS-485 line should include a twisted pair and a ground wire to "connect the grounds at both ends."

This is really confusing. My conclusion is that RS-485 needs only the single twisted pair, but does not need a third "common wire." The signal is a differential typically across a 120 ohm terminating resistor, and is not referenced to ground in any way. Obviously, if there is a shield on the cable, there should be a drain wire and it should be grounded, but only at one end of the cable to prevent ground loops in the shield.

Dick Caro
============================================
Richard H. Caro, CEO
CMC Associates
2 Beth Circle, Acton, MA 01720
Tel: +1.978.635.9449 Mobile: +1.978.764.4728
Fax: +1.978.246.1270
E-mail: RCaro@CMC.us
Web: http://www.CMC.us
============================================


Posted by Anonymous on 9 July, 2003 - 1:51 am
I want to thank all you for your replies, all them were really helpful. My RS485 mini-network (one master and one slave) is working properly. I'm planning to expand it to more devices soon, that's the reason of why I choose this communications standard.

In reply to Dick Caro...
RS485 uses a twisted pair for the communication, and a third wire for grounding is strongly recommended to avoid problems caused by potentials between grounds of the devices in the network. It's also needed so that the electric current that travels through the bus (from one particular driver) finds a way to return to it's source:

"Signals A and B are complementary, but this doesn't mean that one signal is a current return for the other. RS485 is not a current loop. The drivers and receivers must share a common ground, this is why 'two-wire network' is a misnomer when applied to RS485. Earth ground potentials from circuit to circuit can vary several volts under normal conditions; however, during electrical activity (lighting, etc.) potentials between grounds in different parts of a building can momentarily reach tens or hundreds of volts depending on the geometry of the electric fields"

So, you need three wires. Two for the differential voltage with the appropiate termination. A third one for the ground, which can be implemented connecting each devices digital ground with a "ground bus" through a 100 Ohm resistor. Also I have seen some application notes that suggest to use another 100 Ohm resistor to connect digital ground with physical ground.


Posted by Dick Caro on 11 July, 2003 - 1:37 am
Dear Anonymous,

First, I object to being told I am wrong by someone who will not reveal their identity. Second, you have not quoted any source for your conclusions. Third, I still do not believe you are correct. Fourth, I am pleased that your network is working correctly.

RS-485 is a differential circuit across two wires and is not referenced to ground at any point. The purpose of a differential circuit is that the electrical sum of the two signals is exactly zero at any point on the circuit except for any noise that may have been introduced. This is why differential circuits are used -- for their high common mode noise rejection. A differential circuit is the output (+) and (-) across an op amp, and does not require a return path since the sum of the current is zero.

If you want to connect two devices in different areas of a plant together with a common ground wire, you had better hope that there is NOT a ground potential difference between them, or your common ground wire will serve as the shunt between them. My paper mill experience has taught me that communications cable ground wires make terrible shunts. In fact, copper bus bars are usually used in grounding grids. Current limiting with a 100 ohm resistor to chassis ground will not work if the earth potentials at both ends are different, since the current drawn through the shunt circuit will usually be far more than a 1/4 or 1 watt resistor. You seem to be lucky since the ground points for your equipment reference approximately the same earth potential. Remember that RS-485 can run for more than 1000 feet.

Dick Caro
============================================
Richard H. Caro, CEO
CMC Associates
2 Beth Circle, Acton, MA 01720
Tel: +1.978.635.9449 Mobile: +1.978.764.4728
Fax: +1.978.246.1270
E-mail: RCaro@CMC.us
Web: http://www.CMC.us
============================================


Posted by Bill Mostia on 16 July, 2003 - 6:32 pm
On July 11, 2003, Dick Caro wrote:
> RS-485 is a differential circuit across two wires and is not referenced to
> ground at any point. <

I don't believe that this is quite correct. What exactly are the differential voltages referenced to?

Please see EIA standard RS-485 (1983) Appendix A.3 "Optional Grounding Arrangements," Section A.3.1 "Signal Reference" which states "Proper operation of the generator and receiver circuits requires the presence of a signal return path between the circuit grounds of the equipment at each end of the interconnection. The circuit reference may be established by a third conductor connecting the common leads of devices or it may be provided by connections in each using equipment to an earth reference." Also see Figure A.2 "Grounding Arrangements."

You can find additional discussion of this at:

http://www.robustdc.com/?library Application Note AN005

http://www.hw.cz/english/docs/rs485/rs485.html Ground connection for RS 422/485

http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_co ntents.asp

This is also a good overall discussion of RS-422/RS-485. PDF version can be found at: http://www.bb-europe.com/bb-euro/literature/485appnote.pdf http://www.national.com/an/AN/AN-759.pdf

Bill Mostia
=====================================================
William(Bill) L. Mostia, Jr. P.E.
Partner
exida.com
Worldwide Excellence in Dependable Automation
wmostia@exida.com(b) wlmostia@msn.com(h)
www.exida.com 281-334-3169
These opinions are my own and are offered on the basis of Caveat Emptor.


Posted by Lynn at Alist on 19 July, 2003 - 10:57 am
I think Mr. Caro was thinking about an edge/transition-triggered, transformer-isolated differential signal such as Foundation Fieldbus (I believe FF is such) and not a voltage-level triggered signal like EIA/RS-485.

The term "differential circuit" means different things in different contexts.

Anyone who reads my posts knows I "campaign" nearly monthly on the need to do something with an RS-485 ground. Likely in Caro's paper mill situations the devices all referenced their ground to common chassis ground, in which case a pure 2-wire works & a 3rd ground wire would routinely burn/melt. However, an evergrowing % of RS-485 devices are isolating/floating their ground so 2-wire will become less usable in general.

regards - LynnL, www.digi.com


Posted by Leo Palacios Garcia on 16 July, 2003 - 7:39 pm
Dear Dick Caro,

I am sorry for the misunderstanding caused by my reply dealing with RS485 grounding. My identity was not "revealed" by mistake, not because I wanted to stay anonymous, I'm Leo Palacios García (the one who started this thread about RS485 Networks Troubleshooting). My intention wasn't to neither tell nor suggest that you were wrong in any way, I'm almost half the age you are (21 years old) and this is my first inclusion in RS485 Networks, so it's obvious that you are much more experienced in the field. I didn't meant to show any conclusion, I posted what I understood after reading some application notes and articles (that touch the topic about a third wire needed for grounding) to see what others think or know about it. I posted it replying to you because you talked about Modbus Specification referencing too to a third wire for grounding purposes but said the explanation was confusing and concluded it wasn't needed and thought you will be able to explain in more detail. It seems I wasn't clear in the intentions of my post, so I apologize.

By the way, at the end of the post I have some sources that mention and in some cases explain the reasons of why this third wire is needed or suggested.

Leo Palacios García
palacios_leo@hotmail.com

***Sources***
1)Ten Ways to Bulletproof RS-485 Interfaces
National Semiconductor
Application Note 1057
John Goldie
October 1996

GROUNDING AND SHIELDING
Although the potential difference between the data-pair conductors determines the signal without officially involving ground, the bus needs a ground wire to provide a return path for induced common-mode noise and currents, such as the receivers' input current. A typical mistake is to connect two nodes with only two wires. If you do this, the system may radiate high levels of EMI, because the common-mode return current finds its way back to the source, regardless of where the loop takes it. An intentional ground provides a low-impedance path in a known location, thus reducing emissions.

2)
The Art and Science of RS-485
Circuit Cellar Online
Feature Article
Bob Perrin
July 1999
(This is probably the article that better explains the issue, also it has multiple figures illustrating suggested shared ground connections.)

"…The drivers and receivers must share a common ground. This is why "two-wire network" is a misnomer when applied to RS-485…"

GETTING GROUNDED
Probably the least-understood issue associated with building robust RS-485 networks is proper grounding. Even though there are a number of good references on the topic, grounding seems to be misunderstood by many people [2, 3].

...The practical ramification of this is that earth ground is a poor choice for referencing signal grounds on distributed network nodes. The best method for controlling VGPD is to simply run a third wire for the purpose of referencing local signal grounds...

...The common-mode voltage allowable between drivers and receivers on an RS-485 network is +12 to -7 V. This setup provides 7 V of protection from each rail (assuming a 5-V system). If the earth ground system in Figure 4c (without "common" grounding) only varies a few volts under normal conditions, then the network will function fine.
The problem comes when a voltage transient appears on the earth ground circuit, which might happen because ESD is discharged into the earth ground near a node. Or it may happen because lightning strikes nearby (perhaps half a mile away). Whatever the cause, VGPD between earth grounds on a network will occur on a daily or weekly basis.
When the common-mode voltage on a node drifts beyond the allowable Vcm of +12 to -7 V, the node is no longer guaranteed to function. In fact, the drivers and receivers in the node may be subject to damage...

[2] Robust DataComm, Grounding
and RS-422/485 (No Free
Lunch!), Robust DataComm, App
note 5, 1997.
[3] R. Morrison, Grounding and
Shielding Techniques in Instrumentation,
3d ed., Wiley and
Sons, New York, NY, 1986.
[4] R. Morrison, Solving Interference
Problems in Electronics,
Wiley and Sons, New York, NY,
1995.
[5] Robust DataComm, Surge
Management, Robust
DataComm, App note 18, 1997.

3)422 and 485 Standards Overview and System Configurations
Texas Instruments
Application Report SLLA070C
Manny Soltero, Jing Zhang and Chris Cockrill
June 2002

GROUND CONNECTIONS
All 422- and 485-compliant system configurations shown up to this point do not have incorporated signal-return paths to ground. Obviously, having a solid ground connection so that both receivers and drivers can talk error free is imperative. Figure 32 shows how to make this connection and recommends adding some resistance between logic and chassis ground to avoid excess ground-loop currents. Logic ground does not have any resistance in its path from the driver or receiver. A potential problem might exist, especially during transients, when a high-voltage potential between the remote grounds could develop. Therefore, some resistance between them is recommended.

4)Interface circuits for TIA/EIA-485 (RS485)
Texas Instruments
Design Notes SLLA036B
June 2002

In this application note TI makes reference to the third-wire ground stating that it should be earth grounded at one point only.


Posted by Curt Wuollet on 18 July, 2003 - 5:30 pm
Hi Guys

To make a long story short: Some common reference is needed, not for return current for the differential signals, but for bias and common mode currents and to keep the signals within the common mode voltage range of the receivers involved. These days it can be critical because with ever decreasing supply voltages and the cheating on signal levels that low voltages tend to necessitate, just a few volts of common mode (ground difference, for example) voltage, will not only destroy signal integrity, but will often destroy silicon as well. 485 and other diff. signal drivers are a consistant hot seller for this reason. So the differential nirvana only applies as long as these condition can be met. A common wire is one way, but for 1000 foot runs there is often no great way to keep things happy. So, you use earth grounds, one common return point, and transformers for isolation. Then if that doesn't work, convert to fiber. Can't see much to argue about, with electronics in the real world, you can calculate and model and simulate, but when you turn on the power, sometimes it just does as it damn well pleases.

Regards

cww


Posted by tecnog on 17 July, 2003 - 12:24 pm
I'm pretty interested on this... expecially after damaging two Siemens CP5611 in a matter of 4 weeks due to ground potential differences between my PC (a desktop) and the PLC when working at customers plant. This is a common problem for people operating on field and sometimes forced to connect to a PLC while getting elsewhere the supply for their PC.

As I did when using good old S5 (after damaging the integrated 20mA CL port of a PG730 for the same reason of above), I'm always, once again, connecting a temporary ground line between PC and PLC before even attempting to connect any other cable, no matter it's RS232 or RS485. I wonder how much an RS485 chip (and Profibus ones in particular) can bear a potential difference referred to ground, meanwhile I prefer a possible spark outside the PC rather than inside.

Provided I'm bending the discussion towards temporary rather than permanent RS485 connections, did anybody share or solve same problems on field?

best regards
Luca Gallina


Posted by John Dute on 19 July, 2003 - 10:23 am
Several manufacturers provide RS-232 to RS-485 converters that automatically control the driver enable - negating the need for ANY software control! You might look at Sealevel or duTec.

The duTec circuitry is available at USPTO.gov, patent number 5,729,547.

good luck

Your use of this site is subject to the terms and conditions set forth under Legal Notices and the Privacy Policy. Please read those terms and conditions carefully. Subject to the rights expressly reserved to others under Legal Notices, the content of this site and the compilation thereof is © 1999-2014 Nerds in Control, LLC. All rights reserved.

Users of this site are benefiting from open source technologies, including PHP, MySQL and Apache. Be happy.


Fortune
Show me a man who is a good loser and I'll show you a man who is
playing golf with his boss.
Advertise here
Advertisement
our advertisers
Help keep our servers running...
Patronize our advertisers!
Visit our Post Archive