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/CCSTUDIO: USB CPPI DMA using CDC

Part Number: CCSTUDIO

Tool/software: Code Composer Studio

Hi there,

I've been correctly working with USB using CDC on a proprietary board, using CSL library and C5517 device by modifying the CSL_USB_CdcExample.

Due to speed limitations for my application, I decided to use the CPPI DMA provided with the USB controller.

As a start, my goal now is to just correctly enumerate a CDC connection on the host and continuosly transmit from the target a 4 bytes payload (0xABCD1234). with 1 second period. In order to do this I'm not using an host application: I just open a terminal (TeraTerm) so I can monitor the transmitted packets from the device. 

Following the "csl_usb_dma_example" I initalize the USB Dma calling 

USB_initQueueManager(&hpdtx, linking_ram0);
USB_initDma();

Operation mode as Dma Tx only:

usbConfig.opMode    = CSL_USB_OPMODE_DMA_TXONLY;

I correctly see the CDC enumeration and the COM on the host, but when I try to Transmit a packet from the target I don't see it on the Terminal (TeraTerm) and with an USB traffic monitor no data packtes are captured too.

I'm configuring the Dma once, right after "USB_connectDev"

/* Connect the USB device */
status = USB_connectDev(gUsbDevHandle);
if(status != CSL_SOK)
{
printf("USB Connect failed\n");
return(result);
}

// DMA init.
USB_initDma();
USB_initQueueManager(&hpdtx, linking_ram0);
// DMA Tx configuration on EP3.
USB_confDmaTx(CSL_USB_EP3, &hpdtx, usb_income_num_bytes_test, usbDataBuffer3, FALSE);

The variables are defined as followed (buffer2 and buffer 3 are defined on the command file according to the example, so it is located on the SARAM):

CSL_UsbHostPktDescr hpdtx;
Uint16 usb_income_num_bytes_test = 4;

#define CSL_USB_DATA_SIZE 64
#pragma DATA_SECTION(usbDataBuffer3, ".buffer3")
Uint16 usbDataBuffer3[CSL_USB_DATA_SIZE];

#define CSL_USB_LRAM_SIZE (256)
#pragma DATA_SECTION(linking_ram0, ".buffer2")
Uint32 linking_ram0[CSL_USB_LRAM_SIZE];

In order to transmit the packets I execute this function:

while(1)

{

USB_dmaTxStart(CSL_USB_EP3);

wait 1 second...

}

I'm using a FullSpeed USB and due to hardware limitation I can't configure an High Speed connection.

Why do you think this is not working?

I see from the "csl_usb_dma_example" that multiple EP are configured: with CDC the communication  EP3 for data from the target to host. Can I only configure the EP3 for Dma Tx?

The CSL function "CDC_OpenFullspeed " forces the usbconfig.opMode  for every EP to "CSL_USB_OPMODE_POLLED", why?

Thank you

  • Stefano,

    We will need to look into this and get back to you. Please expect a delay in the response due to the holidays. Appreciate your patience.

    Lali
  • Stefano,

    Due to the limitation of the USB CPPI DMA, the data have to be 4, 8, 12, etc bytes. Which you are already doing.

    Its recommended to take the CSL_USB_DmaExample and modify instead for your needs fro CDC:

    - Ensure usbDataBuffer3 is filled with diplayable ascii chars on the teraterm.
    - And also the default values usb_income_num_bytes_ep3 should be set to 4.

    USB_confDmaTx(CSL_USB_EP3, &hpdtx, usb_income_num_bytes_ep3, usbDataBuffer3, FALSE);

    Lali
  • Lali,

    thank you for your answer.

    In order to correctly con figure the CPPI DMA what are the basics  step that have to be done in order to transmit 4 bytes on EP3? How should I modify the USB CDC example in order to transmit data using Cppi DMA?

    Thank you

    Stefano

  • Stefano,

    Couple of things.

    - Packet size has to be divisible by 4. Limiation of CPPI DMA.
    - CPPI DMA is very expensive for small block size due to setup size. Queues needs to be setup every time before and after each CDMA transfer. So, this is inefficient for small packet sizes like 4 bytes per packet.

    The steps are illustrated in the USB DMA example. Check the USB ISR for where the complete queue process happens. Sorry I don't have more of a detailed explanation for the customization you are trying to achieve.

    Lali