Skip to content

Latest commit

 

History

History
95 lines (77 loc) · 2.18 KB

File metadata and controls

95 lines (77 loc) · 2.18 KB

#Communication Protocol - DRAFT

My current thinking is that it's best to make everything as general as possible, since the design in development.

Since the sensors we're using currently are I2C, I propose to map the I2C interface onto XBee. For that, we need two commands, read and write.

###I2C Write command format

Command ID (byte) Chip Address (byte) Chip register Address (byte) Value (byte)
0x01 Address of chip on I2C bus (0x00 - 0x7F) Address of register (on the chip) to write Value to write

Each field is a byte. They are sent sequentially and followed by a carriage return (0x0A in ASCII).

For example, the command:

Command ID Chip Address Chip register Address Value
0x01 0x53 0x2a 0x11

Yields 01 53 2a 11 0A

Support for multi-byte writes may be added as needed.

###I2C Read command format

Command ID (byte) Chip Address (byte) Chip register Address (byte) Number of bytes to read (byte)
0x02 0x53 0x2a 0x01

Again, these fields are bytes and are followed by a carriage return.

Example command:

Command ID Chip Address Chip register Address Number of bytes to read
0x02 0x53 0x2a 0x01

Yields 02 53 2a 11 0A

##To do

A message that deals with multiple samples. My current idea is that I think the Accel/Gyro chips have a FIFO. The can generate an interrupt when it is nearly full. Maybe define message that tell the Fio what to do when it gets a certain interrupt. Ex: "On interrupt 1, read 1024 bytes from I2C address 0x53, address 0x10"