Servo 1.0 protocol

From BitWizard WIKI
Revision as of 15:19, 5 February 2014 by Rew (talk | contribs) (write ports)

Jump to: navigation, search

Introduction

The protocol for the SERVO boards will be explained on this page.

This page describes both the SPI and the I2C version. See SPI versus I2C protocols for the explanation about how the protocols work in general.

The default address of the servo board is 0x86.

write ports

The ports on the servo board just set a single byte-value. So writing more than one byte to such a port is redundant.

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
0x28-0x2e set servo 0-6 position in microseconds. Don't set values larger than 2500. (if you do, funny things will happen if the total of all servos exceeds 20 miliseconds. Don't set the value too low. I expect you'll get pulses that are 20 miliseconds too long if you do.
0x30-0x36 set the default value for this servo. This value is used when the board is powered up. This value is stored in non volatile memory.
0x38-0x3e set the timeout value in tenths of a second. (5 = 0.5 seconds, 35=3.5 seconds). If no update of this servo is received within the timeout time, the servo will revert to the default value.
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

For SPI in the examples below, "data sent" means the data on the MOSI line, while "data received" means the data on the MISO line. when MISO reads "xx" you should ignore the data. When MOSI reads "xx" it doesn't matter what you send.

For I2C in the examples below, you should first initiate a "write" transaction with the data in the "data sent column". Don't send the "xx" bytes. Then you initiate a "read" transaction, and you will get the data in the "data received" column (and again not the "xx" bytes).

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.