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.

TMS320C5535: Maximum USB DMA transfer speed.

Part Number: TMS320C5535

Hello,

I am using TMS320C5535 DSP processor. I have configured USB DMA transfer which is working fine. I am getting transfer speed up to 5.7Mbps. I want to increase the DMA tx speed up to 8~10Mbps. Is there any way to achieve this much of speed?

  • I want to know what is the maximum DMA transfer queue I can use?
  • What is the maximum speed I can get with the USB DMA transfer?

I am using USB operating mode CSL_USB_OPMODE_DMA_TXONLY with USB 2.0 specifications as I want to copy data from device to host PC via USB DMA. The customized device has on board EMMC chip. The EMMC interfaced with TMS320C5535 DSP can give maximum 30Mbps speed for sequential read.

Please help me to achieve the high speed.

Thank you in advance,

Kishan

  • Hi Kishan,

    I went through your code. I really confused with the the following section in USR_Isr():

        if(hUsbDev->dwIntSourceL & CSL_USB_TX_INT_EP2)
        {
            /* Flush the FIFO to clean any data already present in the Tx FIFO */
            USB_flushFifo(CSL_USB_EP2, 1);

            intEp = CSL_USB_TX_INT_EP2;

    #if (defined(CHIP_C5505_C5515) || defined(CHIP_C5504_C5514) || defined(CHIP_C5517) || defined(CHIP_C5535) || defined(CHIP_C5545))
            USB_confDmaTx(CSL_USB_EP1, &hpdtx, usb_income_num_bytes_ep2, usbDataBuffer1, FALSE);
    #else
            USB_confDmaTx(CSL_USB_EP1, &hpdtx, usb_income_num_bytes_ep1, usbDataBuffer1, TRUE);
    #endif
           // USB_dmaTxStart(CSL_USB_EP2);

            usb_transmit_complete_cb();

        }

     First of all, it looks like the USB DMA code, because you are calling the USB_confDmaTx(). On the other hand, it also look like a the CPU pulling code, because the usage of the USB_flushFifo().

    Secondly, the USB_confDmaTx() is using the CSL_USB_EP1 when CSL_USB_TX_INT_EP2 received.

    Thirdly, I did not see the connection between the EMMC read and the USB IN (TX). 

    I am assuming you are using the DSP/BIOS for your project

    Finally, make sure when call the USB_confDmaTx() the byteswap (last parameter) is FALSE, because the byte swap is very time consuming. You can use the flag in EMMC read to change the byte order and save the byte swapping.

    Best regards,

    Ming

  • Hi Ming,

    I used DMA_TX_ONLY mode. There is a code when device receives it will be USB polling and if device is sending it will use DMA mode.

    I am checking the second point you mentioned. I have checked the byte swapping and there DMA does not do byte swapping. The third point connection between EMMC read and USB IN (TX) is made by send_data_to_host function implemented in mtp.c. Further I am checking the flow and EP configuration when to use which one.

    Thank you,

    Kishan

  • Hi Kishan,

    I found the USB MSC example using multiple CDMA descriptors. Please look for the macro MULTICDMA and CDMANUM in the attached code. It is use a task to handle the USB transactions instead of using the USB_Isr directly, but the principle is the same. As I recall, the multiple CDMA did speed up the USB MSC throughput significantly, because we use the 8KB for SD read.

    Best regards,

    Ming

    4606.USB_Example4_6_PG2.0_20100823_001.zip

  • Hi Ming,

    I am checking the new example you shared. I will tell you the results tomorrow.

    Thank you,

    Kishan

  • Hi Ming,

    I have few questions. The USB MSC example you shared has the functionality of queuing packets same as implemented in the mtp.c code in the function "send_data_to_host". There can be confusion because the project had the USB MSC layer and later I pulled out that layer and implemented the USB DMA layer on top of that put the MTP layer on USB DMA. So when I check with the USB MSC with 8KB buffer size it does not hangs while going with USB DMA it does not go beyond 5KB. I also checked USB MSC with the 12KB buffer size there also it does not hang. Is there any configurations required to change in the USB DMA code in the project? Once the DMA completes the transfer it will return the queue number right? I check the queue completion once the return queue number is the last queue number I reconfigure the DMA queue to send the next bunch of packets. but fails when buffer is larger than 5KB.

    Thank you,

    Kishan

  • Hi Kishan,

    I do not recall any restrictions on USB DMA, as long as the USB transmission count is divisible by 4. Here we use CDMANUM*512, so it is not a problem at all. 

    I recall there is a small delay between the the completion queue return and the actual USB DMA completion. My guess is it is not showing in USB MSC example, because there is a SD card read between the last packet completion and the first packet queue of the next 8 KB transmission.

    The return of the completion queue is the addresses of the descriptors without the least significant 4 bit. You need to keep popping the completion queue until it is empty every time, because it may be more than one completion descriptors in the queue.

    In the hung case, how many completion queue returns you got? You should get 16 for each transmission.

    Best regards,

    Ming

  • Hi Ming,

    I tried a different approach and the speed increased to 6MBps. What I did is read 10KB data and did the transmission of 5KB data so doing DMA twice. I am on it to get the sent address and count from the queue. I will share the values of the queue descriptors.

    Thank you,

    Kishan

  • Hi Kishan,

    I am curious to know if you increase the EMMC read buffer to 20KB and do 4 times USB DMA, will the performance increase significantly?

    Best regards,

    Ming

  • Hi Ming,

    Yes, it increased the speed, I have read the 20KB data from EMMC(20KB per read) and tried to send over USB DMA by doing it for times (5KB*4USB DMA= 20KB). It was nearly 6.4MBps. Later I have the memory so I increased per read from 20KB to 25KB and did 5 times USB DMA. The speed now I get is 6.8-7.0MBps.

    Thank you,

    Kishan 

  • Hi Kishan,

    Great progress!

    Due to the SD card DMA and USB CDMA cannot be used at the same time (potential hardware bug), using ping-pong buffer for SD card read and USB TX will lock up the USB CDMA, so I think this is the best you can get, unless you can increase the EMMC read buffer to 30KB or larger.

    Best regards,

    Ming

  • Hi Ming,

    I have increased buffer to 30KB now I am able get speed 7.0~7.3MBps. But I have a question, Micron says that EMMC is capable that it can give 30MBps speed, However there are few timings setup done for EMMC read and write in the code right now . As per my understanding the csl_mmcsd.c driver is written such a way that it can support all the MMCSD card but still if I can do some modification in timings which can improve the speed (Function/code "// send: write byte (03), HS_TIMING index (B9), value (01), cmdset (00) ) return MMC_sendSwitchCmd(hMmcsd, 0x03B90100L);" ). Reminding I am using 100MHz clock. The EMMC chip is standard version 4.41 compliant and supports 8bit bus width. Current bus width is 4bit. Is the driver and TMS320C5535 hardware able to provide 8bit bus for EMMC?

    Thank you,

    Kishan

  • Hi Kishan,

    First of all the issue is not the data transfer rate. It is the delay between the two consecutive  reads.

    Secondly, there some parameters can be adjusted to fine tune the performance, but TI does not have resource to do it for you on. This driver has not been touched since 2012.

    Lastly, the current SD/MMC driver does not support 8 bit.

    Can you close this thread?

    Best regards,

    Ming 

  • Hi Ming,

    Thank you for the guidance and support on USB CDMA, I am closing this thread.

    Thank you again,

    Kishan