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.

CSL USB Only half buffer transmitted

Hi.

There is quite some confusion with doing USB transfers correctly using C5515 (ezdsp kit) and CSL. In the help for CSL_confDmaTx there is the example:

#define CSL_USB_DATA_SIZE (256)
Uint16 usbDataBuf[CSL_USB_DATA_SIZE];
CSL_UsbHostPacketDescriptor hpdtx;
USB_initDma();
USB_initQueueManager(&hpdrx);
....
....
USB_confDmaTx(&hpdrx, CSL_USB_DATA_SIZE, usbDataBuf);

and for the 2nd parameter of confDmaTx there is the explanation: packetsize - Size of the packet to transmit (In Bytes).

But here CSL_USB_DATA_SIZE=256 bytes but usbDataBuf is 512 bytes?!? So how do I know what data is transmitted - is it the first half of usbDataBuf or is it 256 times the lower 8 bits in usbDataBuf, or the higher bits.

In my application I want to transmit 512 byte packets. I've copied some parts of the USB-DMA example code and adapted them for having wMaxPacketSize=512 bytes. I also have something like Uint16 my_usbDataBuf[512]; even if this is 1024 bytes. I've filled the buffer bytewise such that only the first half of my_usbDataBuf is filled with data. But in the end when I execute USB_confDmaTx and analyse USB communication with usblyzer, I realize that only 256 bytes are transmitted!

I guess there is another bug in the C55x-lowpower CSL with respect to this one? Or did I really miss something this time?

  • Hi Andreas,

    I suspect that you have an old version of the CSL because you reference USB_confDmaTx without the boolean swapWords argument.

    If so, download C55XCSL-LOWPOWER  v2.10.00.00 from http://software-dl.ti.com/dsps/dsps_public_sw/dsps_swops_houston/C55X/CSL-c55x-lowpower-versions.htm

    Here is how the function is called from within the CSL_USB_DmaExample:   USB_confDmaTx(&hpdtx, CSL_USB_EP1_PACKET_SIZE_FS, usbDataBuffer, FALSE);

    In this example CSL_USB_EP1_PACKET_SIZE_FS controls the size of the packet. CSL_USB_DATA_SIZE only controls the size of usbDataBuffer.

    CSL_USB_EP1_PACKET_SIZE_FS & CSL_USB_EP1_PACKET_SIZE_HS are defined in csl_usb.h to 64 bytes and 512 bytes, respectively.

    Please check your versions, try the example again, and get back to me if you still have the same problem.

    Thanks,
    Mark

  • Hi again Mark,

    As I've already replied in the other thread. I'm using v2.10. The fact that I didn't list the swapWords argument is that the code I've copied into my post is copy-pasted from the CSL API ref and not from my/USB-DMA example code. In the code I clearly have the swap-words argument and it is FALSE. I've set the packet size to 512 bytes.

    The problem is still here. Are you a 100% sure that if you request 512 bytes from the device that 512 bytes are sent by the device? Because if you are it might be a problem between (win-)libusb and the DSP.

    Thanks and regards,

    Andreas

  • Hi Andreas,

    How you are arranging the data in your buffer?. USB CSL copies the data from buffer to USB FIFO in 16 bit mode. You should fill the 16 byte data buffer with your first byte in the lower byte and next byte in the upper byte and so on. When you call the API USB_confDmaTx(&hpdrx, CSL_USB_DATA_SIZE, usbDataBuf); USB CSL will transfer 'CSL_USB_DATA_SIZE' number of bytes from the location usbDataBuf[0] to usbDataBuf[CSL_USB_DATA_SIZE/2] .

    Pratap.