Communications Standard

SOR Community Project Communications Standard


Communication Between Microcontroller Based Modules.

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:

i2c slave nodes should not be able to initiate communication.
i2c master nodes should be able to send and request information to and from other i2c master nodes, i2c slave nodes and nodes not on the i2c bus.
Nodes not on the i2c bus should be able to send to i2c master nodes, i2c slave nodes and other nodes not on the i2c bus.

Data sent on the bus needs to be determined by the destination module's designer. The design is also required to submit API code for use with the module so that the information is easy to use on the main control unit. The format of the data transmissions does not need to follow any specific form but does however need to comply to the standards of I2C and include The address for the module in question. Both the code for the module and the API needs to incorperate an method to change the address of the module easily but should have a default address assigned to it.


When information comes from a node not on the i2c bus the address will be obtained from the transmitted packet.
If this address is the i2c master node directly connected to the node in question then the data is handled locally.
If on the other hand it is a different address, the data will be transmitted on the i2c bus with the address in the packet as the destination.

When information is destined for a node not on the i2c bus things are a little more complex.
The transmitted packet should contain 2 addresses. The 1st address should contain the address of the i2c master node to which the destination connected. The 2nd address should contain the address of the destination node. (Provision should be made for more than one non i2c node connected to each i2c master.)


Example data packets:
~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.)