I have 2 wireless modules connected to mbed micro-controllers by serial and they can communicate fine, however the data transfer is one direction at a time (like transmitting down 1 wire).

I need to create a protocol in software to handle the communication between the 2 modules as I need 2-way communication, however I dont understand how to accomplish this in code.

Does anyone have an idea on how to do this?

Regards, Nick

  • \$\begingroup\$ So is it half-duplex ? and you can change roles at any time to transmit in the other direction? \$\endgroup\$ – Brian Onn Mar 2 '14 at 0:42

Knowing exactly what technology you're using for the wireless communication device would help us provide a more detailed answer. But I can tell you what your basic choices are independent of a given technology.

The fundamental challenge is how to communicate over singed shared medium. This is not an uncommon design problem and it has been solved many times in various technologies. There are two common solutions:

  1. Master-Slave: You can have one device be the master and other device(s) the slave. In this case the master can send messages to the slave, or the master can read information from the slave--effectively giving you bi-directional communication. An example technology that uses this solution is I2C.

  2. Collision Detection: The second, typically more sophisticated, approach is to make all devices 'equal' in the sense that any of them can send messages whenever the choose. In this case you need a mechanism to detect collisions which occur when two devices try to send messages simultaneously. An example technology that uses this solution is older ethernet networks which communicate over a shared twisted pair. Reference CSMA/CD.

  • 2
    \$\begingroup\$ It's interesting to note that humans typically use #2 when they communicate verbally. If two people start talking at the same time, one of them will stop talking and let the other proceed. \$\endgroup\$ – David Gardner Mar 2 '14 at 0:44

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.