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.

C6748 USB DMA Bulk



Hi:

We are using C6748 in our project and have looked at the starterware examples(C6748_StarterWare_1_20_03_03\examples \lcdkC6748\usb_dev_bulk). We use one of the USB controller of the C6748 as a USB bulk device. The cppi DMA mode is to be used by refer to another example (C:\C6748_StarterWare_1_20_03_03\examples\lcdkC6748\usb_dev_msc),but it seems doesn't work very well. I change some codes:

 /*************************************************************************************/

 usbdbulk.c

const tFIFOConfig g_sUSBbulkFIFOConfig = {     //     // IN endpoints.     //     {         { 1, false, USB_EP_DEV_IN | USB_EP_DMA_MODE_1 | USB_EP_AUTO_SET },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN },         { 1, false, USB_EP_DEV_IN }     },

    //     // OUT endpoints.     //     {         { 1, false, USB_EP_DEV_OUT | USB_EP_DMA_MODE_1 | USB_EP_AUTO_CLEAR },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT },         { 1, false, USB_EP_DEV_OUT }     }, };

 

 

tDeviceInfo g_sBulkDeviceInfo :

      &g_sUSBDefaultFIFOConfig----->&g_sUSBbulkFIFOConfig

 

 /****************************************************************************************/

 usb_dev_bulk.c add:

 endpointInfo epInfo[]=  {   {    USB_EP_TO_INDEX(USB_EP_1),    CPDMA_DIR_RX,    CPDMA_MODE_SET_TRANSPARENT,   },      {    USB_EP_TO_INDEX(USB_EP_1),    CPDMA_DIR_TX,    CPDMA_MODE_SET_GRNDIS,   }

 };

 

 

 Cppi41DmaInit(USB_INSTANCE, epInfo, NUMBER_OF_ENDPOINTS);

for(;g_bufferIndex < NUM_OF_RX_BDs; g_bufferIndex++)

 {

  dataBuffer = (unsigned char *)cppiDmaAllocBuffer();

 doDmaRxTransfer(USB_INSTANCE, USB_MSC_BUFER_SIZE, dataBuffer, g_sBulkDevice.psPrivateBulkData->ucOUTEndpoint);

}

 

when I use CPPI DMA to test: it can send the first 20 bytes successfully,and then no data can be send. Can anyone from TI help us to solve this problem?

for(i=0; i<3; i++)

{

 enableCoreTxDMA(USB_INSTANCE, psInst->ucINEndpoint);

 cmdBuffer = (unsigned int)cppiDmaAllocBuffer();  

memcpy((unsigned char*)cmdBuffer, temp_buf, 20);  

doDmaTxTransfer(USB_INSTANCE, (unsigned char*)cmdBuffer, 20, psInst->ucINEndpoint);  

 

 

}

  • Hi,

    As you mentioned "it seems doesnot work very well", I would like to understand what do you expect to work and what was your actual result?

    What are you actually trying to do with the starter examples? Is the starter examples itself doesnot work for you? and due to which you modifed the code and make it work?

    What do you expect to work with your modified code?

     

    Regards,

    Shankari.

     

    -------------------------------------------------------------------------------------------------------

    Please click the Verify Answer button on this post if it answers your question.
    --------------------------------------------------------------------------------------------------------

     

     

  • I have solved the problem,now I am able to get ~16MBytes/second transfer reliably by using CPPI 4.1 DMA, But the speed cannot achieve expected,  how to improve the USB speed?

    In my next step work,

      //  

     // Allocate buffer for the command  

     //  

     usbBuffer = (unsigned char*)cppiDmaAllocBuffer(8);  

     memcpy(usbBuffer, ImgBuf, 512*8);           /*ImgBuf   in  L2  RAM*/

      //  

     //Send the command response  

     //  

     doDmaTxTransfer(USB_INSTANCE, usbBuffer,512*8, psInst->ucINEndpoint);  

     enableCoreTxDMA(USB_INSTANCE, psInst->ucINEndpoint);

     

    I want to move image datas by EDMA ,instead of using the function  memcpy, i guess the speed can reach to 20M bites/s, but i expect to the speed should reach to 30 Mbytes, how to improve the speed,any suggestion?

  • Hello Jie,
    could you archieve high speed than 16MBytes? Can you send me your source could on the changes of the source code?

    Regards
    Holger