0
\$\begingroup\$

I have a multidrop RS485 network with one master (PC with RS232-RS485 converter) and 2 nodes using the Max13487 (schematic attached). Communication is fine in both directions using one node. However I get nonsense(sending and receiving) when another node is added. If I power down the micro on one of the nodes, the other will communicate fine. This seems to be the case with and without termination resistors and biasing resistors. The code is written so that either node will only respond if their ID is correct. Do you have any advice on troubleshooting this problem?
enter image description here

\$\endgroup\$
10
  • 1
    \$\begingroup\$ Are you sure you have your line terminations done correctly and that any spurs are not too long. Also, what data rate are you using? Ground loops can also cause a problem. Also what cable are you using? \$\endgroup\$
    – Andy aka
    Sep 14, 2015 at 9:58
  • 1
    \$\begingroup\$ Line Termination must be in two nodes maximum, and these must be at both ends of the bus. \$\endgroup\$
    – Turbo J
    Sep 14, 2015 at 10:03
  • 1
    \$\begingroup\$ I can't see any noise on the oscilloscope, and because I'm using 9600 Baud on V short spurs, reflections shouldn't be an issue.. Though I have tried with and without termination on both ends of the line, with and without biasing. I am using twisted pair for the A/B lines and an extra line for GND between the two boards. Again I have tried with and without the GND line connected \$\endgroup\$ Sep 14, 2015 at 10:05
  • 1
    \$\begingroup\$ Maybe the 2nd slave unit is somehow recognizing some of the reply bytes sent by the 1st slave as a valid address (for it) then it kicks off and screws things up. Protocol thing? Are you using an error check byte for each message (recommended). \$\endgroup\$
    – Andy aka
    Sep 14, 2015 at 10:19
  • 1
    \$\begingroup\$ It sounds like you have more than one node transmitting at the same time. In Half Duplex, you can only have node transmitting. Normally, this would be a Master device polling slaves consecutively. \$\endgroup\$
    – R Drast
    Sep 14, 2015 at 10:22

1 Answer 1

4
\$\begingroup\$

You should be able to prove that the unwanted node is interrupting things by using your scope - check the data out line from its MCU isn't bursting into life when the wanted node is replying. I'm beginning to suspect that the reply from the 1st node contains a byte that looks like an address for the 2nd node.

Yes, the unwanted node seems to be transmitting when the other node replies to the master.

This is a common problem when designing data links. Usually what can be done is to send a first byte header that is unique and never contained in any payload data. Following that header you put the target address of the slave thus any slave can only consider replying when the unique header plus address are received. Following those bytes will be the payload data and finally an error check byte (or two).

To avoid payload data looking like the unique header use a technique known as byte stuffing OR, wait until the checksum is received in order to verify that a correct message has been received and not some snippet of data from another slave.

You can also look for breaks between transmissions in order to re-sync when looking for an address. You should also consider not transmitting blindly when another byte is being sent - a break of at least 10 bits is usually sufficient to get a more robust system.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.