1
\$\begingroup\$

I have a master microcontroller that can control 4 slave microcontrollers. Each slave microcontroller is connected to 3 sensors.

The master microcontroller asks to retrieve the value of a specific sensor on a specific slave, and the slave sends the value to the master. And so on...

Can I use the full duplex protocol ? Like this (where RO = RX and DI = TX) :

enter image description here

Is it better to use half-duplex ? When is it necessary to use half-duplex ? It implies enabling receive and driver at a specific timing which can be annoying compared to the full duplex method.

I have never used an RS-485 before so I am a beginner :)

\$\endgroup\$
  • \$\begingroup\$ DI = TX I think you mean. \$\endgroup\$ – Andy aka Feb 21 at 12:25
  • 3
    \$\begingroup\$ "Full duplex RS-485" (a misnomer) is really called RS-422. \$\endgroup\$ – Dave Tweed Feb 21 at 13:03
  • \$\begingroup\$ Sure full-duplex is fine, if you are creating this for personal/proprietary use. Are you aiming for compatibility with other RS-422/485 devices? Because that quickly gets much harder. \$\endgroup\$ – rdtsc Feb 21 at 13:28
  • 1
    \$\begingroup\$ Do you have 2 lines for comms? Then half duplex - the master sends, disables its transmitter so it can listen, the slave enables its transmitter and responds then disables its transmitter so it can listen. Do you have 4 lines? Then full duplex can be supported - the master sends, and the slave can start responding while the master can continue to send. Slave disables its transmitter after sending so other slaves can transmit if needed. \$\endgroup\$ – CrossRoads Feb 21 at 13:46
  • \$\begingroup\$ I read that RS-422 is not quite the same as full duplex RS-485 : it is point-to-point communication and can control 10 slaves only. What do you mean by compatibility ? I intend to use the same RS-422/485 reference for the 5 microcontrollers. Then it would be UART between the RS-422/485 and the microcontroller. Is that fine ? \$\endgroup\$ – JackOfHearts Feb 21 at 13:46
0
\$\begingroup\$

Is it better to use half-duplex ? When is it necessary to use half-duplex ? It implies enabling receive and driver at a specific timing which can be annoying compared to the full duplex method.

It is necessary to use full-duplex when you want to transmit and receive simultaneously.

It has nothing to do with the number of slave nodes, which requires either moderation/collision avoidance mechanism on one bus or individual peer-to-peer connections between master and each slave.

It is never "necessary" to use half-duplex. The "better" part is defined mostly by the number of wires you are willing to run between the nodes.

The "annoying" part is highly exaggerated. Since in your code

... master microcontroller asks to retrieve the value of a specific sensor on a specific slave, and the slave sends the value to the master ...

you already have these two separate transmit/receive states. Adding one GPIO switch in between is trivial.

Another consequence of the method of operation quoted above is that you also have moderation mechanism defined. If slave can only respond after being prompted and only one can be prompted at a time then there is no risk of collision (unless you mess up slave address assignment, that is).

If you sum up all of the above you'd see that half-duplex communication with all the nodes on a same bus is quite sufficient for your needs. You just have to make sure that you use RS-485 compatible transceivers, like ADM3485.

|improve this answer|||||
\$\endgroup\$
0
\$\begingroup\$

How many ports do you have on each side? If you have two ports on each device, then it's easiest to just use one for each direction. If you have devices with only one port, you can still talk bidirectionally, but you have to take more care in timing and arbitration to avoid conflicts.

If you wanted to avoid all chance of conflict, you'd need 8 ports on your controller, 2 for each slave. This seems like overkill, though, since your environment is polled anyway. Without a complete understanding of your requirements, it's hard for us to make that tradeoff for you.

|improve this answer|||||
\$\endgroup\$

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.