Support » Pololu Jrk USB Motor Controller User’s Guide » 4. Using the Serial Interface »
4.f. Error Reporting Commands
There are several errors that can stop the jrk from driving its motor. The jrk’s response to the different errors can be configured (Section 3.f).
Both of the error reporting commands result in a two-byte serial response form the jrk. Each bit in those two bytes represents a particular error. If the bit is 1, it means that the error occurred or is occurring. If we call the least-significant bit 0, and the first byte transmitted contains bits 0-7, then the correspondence between bits of the error bytes and errors are as follows:
- Bit 0: Awaiting command
If this bit is set, the jrk will not drive the motor until it receives a command that clears this bit. Any version of the Set Target command will clear the error bit. A Set Target command can be sent from the configuration utility, from a computer using the virtual Command Port (unless the jrk is configured to receive commands on RX), or from the RX line if the jrk is configured to receive commands on RX. This error occurs in Serial Input mode when the Jrk is powered on. - Bit 1: No power
This error occurs when the jrk is connected to USB, but it detects no motor power connected to VIN and GND, so it can not drive the motor. If this error occurs, check your power supply and power connections. - Bit 2: Motor driver error
This error occurs when one of the motor driver’s fault conditions are triggered, and the motor driver shuts down the motor and reports the error to the jrk’s microcontroller. This error also occurs when the jrk is connected to USB and motor power becomes disconnected. When this error occurs, the jrk will try to automatically recover from it by toggling the appropriate lines on the motor driver. The jrk 21v3’s motor driver fault occurs on under-voltage, over-temperature, or over-current conditions. The jrk 12v12’s motor driver fault occurs when it detects that motor output A is shorted to ground or VIN. - Bit 3: Input invalid (Pulse Width Input Mode only)
In Pulse Width Input Mode, the jrk will only update the input value if it has received four good pulses in a row. For example, if the jrk receives five good pulses, a bad pulse, and then five more good pulses, it will update the input value after pulses 4, 5, 10, and 11. This error occurs if the jrk goes more than 120 ms without updating the input value. The jrk can recover from the error by receiving four good pulses in a row. This error does not occur in Analog Input Mode or Serial Input Mode. - Bit 4: Input disconnect
This error occurs when the input is above the Absolute maximum or below the Absolute minimum (these parameters can be set in the configuration utility). Additionally, when using the Detect disconnect with AUX option in Analog Input Mode, the jrk periodically tests to see whether the input potentiometer is disconnected and generates this error if it finds that it is (Section 3.b). - Bit 5: Feedback disconnect
This error occurs when the feedback is above the Absolute maximum or below the Absolute minimum (these parameters can be set in the configuration utility). The absolute maximum and absolute minimum can be set using the configuration utility. Additionally, when using the Detect disconnect with AUX option in Analog Feedback Mode, the jrk periodically tests to see whether the feedback potentiometer is disconnected and generates this error if it finds that it is (Section 3.c). - Bit 6: Maximum current exceeded
This error occurs when the motor current limit is exceeded. The limit can be set using the configuration utility (Section 3.e). - Bit 7: Serial signal error
A hardware-level error that occurs when a byte’s stop bit is not detected at the expected place. This can occur if you are communicating at a baud rate that differs from the jrk’s baud rate. - Bit 8: Serial overrun
A hardware-level error that occurs when the UART receive buffer is full. This error should not occur during normal operation. - Bit 9: Serial RX buffer full
A firmware-level error that occurs when the firmware’s buffer for bytes received on the RX line is full and a byte from RX has been lost as a result. This error should not occur during normal operation. - Bit 10: Serial CRC error
This error occurs when the jrk is running in CRC-enabled mode and the cyclic redundancy check (CRC) byte at the end of the command packet does not match what the jrk has computed as that packet’s CRC (Section 4.d). In such a case, the jrk ignores the command packet and generates a CRC error. - Bit 11: Serial protocol error
This error occurs when the jrk receives an incorrectly formatted or nonsensical command packet. For example, if the command byte does not match a known command or an unfinished command packet is interrupted by another command packet, this error occurs. - Bit 12: Serial timeout error
When the serial timeout is enabled (Section 3.b), this error occurs whenever the timeout period has elapsed without the jrk receiving any valid serial commands. This timeout error can be used to shut down the motors in the event that serial communication between the jrk and its controller is disrupted. - Bits 13-15: Reserved
These bits do not represent any errors; they will always read as zeroes.
Get Error Flags Halting
Compact protocol: 0xB3
Pololu protocol: 0xAA, device number, 0x33
This command generates a two-byte serial response reporting which errors are currently stopping the motor, and it clears the corresponding error bits (except for the Awaiting Command error bit). This command is useful for determining why your motor is not turning, and for clearing any latched errors that are enabled. This command will not report any errors that have been disabled in the configuration utility, because those errors do not stop the motor.
This command is equivalent to reading the “Currently stopping motor?” column in the Errors tab of the configuration utility, and then clicking the “Clear Errors” button.
If an error is stopping the motor (besides the Awaiting Command error bit), the jrk will turn the red LED on and drive the ERR line high, and this command can be used to determine the cause of the error.
Get Error Flags Occurred
Compact protocol: 0xB5
Pololu protocol: 0xAA, device number, 0x35
This command generates a two-byte serial response reporting which errors have occurred since the last time the Get Error Flags Occurred command was received. Unlike the Get Error Flags Halting command, this command has no effect on the motor.
Note: If the jrk is connected to the configuration utility, then the Get Error Flags Occurred command will give unreliable responses, because the configuration utility runs this command regularly. This command will report all the errors that have occurred since the last time the Get Error Flags Occurred command was received, regardless of whether that last command came from the configuration utility, from your microcontroller, or from the jrk’s virtual Command Port.