How to Carrier Sense Multiple Access with Collision Detection on a serial port?

I need to implement carrier sense multiple access with collision detection (CSMA/CD) on a serial port. This is used by several amateur radio manufacturers to implement computer control of the radio (ICOM for one). In this instance the TX and RX lines are tied together so that the signal is automatically echoed back to the transmitter. Wikipedia has a simple block diagram implying it is implemented at the "bit" level, not the "byte" level... I suspect checking echoed bytes for collisions would be simpler.

Any direction on where to look? How about a better flow diagram?

Mike

Here is a diagram with delays in it : http://www.erg.abdn.ac.uk/~gorry/eg3561/lan-pages/csma-cd.html CSMA is mentioned here : http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1199346925

But if you just use RX and TX, there is no carrier. And the CSMA protocol needs a carrier. What do you need it for ? Do you want to implement the amateur radio interface ? I hope not that you are inventing it all over again.

The rigs does not use that kind of modulation schemes you are asking for. It does not use fullduplex via one wire. PC sends the commands to radio and radio receives them, the PC ignores the echo via tx. When the radio sends the results the pc just receives. PC is the master. I am using it with cheap usb dongle, rx connected with tx.

Although ICOM describes their CI-V protocol as being CSMA/CD, there is no carrier. It is basically a collision detection protocol with multiple access so it would be more accurate to describe it as MA/CD.

This has ICOM's description of the CI-V protocol. See section 5-4. http://www.icomamerica.com/en/support/kb/article.aspx?ArticleNumber=63AE624429

A couple of other links that might be useful. http://www.vectorbd.com/bfd/control/icomciv.txt http://www.qsl.net/g3vgr/civ.html

Pete

I suspect checking echoed bytes for collisions would be simpler.

If you are happy with byte-level detection then yes. If you need bit-level detection that's a whole new ballgame.

In this instance the TX and RX lines are tied together so that the signal is automatically echoed back to the transmitter.

Fair enough but this means that all Tx pins are tied together, that's not good and regardless off the software protocol this won't work with a hardware UART.

You will heed to add a method to drive the line in an open collector-style manner so that dominant bits (usually LOW) are driven and recessive bits (usually HIGH) are floating and pulled up with a resistor. There are many ways to do that.

If the bit rate is slow enough you could fudge this with a custom version of software serial.


Rob