5.b. 0x82: Get Error Byte

Compact protocol: 0x82
Pololu protocol: 0xAA, device ID, 0x02

The qik maintains an error byte, the bits of which, when set, reflect various errors that have been detected since the byte was last read using this command. If we call the least-significant bit 0, the bits of the error byte are as follows:

  • bits 0 – 2: unused
  • bit 3: Data Overrun Error
    A hardware-level error that occurs when serial data is received while the hardware serial receive buffer is full. This error should not occur during normal operation.
  • bit 4: Frame Error
    A hardware-level error that occurs when a byte’s stop bit is not detected at the expected place. This error can occur if you are communicating at a baud rate that differs from the qik’s baud rate.
  • bit 5: CRC Error
    This error occurs when the qik is running in CRC-enabled mode (i.e. the CRC-enable jumper is in place) and the cyclic redundancy check (CRC) byte added to the end of the command packet does not match what the qik has computed as that packet’s CRC. In such a case, the qik will ignore the command packet and generate a CRC error. See Section 6 for more information on cyclic redundancy checking.
  • bit 6: Format Error
    This error occurs when the qik receives an incorrectly formatted or nonsensical command packet. For example, if the command byte does not match a known command, data bytes are outside of the allowed range for their particular command, or an unfinished command packet is interrupted by another command packet, a format error will be generated.
  • bit 7: Timeout
    It is possible to use a configuration parameter to enable the qik’s serial timeout feature (see Section 5.c). When enabled, the qik will generate a timeout error if the timeout period set by the configuration parameter elapses. The timeout timer is reset every time a valid command packet is received.

An error will cause the red LED to light and the ERR pin to drive high until this command is called. Calling this command will clear the error byte, turn the red LED off, and set the ERR pin as high-impedance (causing it to be pulled low through the LED). If shutdown-on-error configuration parameter is set to 1, motors M0 and M1 will be stopped as a safety precaution when any of these errors occurs (see Section 5.c).