Connect with us

RS485 trouble

Discussion in 'Electronic Design' started by ScadaEng, Jun 11, 2010.

Scroll to continue with content
  1. ScadaEng

    ScadaEng Guest

    I have worked allot with RS232, and other serial protocols, but this is my
    first RS485 project. It seemed straight forward to me, but now I have a big
    problem.

    I am using the max490 chip. I'm doing full duplex, 4 wire. Each of my nodes
    have the max490 communicating with a 16F877A pic chip. The whole project
    will have 25 nodes. I just built two pcb's (nodes) and individually they
    work as expected. However when I put both of them on the rs485 bus, I can't
    talk to either of them! Probably some kind of collision, but as it turns out
    my scope just died and I'm on a tight deadline. Any help is greatly
    appreciated.
     
  2. D Yuniskis

    D Yuniskis Guest

    What sort of protocol do you have in place? Do you think you
    can just start chattering any time?
     
  3. Sounds like you are not enabling them properly. Obviously they cannot all
    communicate at some time and there must be some type of
    arbitration/negotiation.

    Since it seems that it has to do with the number of devices chances are this
    is the problem. How are you arbitrating the chips? AFAIK there is no built
    in arbitration for RS485 unlike I2C so you'll have to implement it yourself.

    Basically only one chip can be enabled to communicate at any one time and
    you do this either by selecting that chip or where each chip checks to see
    if the bus is free(if the enable pin is low then it can raise it and take
    control(for the most part as it is possible two or more devices could
    simultaneously take control which can cause problems)).

    You really haven't given enough information to give any real help. AFAIK
    RS485 wasn't meant to be used as a bus(but I have done no real work with
    RS485 so I could be wrong and I'm not saying it can't work). If that is the
    case then that is your problem and you'll need to go from there.
     
  4. ScadaEng

    ScadaEng Guest

    That's the thing, there are no output enables with the max490 chip. I do
    have unique addresses, and I can call each board by itself with it fully
    functioning. Its when I put more than one board on the network(485) that I
    can't commmunicate with any of them. Not that it should matter, but I am
    using a modified RTU Modbus protocol.
     
  5. ScadaEng

    ScadaEng Guest

    And yes, I am polling each device one at a time.
     
  6. You need the 489 - 491 with transmitter Enables and implement that in
    your protocols.
    Looks like you need to hack the board too, since the it’s a 14 pin
    device.

    Cheers
     
  7. ScadaEng

    ScadaEng Guest

    I understand the transmit enables, but how does the 490 chip do it? It has
    no transmit enables, it must negotiate the transmit in some fashion.
     
  8. Joerg

    Joerg Guest


    There are. It's called DE, pin 3 on the SO package. You need to use those.

    If you don't use the DE pins I have no idea how you'd get this working.
    In case you do use them, have a polling system set up like Bit Farmer
    described and it still doesn't work I urgently suggest you borrow a
    scope. Someone in the area has got to have one, it can be a fairly
    simple and slow 2-channel scope. Best would be a digital scope but I
    guess with the tight deadline you can't be picky.
     
  9. Joerg

    Joerg Guest


    Whoops, Martin was right, I had mixed it up with the 481. With an enable
    there is no negotiation, it's always driving in the direction the input
    says it should.
     
  10. ScadaEng

    ScadaEng Guest

    Thanks for your input, Joerg, however I must disagree. There are no enables
    on the max490 chip. They do exist on the 489, 491 however not on the 491.
    The 491 is apparently auto negotiable, however I can not find documentation
    on how it is implemented. Thanks.
     
  11. No it does not. If you look at the application info, its used for
    repeaters.

    What you can do, is use one chip for RX and one for TX. And power down
    the TX chip when not transmitting.
    When the 490 is powered down its output might be in a high impedance
    state. Look at the LTC490.
    Or use a transceiver with enables.


    Cheers
     
  12. Joerg

    Joerg Guest

    Yep, sorry, mixed it up the the 481. Never heard of auto-negotiation
    though. How would they know which one is allowed to transmit?
     
  13. hamilton

    hamilton Guest

    Looking at the data sheet:
    http://datasheets.maxim-ic.com/en/ds/MAX1487-MAX491.pdf

    The MAX490 does not have an enablse on either the TX or RX, see table on
    the first page.

    The MAX490 is not for multi-master applications.

    Its for a one-to-one or one to many applications.

    Check out the data sheet for the correct usage.

    sorry

    hamilton
     
  14. THere's a good reason for that... it isn't.


    Best regards,
    Spehro Pefhany
     
  15. ScadaEng

    ScadaEng Guest

    Yeah, thats what I was affraid of. I was grabing at straws, I was hoping
    someone would see a way out of this. Thats what happens when you get caught
    up in the rush, and get talked into "not waisting time making a prototype".
    I think I will order the max491 and hack the hell out of 25 boards.

    Thanks to everyone for your responses.
     
  16. You can use that chip only on the master.

    In a "4 wire RS-485" network, the master will always have both the Tx
    as well as Rx active all the time.

    The slaves will always have the Rx enabled (listening for the master
    Tx pair), however, the slave Tx must only be activated, when that
    slave has been addressed and is ready to send the response to the
    master. Have you looked at e.g. MAX485, which has separate
    ReceiverEnable and DriverEnable pins, which you need for the slaves.

    I do not know about the PIC UART, but make sure that actually the last
    stop bit for the last byte has been transmitted out of the shift
    register, before turning off the transmitter.

    Some stupid UART designs such as the 14550 family generate an
    interrupt when the last byte has been loaded into the Tx shift
    register, however, you can not turn of the transmitter at time, but
    you have to wait for the last byte has actually been shifted out.

    For Modbus, you should actually keep the transmitter enabled for an
    additional 3.5 character times after the last data byte has actually
    been transmitted (thus sending constant Mark state), however, with a
    properly terminated line, this is not necessary as the last stop bit
    will put the line into the Mark state and the "fail-safe" termination
    will keep the line in Mark state, even if the transmitter is disabled.
     
  17. Nico Coesel

    Nico Coesel Guest

    You can't do full duplex on a RS485 bus with more than two nodes
    unless you use some kind of hub. Every device needs to receive the
    transmit signal from all other devices.
     
  18. ScadaEng

    ScadaEng Guest

    You make a good point about the UART, I will be sure to look into the
    timing. As for the new chip, I'm going to test with the max491, I am keeping
    my 4 wire configuration, I don't want to change more by going two wire.
    Thanks for your input.
     
  19. One dirty non-standard trick that has sometimes used in RS-232
    environment _might_ work with constantly on RS-422 transmitters (such
    as MAX490) on RS-485 buses.

    Put a diode in series between the RS-422 output port and the RS-485
    bus. Two diodes are required with opposite polarity for the Tx+ and
    Tx- ports. The diode polarity must be set so that they conduct only
    when Space ("0") is transmitted, but isolate the transmitter from the
    bus, when Mark ("1") is transmitted.

    When the transmitter is in the Idle Mark state, the bus is pulled to
    the Mark state by the "fail-safe" termination resistors on the bus or
    driven to Space by an other transmitter.

    The diodes will reduce the noise margin by the diode voltage drop and
    not be used, when making "RS-485" compliant slaves.

    However, if you are in full control of both the master and slaves and
    the slaves and the cables between them, you might consider this dirty
    trick.
     
  20. ScadaEng

    ScadaEng Guest

    Thanks Paul, its a neat trick. I have ordered the max489 it has the needed
    enable pins and also is slew rate limited. With my low baud rate of 57.6K,
    it will give me a little extra insurance of good comm. Thanks again.
     
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

-