5
\$\begingroup\$

I'm building a project with multiple RS-485 senders ("masters") and one receiver:

schematic

simulate this circuit – Schematic created using CircuitLab

I'm using one MAX485 as receiver connected to a Serial>USB adapter and all the other ones are "masters" sending data from sensors.

If I'm losing some data when multiples masters are sending data at the same time that's not a problem (I'm doing some collision detection with a checksum), but I have some questions:

  • Is there any risk of damaging chips, if one is sending a high bit (0V because it's UART) when others are staying high (idle or low bit)?
  • Do I need to turn off the DE pin of my MAX485 chips when I'm not sending data, to let other masters talk?
  • If yes, even if I have an Arduino next to each MAX485, it's not this one that is sending data (TX on the schematic, it's a serial sensor) and so I don't know when it's going to "talk", should I follow the SAE J1708 wiring? Are the capacitors and the resistors necessary for a short network?

SAE J1708

  • Any other advice?
\$\endgroup\$
  • 1
    \$\begingroup\$ I'm sorry but this kinda sounds like exactly the single master config, but reversed. Why cant you just have the USB serial one be the Master and on the computer side have it poll the "masters"? (where they would be slaves) \$\endgroup\$ – Wesley Lee Aug 5 '19 at 15:56
  • \$\begingroup\$ @WesleyLee I thing you misunderstood what I'm trying to do (because of the word "master", which is not the best I could have used I admit): the problem is not polling some "slaves" to ask them to send data, here's it's a simplex bus (one way), and I just want to know what happens if multiples MAX485 are sending data at the same time (not on the protocol side but on the hardware side) \$\endgroup\$ – Emerick Herve Aug 5 '19 at 16:18
4
\$\begingroup\$

Is there any risk of damaging chips if one is sending a high bit (0v because it's UART) when others are staying high (idle or low bit)?

My understanding is that multi-master RS-485 (at least one possible scheme anyways) has every node also has its receiver enabled when transmitting so it can monitor what is actually being put onto the line. If whatever it is trying to put on the line is not getting on the line, then it knows there has been a data collision. In the event of collisions, all transmitters back off for a randomized amount of time (with some fancy schemes randomizing that time too) before re-trying (and obviously don't try to transmit if something is already happening on the line). Therefore, I think it's fine though I've not noticed any obvious datasheet info that says this is okay. It might be something in the hardware protocol that's omitted from the datasheets.

Do I need to turn off DE pin of my MAX485 chips when I'm not sending data to let others masters talk?

Yes, or else the transmitter continues to hold the line at whatever level you are inputting into the chips. I made the mistake of not implementing the DE to only be enabled during a transmission and just tied it high in a system I was working on. The result was that I could not use a PC to tap into the line to send my own commands during debugging. I could only listen in to what the boards were doing because the boards would not relinquish drive control of the line.

If yes even if I have an Arduino next to each MAX485, it's not this one that is sending data (TX on the schematic, it's a serial sensor) and so I don't know when it's going to "talk", should I follow the SAE J1708 wiring? Are the capacitors and the resistors necessary for a short network?

I looked into what actually J1708 is and it appears to be an RS-485 hardware workaround to allow dominant/recessive scheme where one bit overrides the other, similar to CAN and I2C.

So unlike what I described in my first answer, where all all transmitters backoff in a data collision, not all transmitters back off in J1708. Instead only some transmitters back off. When messages collide, a dominant colliding bit will override a recessive one in a "pull-up with open-collector" scheme or "pull-down with open emitter" scheme to produce an ORing effect, using the DE pin as a data pin since it can put the transmitter to the required high-impedance state (while the regular data pin can only output a definite HI or LO which would not allow for a dominant and recessive bit scheme).

Therefore, messages with the most, earliest, dominant bits can "override" all other messages without getting corrupted. The messages with the earliest recessive bits "lose" and back off while the more dominant message continues to transmit, in a "last man-standing" scenario.

Therefore, the Rs and Cs are mandatory for J1708 since they are what bias the line to the appropriate logic level to be transmitted when the driver goes high impedance when the DE is used as a data pin. Like before, this still means that if you have the DE pin set to the dominant bit state, nothing else can be transmitted on the line because the line will be held at that and nothing can override it.

\$\endgroup\$
  • \$\begingroup\$ Thank you for your answer, it's already good to know that I need to turn off DE (even if that's not easy in my case, but I will find a solution). If just someone can confirm me that it's not a problem if multiples ones are sending at the same time (on the electronic side, not on the protocol) that would be perfect! For the resistors I was not talking about RS485 terminations but the J1708 implementation, I think you misunderstood. \$\endgroup\$ – Emerick Herve Aug 5 '19 at 16:31
  • \$\begingroup\$ @EmerickHerve see updates \$\endgroup\$ – DKNguyen Aug 5 '19 at 18:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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