We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
When I have a Master which to need to communicate with many slaves through the RXD,TXD pins, is it possible for the slaves to communicate with master independently. That is whenever the slave wants to do so. The reason why I asked is if there is an attempt by more than one slave to communicate with the Master at the same time, won't it cause a conflict? If so, how such situations to be handled?
You seem to be trying to upgrade a master/slave system into actually operating as a multi-master system.
But whenever you have multiple masters, you must have a method to synchronize.
CAN or Ethernet for example have a system where a transmitter can listen to the line while sending, and on a bit-by-bit basis notice a collision and instantly stop the transmission at a later time. The master that sent the dominant bit combination didn't notice the collision and could continue with the transfer.
A normal UART doesn't have that hardware collision-detect feature so you must implement solutions either by byte-wise protocol or by adding extra signal lines or by polling.
The complexity can quickly increase dramatically so think twice. The easiest solution is to either have one master poll all slaves.
The second easiest solution is to have a token-ring system where each device is enumerated, and where they talk in sequence - potentially just saying "i'm done - next". But a token-ring system must handle enumeration (unless you hard-code the addresses) and it must handle the loss of the token (transfer error or one of the units rebooted).
Somewhere down the line comes collision-detectin solutions. They tend to be very messy. And it is possible to produce something that seems to work, but still fails randomly at bad times.
Don't go for multi-master solutions unless you really, really have to. It is easier to go for a solution with higher baudrate if you need to speed up the response times in a polling or token-passing solution. Or have each slave add a separate signal line - either directly connected to the master or through a priority encoder - so that slave 5 can draw attention when it needs servicing.
there is, basically, two methods for multiple nodes a) master-slave which has collision avoidance because no slave speaks till granted permission. This is fairly simple. b) multi-master which must have collision detection because there is no way to avoid two nodes starting at the same time by 'listening'. This type must have retransmit capability and random start in case of collision. I have done both, but my absolute preference is collision avoidance whenever possible.
Erik