Master Firmware

The master firmware encapsulate the entire wireless protocol and all of the details thereof directly onto one chip that is easily interfaced with, for example, an Arduino via the two pins required for TWI.

While the main program is fairly self-explanatory, handling incoming and outgoing commands, some care should be put into documenting the serial data format that is needed to communicate with the device via TWI. This protocol is slightly different from the wireless protocol — a little more abstract and less concerned with check-sums and small data sizes.

+------+---------+--------------+---------------+-----------+-------------------------+
| type | command | srcAddress   | targetAddress | data size | data bytes (up to four) |
+------+---------+--------------+---------------+-----------+-------------------------+

The above outlines the bytes that compose the command format. This format is utilized bi-directionally to send command to and from the master “backpack” device. In detail:

TYPE

The type of the command. This introduces three new command types:

N – (NO_OP) – sent back if the TWI master (i.e. the Arduino) requested data but no incoming data was available.

L – (LOCAL) – local commands are NOT sent wirelessly but meant to be interpreted locally. This allows the Arduino to set the device id of the backpack module (0xF -> master, anything else slave) and to reset the backpack.

R – (REMOTE) – business as usual, the command will be relayed via RF to the remote sensor

COMMAND

Byte code of the command to be executed.

SRCADDRESS, TARGETADDRESS

The source and target addresses of the devices. Currently the source field is ignored and only meant for future use. The device ID of the backpack is automatically added to the rf command. While these are 8-bit values, only the lower four are used.

DATA SIZE, DATA

Number of data bytes and data bytes.

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!