Communication between microcontroller based modules should primarily be done over a multi-master i2c bus. There are 2 classes of i2c device: slave and master. The
speed of the bus will be set to a standard 100 kHz. This will also be
easily modified in source code for advanced users to change when needed. As
we are implementing a multi-master i2c bus, both master and slave
devices should accept incoming transmissions from a master on the bus.
Master devices should always have UART pins exposed and the option of outputting debug info where practical.
A subset of i2c bus masters called "routers" should be able to route packets to an output other than the i2c bus, eg the UART.
This
subset of i2c bus masters should also be able to receive an incoming
packet over an input other than the i2c bus (eg. UART) and route it to
the i2c bus.
Consider the following diagram:
~A001~B002~S~L004~dData
~A001 Addresses the packet to node 001.
~B002
(Optional) If the packet arrives at a master node and ~B exists and is
not equal to 000 then the master node (in this example 001) will
consult a lookup table to see which UART (or other port) to send the
packet out of.
~S Signifies that this packet is being Sent (ie, this is an i2c write).
~L004 Signifies the length of the data contained in the packet. (In this case, 4 bytes long.)
~d Signifies the start of the packet content (or data).
~A001~S~0100~1101~2102
~A001 Addresses the packet to node 001.
~S Signifies that this packet is being Sent (ie, this is an i2c write).
~0100 1st data byte sent has value "100"
~1101 2nd data byte sent has value "101"
~2102 3rd data byte sent has value "102"
~A001~R
~A001 Addresses the packet to node 001.
~R Signifies this packet is Reading data from node 001. (ie, an i2c read.)