Shop OBEX P1 Docs P2 Docs Learn Events
Prop to Props with RS485 — Parallax Forums

Prop to Props with RS485

T ChapT Chap Posts: 4,223
edited 2008-12-03 01:00 in General Discussion
search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=296-18121-1-ND

or

search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=MAX3430ESA%2B-ND


Just now starting to read up on RS485 for multi-hundred feet communication between multi Props (One master and X slave devices).

At first glance this IC linked seems like it allows up to 256 devices on one pair and would work.

With no real knowledge of this stuff, could I assume that this is as simple as dropping this one IC on a board with Prop, include the 100ohm resistor as shown on page 18 of the datasheet, and the Props just talk?

I also suppose that some ID is required per Prop so that if the master is asking a slave device a question or polling it for status of certain sensors, that the ID is required to determine who responds.

If anyone has experience with RS485, I would appreciate any feedback on this plan, I want to put these on a design right away to test.

The only thing I am vague on is what connectors to use. Here is an RJ45 connector that seems appropriate, although I am still searching on this. I assume the cable could be typical cat5 ethernet cable.

search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=H11289-ND

In observing some typical applications, I see the enables are required to be arbitrated, I don't have extra pins for 2 enables, so would it be possible to pull those to the enabled position and leave them?


As far as termination, would you put two jacks on each board, daisy chain each board together and make up a termination plug on the far end? With a resistor on the master side as well?

Thanks for any suggestions.


EDIT

Searching the forum I see an NV article related to the Stamp which indicates that a single pin can be used to enable both receiver and driver since one enable is inverted. I freed up a pin for the enable, as it appears that with RS485 you must enable the devices.

Post Edited (TChapman) : 12/2/2008 8:40:02 AM GMT
436 x 272 - 26K

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-12-02 08:54
    TChapman -

    Since you're already looking to use a Maxim interface chip, I'm surprised you didn't see the attached PDF which is an APP note on RS-232, RS-422, and RS-485. You might want to look at the RS-422 information as well as the RS-485 information and see which interface fits your needs best.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-02 13:28
    I have used RS485 with the Propeller. It is easy. DMX-512A is a protocol built on top of RS-485. The Prop Blade kits that I sell use the MAX487 IC for RS-485. I agree that you can use a single pin for both the receiver and enable. My schematic looks similar to what you have. I would recommend a decoupling cap on the power supply of the IC.

    Termination should be used at the last device on the network to help alleviate problems with reflections.

    As far as addressing goes, this depends on what you want to do. Usually you have multidrop so you can address each one. The address could be in software or in hardware via a dip switch or something.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
  • T ChapT Chap Posts: 4,223
    edited 2008-12-02 17:02
    Thanks Bruce/Tim, very helpful.
  • Tracy AllenTracy Allen Posts: 6,666
    edited 2008-12-02 18:05
    If you are short on pins, it is quite common to run RS485 in what is called auto-direction. Basically the way that works is that all devices rest in the receive mode, all listening for incoming messages. When one needs to transmit, say the master, the RS485 driver detects the start bit of the transmission and instantly enables the transmit circuitry, and holds the transmit driver enabled for a few milliseconds, the hold time. This is usually done with an RC circuit with a diode in DIY designs, but there are chips such as the MAX13412 that incorporate autodirection circuitry. On the other end the devices listen, and when one of them is addressed and needs to respond, it delays for a set amount (the turnaround time, which has to be longer than the hold time), and then transmits through its own autodirection RS485 driver.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tracy Allen
    www.emesystems.com
  • T ChapT Chap Posts: 4,223
    edited 2008-12-02 18:18
    Thanks Tracy, I will keep that in mind. I opened up a pin for direction control, from what I can tell using one pin to control both enables, you simply set the pin to transmit and then return it to receive for all devices, they are always receiving unless they are transmitting.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2008-12-02 22:05
    On traditional micros the RS485 is interfaced to the UART pins which are normally dedicated to individual pins. No such condition or restriction exists on the prop as it implements such "devices" purely in software. I favor using a single I/O pin connected to both the RO and DI and simply switch TX or RX function in software as required. Rather than autodirection I use an I/O pin directly to the /RE+DE with a pulldown resistor to guarantee non-transmit during reset. Having a direction control means I can achieve much higher data rates and turn-arounds then would be possible by a simple RC autodirection.

    The standard 485 chips feature "failsafe" receive meaning that if the 485 bus lines are undriven that they guarantee a logic high RO which is the idle condition. This works fine on the bench with nothing else connected.I have a problem with such "failsafe" chips in that they are not true failsafe and in fact this very mechanism works against them when the bus is over-terminated or shorted. Normally 120R termination is used to terminate a balanced line but one at either end of a line results in 60R DC termination and this actually causes the "failsafe" mechanism to fail the chip by indicating an active low on the RO. Go for full failsafe chips such as the ISL3175 or ADM3078 for instance. Maxim should also have similar parts.

    As for the connector it is quite usual to offer screw terminations, usually via a COMBICON style connector but you can choose RJ11 or RJ45 if it works for you as is the case with daisy chain jacks.

    On another note you should at the very least be aware that RS485 is a differential system in that all that the receiver needs to see is a difference of greater than 200mv between it's A and B lines for a valid signal. You could for instance connect a 1.5V battery to A and B to signal a condition then reverse the battery to signal the opposite, all without a ground. The inclusion of a ground directly or via a resistor is problematic and strictly is not required and can create ground loop problems. This technique is usually done erroneously because all circuits need a ground right? No, it's more to do with limitations of common-mode rejection but that's a long story as are many other aspects of balanced lines.

    *Peter*
  • T ChapT Chap Posts: 4,223
    edited 2008-12-02 23:29
    I appreciate the info Peter. Here is the plan so far:

    Max3430

    search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=MAX3430ESA%2B-ND

    and dual RJ45 connectors to daisychain boards together, with a terminating plug on the last slave.

    search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=151-1075-ND

    There is no specific reason for choosing pins 4 and 5 on the RJ45. The extra connections are available on the 6 pin header for future use.

    Post Edited (TChapman) : 12/2/2008 11:37:48 PM GMT
    302 x 556 - 31K
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-03 00:13
    The the topic of shield/ground for RS-485 data networks, I know what is used in DMX-512A. I don't know if this is common or not since there are only a couple other RS-485 networks that I have worked with. What is done is that the shield of the data cable is grounded at the master controller and only at the master. The shield though/gnd is passed through from one connector to the next connector at each node, but the GND is not connected to each node. In otehr words if you have two connectors for RS-485 IN and THRU, then say GND is pin 1, you connect pin 1 together on each connector. Only on the master is pin 1 grounded an all the other nodes it is just pin 1 to pin 1 and nothing more.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
  • T ChapT Chap Posts: 4,223
    edited 2008-12-03 00:31
    I see your point Timothy. But, in all the drawings I see online, there is not any shielding shown, just 4 pairs with no GND/ shield. Is there a benefit to using shielded cable, and using a pin as the connection from connector to connector?
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2008-12-03 00:48
    I suppose it depends on your environment and application. I need to look up the RS-485 spec again but I believe it talks about ground references. I know the DMX standard talks about it.

    Thank you for bringing up this RS-485 topic. It need to read what other users have to say and it is inspiring me to do some further reading. This particular topic is one that I know enough about, but I am finding some good resources that are cementing my ideas and understanding.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, E.I.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, uOLED-IOC, eProto for SunSPOT, BitScope
    www.tdswieter.com
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2008-12-03 00:48
    TChapman -

    In my experience it depends more on the length of the run. Longer wire = longer antenna!
    The amount of "noise" in the local area, also has a good deal to do with it.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When all else fails, try inserting a new battery.
  • T ChapT Chap Posts: 4,223
    edited 2008-12-03 01:00
    Since there are free connections(only 2 pins needed so far, there is flexibility to use shielded wire, and my own connectors with a shield if needed, the connections are daisy chained, so the GND for the shield can appear at the master if needed.

    Thanks for the ideas guys, very helpful.
Sign In or Register to comment.