DLPU018J October 2014 – June 2024 DLPC900
The USB 1.1 HID protocol has the structure shown in Figure 1-4. The host must build a stream of bytes that consist of the Report ID, Header, and the payload. The following is a description of these three parts.
Report ID: The Report ID is always set to 0x0 and always the leading byte of all transfers.
Header: The header consists of four bytes.
1) Flag Byte: Shown in Figure 1-4 and described in the Read and Write examples in Section 1.2.2 and Section 1.2.3.
2) Sequence Byte: The sequence byte can be a rolling counter and is used primarily when the host wants a response from the DLPC900. The DLPC900 responds with the same sequence byte that the host sent. The host can then match the sequence byte from the command it sent with the sequence byte from the DLPC900 response.
3) Length: Two bytes in length, this denotes the number of data bytes in the Payload only.
Payload Bytes: The payload bytes consist of the USB command followed by the data that is associated with the command.
During a Write operation, the host transmits the entire transaction sequence to the DLPC900, and the DLPC900 performs the operation associated with the Write command. During a Read operation, the host transmits the entire transaction sequence to the DLPC900, and the DLPC900 performs the operation associated with the Read command. Therefore, both Write and Read transactions are considered writes to the DLPC900 where the host performs an API level Writefile to the HID driver. The difference is when the DLPC900 executes a Read operation, where the DLPC900 places the response into its internal buffer and waits for the host to perform an API level Readfile to the HID driver and only then does the DLPC900 transmit the response data back to the host.
The DLPC900 internal command buffer has a maximum of 512 bytes and it is shared between both the Write and Read operations; therefore, whenever the host performs a Read operation, it must be followed by the Readfile to the HID driver to get the response otherwise the response data is overwritten by the next Write or Read operation.
The HID protocol is limited to 64 byte transfers in both directions. Therefore, commands that are larger than 64 bytes require multiple transfers. Whenever such a command is used, only the very first transfer requires the Header and the USB Command. The Report ID is always the leading byte of all transfers. Figure 1-5 shows an example of a Write command that contains 76 bytes and requires two transfers. Notice that the first transfer contains 65 bytes, which is correct. The host hardware level HID driver extracts the Report ID before transmitting or receiving the data over the USB bus.