The Host and Device communicate by exchanging messages. Each message represents an operation or command. All communication is initiated by the Host and the Device sends a single message in reply to each command.
Messages sent from the Host to the Device are Requests, messages sent from the Device to the Host are Responses.
All multi-byte fields are sent little endian (LSB first) unless otherwise specified.
Each request message begins with a common header, zero or more byte of payload data, an end-of-message marker and then zero or more bytes of padding. The total message size must not exceed USB_READ_BUFFER_SIZE.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SOM | Token | Command | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Payload (if any) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / / \ Payload (if any) \ / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EOM | Padding (optional) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
SOM | The start of message identifier: START_OF_MESSAGE_ID |
Token | A token for the request. The same token will be returned in the response. Typically the host will increment the token with each request. |
Command | The Command identifier. |
Length | The length of the data included in the request. The valid range is 0 - 579 bytes. |
Payload | The payload data associated with the request. See each command type below for the specific format of the payload data. |
EOM | The end of message identifier: END_OF_MESSAGE_ID |
Padding | Extra padding. If present this should be filled with 0s. Padding can be added as long as the total message does not exceed USB_READ_BUFFER_SIZE. |
Responses use the same header as Requests, with an additional 2 bytes to indicate the return code and status flags.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | SOM | Token | Command | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Length | Return_Code | Status | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ / / \ Payload (if any) \ / / +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | EOM | Padding (optional) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
SOM | The start of message identifier: START_OF_MESSAGE_ID |
Token | The token that was provided in the corresponding request. |
Command | The Command identifier. |
Return_Code | The ReturnCode of the response. |
Status | The status bitfield. |
Length | The length of the data included in the command. The valid range is 0 - 579 bytes. |
Payload | The payload data associated with the command. See each command type below for the specific format of the payload data. |
EOM | The end of message identifier: END_OF_MESSAGE_ID |
Padding | Extra padding. If present this should be filled with 0s. Padding can be added as long as the total message does not exceed USB_READ_BUFFER_SIZE. |
Echo data back from the device. This serves as a basic test that Host to Device communications are working correctly.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Data (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data | 0 or more bytes of data. |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ Data (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Data | 0 or more bytes of data, to match what was provided in the request. |
Set the operating mode of the device. The device can operate as either a controller or a responder.
0 0 1 2 3 4 5 6 7 8 +-+-+-+-+-+-+-+-+-+ | Mode | +-+-+-+-+-+-+-+-+-+
Mode | The new mode to operate in. 0 for controller, 1 for responder. |
The response contains no data.
Get the hardware information for the device.
The request contains no data.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Model ID | UID | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | UID (cont.) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MAC Address | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | MAC Address (cont.) | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Model_Id | The JaRuleModel of the device. |
UID | The UID of the device, in network byte order. |
MAC | The MAC address of the device, in network byte order. If the device does not have a MAC this will be 0. |
Run the loopback self test. The device must be in self test mode to perform this.
The request contains no data.
The response contains no data.
Resets the device. This can be used to recover from failures.
The request contains no data.
The response contains no data.
Gets the current break time for outgoing DMX512 / RDM messages.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Break_Time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Break_Time | The current break time in microseconds. |
Sets the break time for outgoing DMX512 / RDM messages.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Break_Time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Break_Time | The new break time in microseconds. See Transceiver_SetBreakTime() for the range of values allowed. |
The response contains no data.
Gets the current mark-after-break time for outgoing DMX512 / RDM messages.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mark_Time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mark_Time | The current mark time in microseconds. |
Sets the mark time for outgoing DMX512 / RDM messages.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mark_Time | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Mark_Time | The new mark time in microseconds. See Transceiver_SetMarkTime() for the range of values allowed. |
The response contains no data.
Get the time the controller will wait for an RDM Response after sending a broadcast command.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Timeout | The current RDM broadcast timeout, in 10ths of a millisecond. |
Sets the time to wait for an RDM response after sending a broadcast RDM command. When set to a non-0 value, this allows us to detect responders that incorrectly respond to broadcast commands.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Timeout | The time to wait for a RDM response after a broadcast command, in 10ths of a millisecond. See Transceiver_SetRDMBroadcastTimeout(). |
The response contains no data.
Get the time that the controller will wait for an RDM Response after sending an RDM command.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Timeout | The current RDM response timeout, in 10ths of a millisecond. |
Sets the time to wait for a reply after a sending an RDM command.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Timeout | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Timeout | The time to wait for a RDM response after a broadcast command, in 10ths of a millisecond. See Transceiver_SetRDMResponseTimeout(). |
The response contains no data.
Get the maximum time a DUB response can take.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Limit | The maximum time a DUB response can take, in 10ths of a microsecond. |
Sets the time to wait for a reply after a sending an RDM command.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Limit | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Limit | The maximum time a DUB response can take, in 10ths of a millisecond. See Transceiver_SetRDMDUBResponseLimit(). |
The response contains no data.
Get the minimum time the responder waits before sending an RDM response.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Delay | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Delay | The current RDM responder delay, in 10ths of a microsecond. |
Sets the minimum time the responder waits before sending an RDM response.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Delay | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Delay | The minimum time to wait before sending an RDM response, in 10ths of a microsecond. See Transceiver_SetRDMResponderDelay(). |
The response contains no data.
Get the maximum jitter to use when sending RDM responses.
The request contains no data.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Jitter | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Jitter | The current RDM responder jitter, in 10ths of a microsecond. |
Set the jitter to use when sending RDM responses.
0 1 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Jitter | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Delay | The jitter to use when sending an RDM response, in 10ths of a microsecond. See Transceiver_SetRDMResponderJitter(). |
The response contains no data.
Sends a single DMX512, Null Start Code frame.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ DMX_Data (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
DMX_Data | The DMX512 slot data, excluding the start code. The number of slots may be 0 - 512. |
The response contains no data.
Sends a RDM discovery unique branch command and then listens for a response. If any data is received, it is returned in the response payload. If no data is received a RC_RDM_TIMEOUT is returned.
The response payload includes timing data.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ DUB_Command \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
DUB_Command | The RDM Discovery Unique Branch command, excluding the start code. The command should be 37 bytes. |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Discovery_Start | Discovery_End | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ RDM_DUB_Response (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Discovery_Start | the time from the end of the transmitted DUB frame to the start of the DUB response, in 10ths of a microsecond. Undefined unless RC_OK was returned. |
Discovery_End | the time from the end of the transmitted DUB frame to the end of the DUB response, in 10ths of a microsecond. Undefined unless RC_OK was returned. |
RDM_DUB_Response | The raw response, if any was received. |
Sends a broadcast RDM Get / Set command. If the Broadcast Listen Delay is not 0, the transceiver will then listen for a response. If a response is received, it will be returned in the response payload.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ RDM_Command \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RDM_Command | The broadcast RDM Get / Set command, excluding the start code. |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Break_Start | Break_End | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mark_End | RDM_Response (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ RDM_Response (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Break_Start | the time from the end of the transmitted RDM frame to the start of the break, in 10ths of a microsecond. Undefined unless RC_RDM_BCAST_RESPONSE was returned. |
Break_End | the time from the end of the transmitted RDM frame to the end of the break / start of the mark, in 10ths of a microsecond. Undefined unless RC_RDM_BCAST_RESPONSE was returned. |
Mark_End | the time from the end of the transmitted RDM frame to the start of the mark, in 10ths of a microsecond. Undefined unless RC_RDM_BCAST_RESPONSE was returned. |
RDM_Response | The RDM response, if any was received. |
Send a RDM Get / Set command and listen for a response. If a response is received, it will be returned in the response payload.
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ RDM_Command \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RDM_Command | The RDM Get / Set command, excluding the start code. |
0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Break_Start | Break_End | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Mark_End | RDM_Response (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ \ RDM_Response (variable size) \ +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Break_Start | the time from the end of the transmitted RDM frame to the start of the break, in 10ths of a microsecond. Undefined unless RC_OK was returned. |
Break_End | the time from the end of the transmitted RDM frame to the end of the break / start of the mark, in 10ths of a microsecond. Undefined unless RC_OK was returned. |
Mark_End | the time from the end of the transmitted RDM frame to the start of the mark, in 10ths of a microsecond. Undefined unless RC_OK was returned. |
RDM_Response | The RDM response, if any was received. |
If the device receives a command ID that is doesn't recognize it will return RC_UNKNOWN.
Communication with the Ja Rule device happens over a custom endpoint.
The maximum packet size (wMaxPacketSize) for the USB device is 64 bytes. This is the largest packet size for a full speed, bulk endpoint. The RX buffer must be a multiple of the maxPacketSize. Since the largest payload data size is 513 bytes, we'll set the RX buffer size to 640 (64 * 10).
On the Microchip RX side, the USB_DEVICE_EVENT_ENDPOINT_READ_COMPLETE event will be triggered if either:
libusb on Linux supports a Zero Length Packet (ZLP) flag, which will automatically send a zero length packet if a transfer ends on a wMaxPacketSize boundary. Other host OS's don't seem to support this, so the host side will need to manually pad the message to trigger the USB_DEVICE_EVENT_ENDPOINT_READ_COMPLETE event.