Hi,
Multimaster:
Any device can inititate data transfer if bus is available. All devices on bus are default to receive mode. As said by Bobcat1: use collision detection.
Check if bus is available before transmitting and if possible check (Rx) bit by bit if data put on output (tx) of micro is same. If not: means that another micro is busy with bus. Continue receiving the data and process. After that try to transmit again.
Always receive on interrupt. You will now that bus is busy. Switch all interrupt off for the micro which is in transmit mode.
All protocoll is great, cause they fit the purpose it is made for.
In my opinion you decide how many databytes you transfer in 1 packet, and also what the function is of each byte.
For example:
Byte01: Start of telegram (not needed if 9-bit is used)
Byte02: To address
Byte03: From address
Byte04: Number of bytes following( not needed if fixed length packets are used)
Byte05....Bytexx: Number databytes as needed for your design: functioncodes, commands, bit settings etc
Bytexx+1: Checksum
You find out first what information is needed to be transferred from micro to micro, then build your protocoll.
I use a fixed packet of 5 bytes:
to address
functioncode: set output, reset output, input status, change micro address on bus etc
databyte1: which output to set, new address etc
databyte2: any more usefull data
Checksum
My bus is just a 20mA current source, shorted with micro output to generate data pulses. Can also be fed into PC Rs232 port for monitoring/trouble shooting/Multiple node configuration changes etc.
Have fun playing with this. Is very interesting, took me also several weeks before it worked without any problems and data loss.