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);
}