Driving RS-485 network - LTC485 or better?
xanatos
Posts: 1,120
I'm going to be interfacing to an RS-485 network of ICPCON 7017, 4-20ma to RS-485 Data Acquisition Modules. Nice units, 8 channels input and RS-485 out. Addressable, programmable, etc.
I will be talking to these guys with either a BS2px or possibly a Propeller if I can. I'm looking at drivers for the RS-485 protocol - specifically the LTC485. Is that a good choice for use with either of the microcontrollers I may use here, or does anyone have any suggestions/advice for other drivers, etc?
Thanks,
Dave
Datasheets attached for both the LTC485 and the ICPCON 7017 if anyone's interested.
I will be talking to these guys with either a BS2px or possibly a Propeller if I can. I'm looking at drivers for the RS-485 protocol - specifically the LTC485. Is that a good choice for use with either of the microcontrollers I may use here, or does anyone have any suggestions/advice for other drivers, etc?
Thanks,
Dave
Datasheets attached for both the LTC485 and the ICPCON 7017 if anyone's interested.
pdf
328K
Comments
IIRC, Jon used the ST485 because of its low price.
If I recall, you can tie the two enables together to one Stamp pin to select either "talk" or "listen". Connect DataIn and DataOut together with 1K resistor and tie to a second Stamp pin to either send or receive data.
I didn't read the whole manual on the modules you're using, but if they have an adjustable "turn around" delay, setting it to 100 mSec or so will assist the Stamp in being ready for the response string after a command is sent.
Cheers,
I ordered several of each chip, including the MAX485 (which seems to just be a higher voltage version of the LTC485 on first glance), and I should be able to start playing with everything next week.
Never worked with RS-485 before. It looks almost like it's just RS-232 with addressing capability :-) Going to read JonnyMac's SpinZone article now, thanks for the link.
Dave
http://www.digikey.com/product-search/en?pv7=2&k=MAX3430ESA%2B-nd&mnonly=0&newproducts=0&ColumnSort=0&page=1&quantity=0&ptm=0&fid=0&pageSize=25
There are clients that talk to this chip from various other systems that I do not have any control over, and never once had a bad communication.
Thanks!
Dave
RS-485 is a balanced line. One wire goes high while the other goes low. By twisting the pair together you insure any noise picked up by one is also picked up by the other so when the signal is recombined the noise cancels out. It actually uses much lower voltages than RS-232 but the RS-485 can use longer wires since there are fewer noise problems.
Lots of audio equipment use balanced lines as does USB.
You modules 115200 baud is at the top end of the range of the generic RS-485 chips. So you need good quality chips that do NOT have slew-rate knocked down. And I suspect that twisted pair should only be ignored for very short distances. (I ignore it all the time with lower baud rates and longer wire.)
I found that RJ connectors and generic telephone wires worked quite well for distances up to 100 feet for whatever I needed. I didn't try to push the baud rate to anything extreme. I am not even sure the wire had twisted pair, but there is twisted pair phone line wire available. (Sometimes it is informative to use out of spec material that just happens to be lying around.)
I even purchased the chips you mentioned as they are listed as trancievers, but didn't quite clarify the half-duplex limitation.
Now I use the RS-422 transcievers which are full-duplex and require 4 wires. They seem a little easier to use in many context as I don't have add an I/O direction pin to switch between recieve and send. One pair is always listening, and the other pair can always talk. You can have RS-422 used as RS-485, but it will echo what it says to itself as well as to the target listener.
RS-485 is adequate for the BasicStamp2 as the serial was always half-duplex anyway... you can't send and receive at the same time.
But with PCs and laptops and even the Propeller, full-duplex is available.
I have to admit I was rather stupid as I thought the 485 indicated a better solution just because it was a higher number than 422. One really has to pay attention to functionality, not labels. It is just a different spec used in a different way.
Still you should be able to do a lot with RS-485 and it is the chip of choice for a 'party line' configuration where one Master speaks and only the Slave spoken to responds. Just being two wires is handy in many ways.
You really only need the two pairs (the 4 wire system) if you deisre precise control to interrupt a transmission in progress. And it is not needed in the Master-Slave situation. It just works better if you have a dump terminal that is monitoring a distant activity and you need to assert immediate control.
There are lots of excellent RS-485 and RS-422 chips out there with various features that increase speed, demand less power, can tolerate bolts of lightning, and so on. So far, I've not needed all the features -- but for the Propeller the 3.3v versions can make your life much simpler if you can solder SMDs.
I never tried 8 channels of communications to some sort of a hub arrangement. My RS-485 interest was mainly in CANbus which one can daisy-chain. So all the packets and such are entirely different.
The bugaboo is that RS-232 software can drive both as RS-232 can be coded as half-duplex (like the BasicStamp2) or as full-duplex (like the Propeller and your USB to serial interface).
This application certainly requires RS-485 as it has 8 independent channels.
The LTC485 is a good chip for it.
Since I'll be doing half-duplex comms on this only anyway - I'll be sending an address and a command, then waiting to hear the data come back, then repeating for the subsequent addresses (there's 10 of the 7017 modules), 485 should be perfect.
I get to learn something new on every project - that's one of the things that makes this so much fun! :-)
I got misled when you mentioned you thought you needed a bunch of wire. I suppose most of your wire needs will for the 4-20ma loops side.
You might find an RS-232 to RS-485 converter and using Teraterm in a regular PC helpful to verify functionality of your sensors.
Both the LTC485 and LT1785 are slew rate limited in order to minimize RFI emissions. Both of those are 5V parts, great for the Stamp, but not for the 3.3V Propeller. As an alternative, the LTC2862 is a new offering from Linear Tech that works from 3V to 5V, fault protected, optionally slew rate limited, and its common mode range for error free operation is widened to ±25V.
Thanks for the info!
host, using an isolated 5V->5V DC-DC converter to power the receiver chip. This would be essential if source
and destination were on a separate power network (or phase).
RS485 itself is only the physical layer, no protocol is implied at all I believe.
BTW, a couple of tips. Use one I/O for receive and transmit together and tie RE and OE together to another I/O but use a pull-down on here as you want to make sure that it doesn't hog the bus if software hasn't asserted the TE/OE line yet. Some chips are 3.3V but I just use 5V chips with a 1K resistor from the I/O pin to the rx/tx. Your software should really use a precision half-duplex object rather than the full-duplex ones as I find their bit timing has way too much jitter. Don't forget the 120R termination resistors at each end (not on every node).
Second that. I have used cat5 and cat6 for bus lengths up to 400 - 500 feet, and tested/verified that it would work at 1000 feet on cat5 and 6. The test was done with the cable still in the box so it did not take a noisy environment into account.
http://www.linear.com/product/LT1785
That means that you can provide an 8 pin DIP socket and swap out chips that just don't seem right for you.
On the other hand, the 3.3 volt chips all seem to be SMD... harder to swap as they are soldered in.
At first reading, I thought you needed to run at the 112K baud, but the documents seem to indicate that lower rates are acceptable. Life is much simpler if you don't try to run your communications any faster than required.
At least start out with something saner, like 19200 baud. It will make getting to know the command set and other aspects of set up much less brutal.
I initially dreamt of 1000 meter runs of wire, but I suspect that most of the RS-422/485 applications that are not related to traffic control rarely go over a feet hundred feet. I just keep a coil of 100 feet of wire for bench testing baud rates and so on. I suppose one could have a 500 foot coil it one prefers.
As JonnyMac points out in the Spin Zone article, the 3.3V version are also more expensive. As long as you use the proper resistors the 5V work fine with the Prop (at least in my experience).
My overall design criteria would be to have any driver or reciever that connects to a long external wire be replacable via a socket. That indeterminate length of wire can provide all sorts of unexpected damage to these chips.
I have wanted the 3.3v chips for ages, but I can't buy them retail in Kaohsiung. I thought they would allow me to have an all 3.3v Propeller setup at the far end. Maybe my thoughts were misguided. Now that 3.3v to 5.0 boost regulators seem cheap, I guess I'll stick with the +5 in an 8 pin DIP.
You should be able to find them locally without too much trouble.
Here is a board from TI which has adapters for six of the more common surface mount packages:
Unfortunately, you can't solder to a plastic breadboard.
Besides, Loopy wanted something that could plug in a socket for easy replacement:
Of course, then he says:
Which is pretty much exactly what sockets do.
With CAT5 you have 4 pairs so the trick is to link the pairs at the ends of the cable so that you end up with 4 times the testing length for RS485 or two times the length for RS422. Rather than use RS422 chips I prefer to use RS485 transceivers either for dual RS485 or a full-duplex RS422 as the RS485 chips are also available in far more varieties as well as being specified for a more rugged environment.