SDAA062 September   2025 TMS320F28P559SJ-Q1

 

  1.   1
  2.   Abstract
  3.   Trademarks
  4. 1Introduction
    1. 1.1 Intelligent Cabin and IVI System
    2. 1.2 USB Interface Application in IVI
    3. 1.3 TMS320F28P55x Introduction
  5. 2USB Composite Device Enumeration and Data Report
    1. 2.1 USB Composite Device Enumeration
      1. 2.1.1 Descriptor Structure
      2. 2.1.2 Descriptor Types
        1. 2.1.2.1 Device Descriptor
        2. 2.1.2.2 Configuration Descriptor
        3. 2.1.2.3 Interface Descriptor
        4. 2.1.2.4 Endpoint Descriptor
        5. 2.1.2.5 String Descriptor
    2. 2.2 USB Composite Device HID Data Report
      1. 2.2.1 Data Report Item
      2. 2.2.2 HID Report Descriptor Structure
        1. 2.2.2.1 Main Item
        2. 2.2.2.2 Global Item
        3. 2.2.2.3 Local Item
    3. 2.3 Example of Building a HID Report Descriptor
  6. 3Software Realization
    1. 3.1 APIs for USB Composite Device Initialization
      1. 3.1.1 USBStackModeSet
      2. 3.1.2 USBDCDCCompositeInit
      3. 3.1.3 USBDHIDCustomCompositeInit
      4. 3.1.4 USBDCompositeInit
    2. 3.2 APIs for USB Composite Device CDC Data Report
      1. 3.2.1 USBBufferSpaceAvailable
      2. 3.2.2 USBBufferWrite
      3. 3.2.3 USBBufferRead
      4. 3.2.4 USBDCDCTxHandler
      5. 3.2.5 USBDCDCRxHandler
    3. 3.3 APIs for USB Composite Device HID Data Report
      1. 3.3.1 USBDHIDCustomTouchEvent
      2. 3.3.2 USBDHIDCustomReportKey
    4. 3.4 APIs for USB Composite Device Simulation
      1. 3.4.1 MultTouchSimHandler
      2. 3.4.2 KeySimHandler
    5. 3.5 APIs for USB Device Operate States Query
      1. 3.5.1 USBDCDCControlHandler
      2. 3.5.2 CustomHandler
  7. 4System Test
    1. 4.1 Test Setup
    2. 4.2 USB SCI CDC Device Function Test
    3. 4.3 USB Touch Screen HID Device Function Test
    4. 4.4 USB Button HID Device Function Test
  8. 5Summary
  9. 6References
  10. 7Appendix

Appendix

USB Full Speed Transmission Limitation and Workaround

The USB full speeds only allows maximum 64 bytes data transmission in one package. If there are multiple package transmissions required such as with HID touch screen data, TxPktRdy cannot be cleared by the hardware in time. This causes data loss during multiple package transmissions.

Related Code

usbdenum.c:USBDEP0StateTx()[2580]: 
g_psDCDInst[0].iEP0State = eUSBStateTx;
if(ui32NumBytes > EP0_MAX_PACKET_SIZE)
 ui32NumBytes = EP0_MAX_PACKET_SIZE;
pui8Data = (uint8_t *)g_psDCDInst[0].pui8EP0Data;
g_psDCDInst[0].ui32EP0DataRemain -= ui32NumBytes;
g_psDCDInst[0].pui8EP0Data += ui32NumBytes;
USBEndpointDataPut(USB_BASE, USB_EP_0, pui8Data, ui32NumBytes);
usb.c:USBEndpointDataPut()[2806]: 
if(HWREGB(ui32Base + USB_O_CSRL0 + ui32Endpoint) & ui8TxPktRdy) 
 return(-1);

Workaround

Add enough delay cycle to make sure the TxPktRdy is cleared by the hardware correctly.

Related Code

if(HWREGB(ui32Base + USB_O_CSRL0 + ui32Endpoint) & ui8TxPktRdy)
{
 for (ui8Timeout = 0; ui8Timeout < 5; ui8Timeout++) {
 USBDelay(1);
 if(!(HWREGB(ui32Base + USB_O_CSRL0 + ui32Endpoint) & ui8TxPktRdy))
 {
 break;
 }
 }
 if(HWREGB(ui32Base + USB_O_CSRL0 + ui32Endpoint) & ui8TxPktRdy)
 {
 //Force clean rdy bit
 HWREGB(ui32Base + USB_O_CSRL0 + ui32Endpoint) &= ~ui8TxPktRdy;
 }
}