This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

USB data transfer seems to be limit to 64 byte, configuration being missed?

tm4c129x and bulk transfer and device

I have RTOS CDCHost (provided by TI, Ralph)  and CDC Device which work great except there seems to be a limit setting that is set to 64. Anytime I transmit 65 byte the device is not getting it or the host is not sending it. I don't see anything in the lib files to limit transmit/ Receive, am I missing it?

Rob 

  • Inside the TivaWare usblib/device/usbdcdc.c there are the following defines:

    //*****************************************************************************
    //
    // Maximum packet size for the bulk endpoints used for serial data
    // transmission and reception and the associated FIFO sizes to set aside
    // for each endpoint.
    //
    //*****************************************************************************
    #define DATA_IN_EP_MAX_SIZE     USBFIFOSizeToBytes(USB_FIFO_SZ_64)
    #define DATA_OUT_EP_MAX_SIZE    USBFIFOSizeToBytes(USB_FIFO_SZ_64)
    
    #define DATA_IN_EP_MAX_SIZE_HS  USBFIFOSizeToBytes(USB_FIFO_SZ_512)
    #define DATA_OUT_EP_MAX_SIZE_HS USBFIFOSizeToBytes(USB_FIFO_SZ_512)
    
    #define CTL_IN_EP_MAX_SIZE      USBFIFOSizeToBytes(USB_FIFO_SZ_16)
    

    And the USBDCDCCompositeInit() functions has the following:

        //
        // Get the Feature set for ULPI
        //
        USBDCDFeatureGet(0, USBLIB_FEATURE_USBULPI, &ui32ulpiFeature);
    
        g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_64);
    
        //
        // The CDC serial configuration is different for composite devices and
        // stand alone devices.
        //
        if(psCompEntry == 0)
        {
            psInst->sDevInfo.ppsConfigDescriptors = g_ppCDCSerConfigDescriptors;
    
            if(USBLIB_FEATURE_ULPI_HS == ui32ulpiFeature)
            {
                psInst->sDevInfo.ppsConfigDescriptors = g_ppCDCSerConfigDescriptorsHS;
                g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_512);
            }
        }
        else
        {
            psInst->sDevInfo.ppsConfigDescriptors = g_pCDCCompSerConfigDescriptors;
            if(USBLIB_FEATURE_ULPI_HS == ui32ulpiFeature)
            {
                psInst->sDevInfo.ppsConfigDescriptors = g_pCDCCompSerConfigDescriptorsHS;
                g_ui16MaxPacketSize = USBFIFOSizeToBytes(USB_FIFO_SZ_512);
            }
        }
        psInst->sDevInfo.ppui8StringDescriptors = 0;
        psInst->sDevInfo.ui32NumStringDescriptors = 0;
    

    And the USBDCDCPacketWrite() function has the following check:

        //
        // Can we send the data provided?
        //
        if((ui32Length > g_ui16MaxPacketSize) ||
           (psInst->iCDCTxState != eCDCStateIdle))
        {
            //
            // Either the packet was too big or we are in the middle of sending
            // another packet.  Return 0 to indicate that we can't send this data.
            //
            return(0);
        }
    

    If the TM4C129 USB controller is using the internal phy then it is a USB full-speed (12 Mbits/s) and the above code will select a maximum packet size for CDC of 64 bytes.

    To get a maximum packet size of 512 bytes requires an external PHY through ULPI interface to get a USB high speed connection (480 Mbits/s).

  • Thanks I found that in the code this morning and rebuild lib with 512 values and now it works as I need.