This is, or at least will be a home automation project.
I don't want a master, because it will essentially be a single point of failure.
I wouldn't object to a master clock, because this could easily fail over to other clocks if needs be.
I haven't decided on a hardware implimentation yet but the system needs to be configurable in a star format which implies that some sort of hub is growing to be required so that multiple line terminations do not pull the whole thing down.
I have a germ of an idea, nothing more, but it needs to do at least the following.
Everything listens to everything else all the time, functionality will be mapped into a shared address space, effectively.
Nodes will carry coding for multiple devices but that isn't important to this question, all I want to discuss here is how to transmit information.
Obviously with no master two nodes could attempt to talk simultaneously.
My thought process, this far, is to ensure that all messages carry a unique ID which will denote priority.
When a node transmits it will also need to recieve an echo to establish that the byte it sent was the byte placed on the bus, doing this requires that all TX data is synchronised at a bit, or at least byte start level.
If this can be achieved, and assuming the data line is passively pulled up so one or more transmitters can pull it down, then a node sending 10000000 would be masked by a node sending 11000000 and would stop transmitting further.
Since the 11000000 would not have been corrupted by the colllision that sender would continue.
(And no I haven't fully worked it the mask part of the protocol yet but some sort of stack/token system will be required)
I appreciate that the protocol will be complex, I can handle that, but I can't work out if the USART hardware can be coaxed into starting a byte at some precise interval following some event or other.
I am aware that I could probably bit bang this using interupts but don't want to go there if there is a way to trigger the TX accurately.
If anyone has any thoughts I would be greatful of the input.
Just as an asside... If I do this on standard IO I had wondered about using a passive clock and extending the pulse to encode a bit. That way all bits would have a pulse but the width would vary between null, 0 and 1.
Since everything would be seeing the same clock all bits would be inherently synchronised.
Not that I have the slightest idea right now as to the code required or maximum practical speed I could achieve by generating or measuring pulse width.
Thoughts?
Thanks,
Al