Connect with us

rs422 device - must fake master

Discussion in 'General Electronics' started by Quack, Jan 27, 2004.

  1. Quack

    Quack Guest

    Hi,

    I have a device which sends data to a controller - but i want to
    replace the controller with something of my own.

    The problem;

    The 'device' does not send out any data (test with scope) unless the
    controller is hooked up.

    A scope on the controller confirms it is sending out packets.
    A scope on the device confirms it does nothing without controller.

    (device is definantly responding though, there is data being
    transfered when in normal operating conditions)

    There is only 2 wires.

    (i am told by manufacturer its RS422)

    So can RS422 send AND receive via only 2 wires ? (obviously not
    full-duplex).

    If so, then how can i 'fake' the controller.

    I have recorded from the controller what i need to say to the 'device'
    in order to make it respond, but my simple rs422/rs485 serial
    converter seems inadequate to the job. It implements a 4-wire system,
    2tx, 2rx.

    So by tieing Rx1 to Tx1 and Rx2 to Tx2, i can send - but then i cant
    receive the response :( (through this converter)..

    Basically i need a way to receive this response, directly after
    sending a command to the device..

    Any simple thing i can knockup from bits lying around - or is this
    something that i should really purchase. In which case, what should i
    buy exactly ?

    Thanks for any help!,

    Alex.
     
  2. Tim Dicus

    Tim Dicus Guest

    Hi Alex,

    You mean it will not transmit with the connector removed?

    On the RS422 connector of your device, you must connect the RTS pin to the CTS pin, and the DSR pin to the DTR pin. This is usually
    required for RS232 ports also.

    This page (not my doing) shows the RS422 pinout of a female DB-9 connector:
    http://www.thetcl.com/manuals/pinouts/rs422d9f.html
    Pin2 label is incorrect. It should be RTS instead of CTS.

    Then the device should start talking !^)

    Tim
     
  3. Quack

    Quack Guest

    You mean it will not transmit with the connector removed?

    yes, when the 'device' is disconnected from its host, it stops
    'talking'.
    Yes i know this well - but this connection has 4 wires, GND, +12v,
    data1, data2 - i dont know what data1 and data2 are, i thaught they
    were a one-way rs422 pair, and when testing with a scope DURING
    operation, it is indeed transfering data - but not without the host.

    So my question is what can the host possibly do to tell the deivce "im
    ready" - given its only 2 wires, and a differential data stream, it
    cant be flow control.
    So it must be using those wires to 'transmit' and then the SAME wires
    must be used to 'RECEIVE' by the host.

    Verry odd, i have not seen something like that before...

    Or is this some kind of standard bi-directional rs422 setup ? as far
    as i find on google, the TX and RX pairs are always seperate, i have
    not found one example where its run over a single pair.

    So i dont know how im going to tackle it :(.

    Alex.
     
  4. Tim Dicus

    Tim Dicus Guest

    Connect the RTS-CTS (and the DSR-DTR for RS232) pins on the same plug that connects to the transmitter that won't talk, like a
    loopback plug. A short jumper wire about 3/4" long should do.

    Take a look at:
    http://support.automationdirect.com/docs/250_250.pdf
    Note the connections on the examples. The RTS-CTS lines are "looped back".

    No *need* to connect the RTS-CTS (and DSR-DTR) lines from device to device. If the devices use flow control, it is usually
    accomplished with software (XON-XOFF signals).
    Some devices do not use flow control. They just send. If the device uses software flow control, send XON to start remote device
    transmission. Send XOFF to stop.
    This is a very common way of connecting RS422 and RS232 devices. I have seen (and used) variations of this. One variation uses one
    line (like DSR-DTR) looped back and the other (RTS-CTS) connected from one computer to the other. This way you can tell whether the
    plug is not connected (RTS-CTS and DSR-DTR disabled) or the power is off on the remote device (DSR-DTR enabled, RTS-CTS disabled).
    This also allows hardware flow control.

    The communication may not be bi-directional. Are you certain the "receiving" device transmits? Are you detecting the same data
    transmission (only one will be inverted) on both data lines? Or is the data signal on only one of the two lines? It is possible the
    devices are not using recommended RS422 connections.

    Tim
     
  5. Tim Dicus

    Tim Dicus Guest

    Hi Alex,

    Just to clarify one point on my last post. When I said "this is a very common way of connecting RS422 and RS232 devices", I meant
    only the RTS-CTS and DSR-DTR lines. The data lines cannot duplex without external devices to translate/moderate.

    The coffee is starting to work now.

    Tim
     
  6. Quack

    Quack Guest

    Thankyou very much for your help, i think we are getting closer here
    :)

    Actually the 'device' only has 4 wires - and two of those are power.
    The manufacturer claims the protocol is RS422 - but they could be
    wrong, because the person i spoke to did not seem very knowledgable or
    helpful.

    cant - those connections dont exist, its not a standard connection -
    im literaly 'hacking into the cable'.

    Yeah if hw flow control was implemented here, that would be the first
    thing i would look at.
    this could be it ....
    I'll give that a try :) sounds possible.
    So assuming it is this type of 'bi-direction 2-wire rs422', what
    device do i need on my pc to communicate with it, bi-directionally ?
    can i build one, is it simple ?
    I am absolutely curtain the 'device' transmits. It is collecting data
    via optical sensors and processing that data to achieve a specific
    result, which is then being communicated to the 'host'.

    But when i try and use the 'device', i get nothing. even a scope
    confirms it does send nothing.

    But when i connect to the host, it says lots of stuff. how do i know ?
    let me try to explain what my texts comprise of.

    When i connect to them (patch into the cable) while the host is
    connected to the 'device', using a rs422/rs232 converter attached to
    my pc - i see the data frmo the host AND data from the 'device'.
    (the above mentioned results are in data stream, coming from the
    device, to the host, while the host data to device is also coming into
    the same data stream).
    Obviously i cant have any way to know which data is coming from the
    host, or which is coming from the device - its all pooled together in
    this test - but i know it because its not there when disconnected.



    [host]=====||=====[device]
    ||
    [RS422/232 converter - only RX- and RX+ connected to above two wires]
    ||
    [PC]



    So if i wanted to remove the [host] from the above diagram, i would
    need a bidirectional way to talk to the [device] from the pc, as it
    does not 'talk' unless spoken to. This is probably the first thing i
    want to try, so i can try you XONN/XOFF suggestion - that seems very
    likely indeed.

    My RS422/485/232 converter has 5 pins, TX- TX+ RX- RX+ GND.

    As above, by attaching the RX- and RX+ to the 2 wires inbetween [host]
    and [device] i get all communications from either into the PC.

    I dont think i can simply tie RX-/TX- and RX+/TX+ together to create
    bidirectional comms over the two wires.

    What else could be happening here, it could not be rs422 perhaps?

    More info on the signal:
    *by connecting the two wires to a scope, one to scope's gnd and one to
    the scope's probe, i get clean square data packets.

    *by connecting one of the wires to the scope's probe, and putting the
    scope's gnd to the gnd pin of the power, i get an eratic signal, not
    very square and very jumpy - it seems incorrect wiring.

    *by doing the same above, with the *other* of the 2 wires, the same
    eratic signal happens.

    So i can rule out standard RS232 data, otherwise i would still get
    nice clean square data when comparing to gnd, and one wire could
    simply be TX, and the other RX.
    However this does not appear to be the case, unless i am missing
    something here :(.

    Thankyou for bearing with me here to find the solution ..

    Alex.
     
  7. Tim Dicus

    Tim Dicus Guest

    Hi Alex,

    How is the RS422-to-RS232 device connect into the cable? RX+ and RX- connected to the two data wires?

    BTW, one can use the same data line(s) for transmit/receive, but it must be a polling-type situation. One master polls each slave
    device on the serial bus for data, and only the polled device will respond. Otherwise, without a mediator like a hub on a network,
    data collisions will abound!

    I do not use RS232 voltages for this. I use a converter of my own design that uses +12v and ground. A 500 ohm resistor as a pullup
    on the bus connected to all device RX pins. The TX pin of each device, including the master, activates a open-collector 2N2222 that
    pulls the line low. Each device has a unique ID code that is sent in the leading byte or bits in the "packet". The device responds
    with its ID first and the data you requested from it. All others on the bus ignore packets that do not start with its ID.

    Did that make sense?

    Tim

     
  8. Tim Dicus

    Tim Dicus Guest

    I found a good site for you.
    http://www.bb-elec.com/tech_articles/rs422_485_app_note/table_of_contents.asp

    Long link but good info. RS422 and RS485.

    Tim

     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-