Why does my RS-485 not work ?
Submitted By: Erik Malund FAQ Last Modified: 12/05/06
- First, before going on, read 10 ways to bulletproof rs485 here: http://www.national.com/apnotes/RS-485.html
You must have a port pin controlling DE and /RE. Changing the state of this pin is commonly referred to as "turning the bus"
It is a requirement for stable RS485 communucation that the receiver 'knows' when it is receiving the last byte of a record. This may be achieved the following ways
a) the record contains the length
b) a terminating char (only possible when all transmission is text)
c) an assigned 'address byte' i.e. node address - data - terminator where node address and terminator both have the 9th bit set. I, personally favor both a) and c) because c is quite certain to be caught and then a gives an additional error check.
Now why does it not work?
1) Termination problems.
a) You do not have termination at both ends.
b) You do not use a "failsafe transceiver" OR have 3 resistor terminations at one or both ends.
c) The terminators are not at the ends of the chain.
d) You have more that 2 'ends' 485 must be point to point, NOT 'star'
2) Turning the bus too early
a) RI occurs in the approximate middle of the stop bit, you must wait ~1/2 bit time before turning the bus.
b) TI occurs at the beginning of the stop bit, you must wait 1 bit time before turning the bus.
3) Common coding mistakes
a) You have 2 units on the bus transmit enabled at the same time
b) You miss a turn of the bus
c) You miss a turn on/turn off of SM2
4) Hardware
a) The obvious: a miswire.
b) Using a 5V transciever supplied by 3.3V.
5) interconnect
a) twisted pair is a must!
b) A and b lines crossed NOTE: different manufacturerers name A and B differently you need to look at the 'truth tables' in the datasheets.
c) The ground potential difference between 2 nodes is more than the maximum common mode (listed in one datasheet like this: Receiver Input Voltage (A, B) -8V to +13V). This occurs usually because 'ground' never is GROUND. If you can ground all nodes to the same point, do that and you should be home free. If you can not overcome this problem by other means look into isolated transcievers such as the MAX1480/1490, they can handle much more
Erik
Add Information to this FAQ: If you have additional information or alternative solutions to this question, you may add to this FAQ by clicking here.