SLAU855A June 2021 – March 2022 TLV320AIC3101 , TLV320AIC3104 , TLV320AIC3104-Q1 , TLV320AIC3105 , TLV320AIC3106 , TLV320AIC3106-Q1 , TLV320AIC3107 , TLV320AIC3109-Q1 , TLV320AIC34
The USB-MODEVM is defined as a vendor-specific class, and is identified on the PC system as an NI-VISA device. Because the TAS1020 has several routines in its ROM that are designed for use with HID-class devices, HID-like structures are used, even though the USB-MODEVM is not an HID-class device. Data are passed from the PC to the TAS1020 using the control endpoint.
As Table 3-3 describes, data are sent in an HIDSETREPORT.
Part | Value | Description |
---|---|---|
bmRequestType | 0x21 | 00100001 |
bRequest | 0x09 | SET_REPORT |
wValue | 0x00 | don't care |
wIndex | 0x03 | HID interface is index 3 |
wLength | calculated by host | |
Data | Data packet as described below |
Table 3-4 lists the bytes that comprise the data packet.
Byte Number | Type | Description | ||
---|---|---|---|---|
0 | Interface | Specifies the serial interface and operation. The two values are logically OR'd. | ||
Operation: | ||||
READ | 0x00 | |||
WRITE | 0x10 | |||
Interface: | ||||
GPIO | 0x08 | |||
SPI_16 | 0x04 | |||
I2C_FAST | 0x02 | |||
I2C_STD | 0x01 | |||
SPI_8 | 0x00 | |||
1 | I2C slave address | Slave address of the I2C device or the MSB of the 16-bit register address for SPI | ||
2 | Length | Length of data to write/read (number of bytes) | ||
3 | Register address | Address of the register for I2C or 8-bit SPI; LSB of the 16-bit address for SPI | ||
4...64 | Data | Up to 60 data bytes can be written at a time. EP0 maximum length is 64. The return packet is limited to 42 bytes, so advise only sending 32 bytes at any one time. |
Example usages:
Write two bytes (AA, 55) to the device starting at register 5 of an I2C device with address A0:
[0] 0x11
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
Do the same with a fast mode I2C device:
[0] 0x12
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
Now do the same with an SPI device that uses an 8-bit register address:
[0] 0x10
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
Do the same process for a 16-bit register address, as found on parts like the TSC2101. Assume the register address (command word) is 0x10E0:
[0] 0x14
[1] 0x10
The I2C address now serves as the MSB of the register address.
[2] 0x02
[3] 0xE0
[4] 0xAA
[5] 0x55
In each case, the TAS1020 returns, in an HID interrupt packet, the following:
[0] | interface byte | status | |||
status: | ||||
REQ_ERROR 0x80 |
||||
INTF_ERROR 0x40 |
||||
REQ_DONE 0x20 |
||||
[1] | For I2C interfaces, the I2C address is as sent | |||
For SPI interfaces, the read back data from the SPI line for transmission of the corresponding byte is as sent | ||||
[2] | Length is as sent | |||
[3] | For I2C interfaces, the register address is as sent | |||
For SPI interfaces, the read back data from the SPI line for transmission of the corresponding byte is as sent | ||||
[4..60] | The echo of the data packet is sent |
If the command is sent with no problem, the returning byte [0] must be the same as the sent one logically or'd with 0x20. In the first example usage, the returning packet is:
[0] 0x31
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
If for some reason the interface fails (for example, the I2C device does not acknowledge), the returning byte comes back as:
[0] 0x51
→ interface |
INTF_ERROR
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
If the request is malformed, that is, the interface byte (byte [0]) takes on a value that is not described above, the return packet is:
[0] 0x93
→ the user sent 0x13,
which is not valid, so 0x93 is returned
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
The examples above used writes. Reading is
similar:
Read two bytes from the device starting
at register 5 of an I2C device with address A0:
[0] 0x01
[1] 0xA0
[2] 0x02
[3] 0x05
The return packet is:
[0] 0x21
[1] 0xA0
[2] 0x02
[3] 0x05
[4] 0xAA
[5] 0x55
This result is assuming that the values written above starting at register 5 were actually written to the device.