Indicator leds – Pololu Wixel User Manual
Page 42
‘S’, 0xEE, 2, 0xF4, 0x2E, ‘P’
To read a two-byte value from register 0xF6 on the same device, whose read address would be 0xEF, the following
sequence could be issued (the second ‘S’ generates a repeated START):
‘S’, 0xEE, 1, 0xF6, ‘S’, 0xEF, 2, ‘P’
The Wixel would respond with the two data bytes read from the slave.
Any invalid or unrecognized command is ignored and causes the Invalid Command error bit to be set.
To prevent an unfinished command sequence from leaving the I²C bus in an unusual state, this app will time out and
reset the bus if a byte is not received on the serial interface within 500 ms of the last byte. After this happens, the
Command Timeout error bit will be set, and a new command sequence must be initiated with a START command.
The command timeout delay can be changed with the cmd_timeout_ms parameter; a value of 0 disables this timeout.
If the Wixel receives a Get Errors command (‘E’), it will respond with a single byte containing the status of several
error conditions. This command can be issued any time the app is not expecting a slave address or data byte.
When an error occurs, the corresponding bit in the error byte is set and remains set until the errors are read with
the Get Errors command, after which it is cleared internally. The following table shows the error condition that
corresponds to each bit:
Bit
Error
Description
0
(LSB)
I²C
NACK on
Address
A NACK was received on the I²C bus after a slave device address was transmitted.
1
I²C
NACK on
Data
A NACK was received on the I²C bus after a data byte was transmitted.
2
I²C
Timeout
The SCL line stayed low for too long (possibly because a slave device was holding it low) and
the I²C bus was reset. The allowed delay until this timeout occurs is 10 ms by default and can
be changed with the I2C_timeout_ms parameter.
3
Invalid
Command
An invalid command byte was received on the serial interface.
4
Command
Timeout
The next byte of an unfinished command sequence took too long to be received on the
serial interface. The timeout is 500 ms by default and can be changed or disabled with the
cmd_timeout_ms parameter.
5
UART
Overflow
The UART’s receive buffer is full.
6
UART
Framing
Error
A framing error occurred on the UART.
Indicator LEDs
The
green
LED behaves as described in
, and also flickers when there is data transferred over USB.
Pololu Wixel User's Guide
© 2001–2014 Pololu Corporation
9. Wixel Apps
Page 42 of 64