Difference between revisions of "Servo 1.0 protocol"

From BitWizard Wiki
Jump to navigation Jump to search
(No difference)

Revision as of 16:21, 11 May 2012

The addresses on the SPI bus are 7 bits wide. The lower bit specifies if the transaction is to be a read or a write. Write transactions have the lower bit cleared (0), read transactions have the lower bit set (1).

Each transaction on the SPI bus starts with the address of the board. The spi_servo board will ignore any transactions on the SPI bus that do not start with its own address.

After the address a single byte indicates the "port" on the board that the data is written to. The software can thus define 256 ports on each board.

The default address of the servo board is 0x86.

write ports

Some ports just set a single value. So writing more than one byte to such a port is redundant. Other ports are logically a stream of bytes. So writing more than one byte is encouraged.

The spi_servo board defines several ports.

port function
0x20 Set servo 0 position
0x21 Set servo 1 position
0x22 Set servo 2 position
0x23 Set servo 3 position
0x24 Set servo 4 position
0x25 Set servo 5 position
0x26 Set servo 6 position
0xf0 change address.

read ports

The spi_servo board supports two read ports:

port function
0x01 identification string. (terminated with 0).
0x20 read servo 0 position
0x21 read servo 1 position
0x22 read servo 2 position
0x23 read servo 3 position
0x24 read servo 4 position
0x25 read servo 5 position
0x26 read servo 6 position

examples

read identification

read the identification string of the board. ('spi_servo 1.0').

data sent data recieved explanation
0x87 xx select destination with address 0x82 for READ.
0x01 xx identify
xx 0x73 's'
xx 0x70 'p'
xx 0x69 'i'
xx ... etc.