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.

CCS/tm4c123gh6pm: usb_host_cdc read data from device

Part Number: TM4C123GH6PM


Tool/software: Code Composer Studio

HI TI,

                                                       tm4c123xgl, usb_host_cdc, ui32Interval

I am working on USB_HOST_CDC, thanks for the previous thread e2e.ti.com/.../.

Now TM4C123XGL can send data to device through USB BULK_OUT endpoint, which I am able to monitor on a PUTTY terminal  connected to the device UART port.

The device has been programed to echo back all the data received from host. However, TM4C123XGL has trouble to read data from  USB BULK_IN endpoint.

I followed usbhhid.c, which reads out packets using USBHHIDGetReport(), in which the packet is actually read out by USBHCDPipeReadNonBlocking(). Therefore, I wrote

uint32_t USBHCDCGetChars(unsigned char *pucData, uint32_t ulSize)
{
    uint32_t Size;
    Size = USBHCDPipeReadNonBlocking(g_USBHCDCDevice.ui32BulkInPipe, pucData, ulSize);
    return(Size);
}

The problem is TM4C123XGL only collected portion of the data. According to USBHCDPipeConfig (also defined in usbhostenum.c like USBHCDPipeReadNonBlocking) value of ui32Interval for Bulk ranges within [2 - 16], which actually is the interval when TM4C123xgl host can read data from BULK_IN endpoint. For example, if setup ui32Interval=2, USBHCDPipeReadNonBlocking will obtain every odd sets of data, and for even sets just return 0; while setup ui32Interval=8, it will only get 1 from every 8 sets of data.

Please advise, thanks in advance.

Mike

  • Hi Mike,

    Honestly, I'm not entirely sure what is missing. We don't have many host examples to begin with and I am not familiar with the device in host mode. Looking through the API's you referenced didn't indicate to me why the behavior you are observing is occurring.

    Have you tried looking into the USBHCDPipeSchedule API at all? That seems like it is used for receiving data as it needs a pointer to a buffer to store data that is received. The other thread mentioned issues with USBHCDPipeReadNonBlocking as well so I am not sure I am convinced that is the right API to use for your application. I am not sure if there is a difference between reading out a 'report' versus reading out the data you want to. But the PipeSchedule API is used by HIDIntINCallback, which seems to be an RX based API for interrupts that is more generalized that just reading a 'report'.

    That's the best lead I can give you for the moment, but please continue to update as you try this API and I'll continue to see if I can still manage to help guide you through to a solution in the end.
  • find solution from
    e2e.ti.com/.../622138

    thanks Ralph