2007-04-26 04:32 AM
2011-05-17 12:42 AM
Hi Steve,
Have you found a resolution to this problem? I am also seeking example source code and/or documentation that defines how to enable USB transfers via DMA.
-Kelly
2011-05-17 12:42 AM
Hello,
I need to send to the pc about 64Kbyte of data using a bulk transfer (EP1). I'd like to use the DMA to do that. I wrote the following piece of code but I have a doubt: Have I to trigger the dma event every 64byte or the dma engine is in charge to manage the transfer of the EP buffer? Do you have any example? ----- code ----------- DMA_InitTypeDef DMA_init; DMA_StructInit(&DMA_init); DMA_init.DMA_Channel_LLstItm=(u32)(USBDMA_Link[2]); DMA_init.DMA_Channel_DesAdd=(u32)(PMAAddr+(u32)((GetEPDblBuf0Addr(ENDP1)))); /* Destination address Endpoint 1 Buffer 0*/ DMA_init.DMA_Channel_SrcAdd=(u32)(&AD_buffer); /* Source address */ DMA_init.DMA_Channel_SrcWidth= DMA_SrcWidth_Word; /* The source bus width is a word (32bits)*/ DMA_init.DMA_Channel_DesWidth= DMA_DesWidth_Word; /* The Destination bus width is a word (32bits)*/ DMA_init.DMA_Channel_FlowCntrl=DMA_FlowCntrl_Perip2; /* USB is The flow controller*/ DMA_init.DMA_Channel_Des= DMA_SRC_USB_TX; DMA_init.DMA_Channel_TrsfSize = 0; /* Transfer size*/ /* Configure the DMA channel0 */ DMA_Init(DMA_Channel1, &DMA_init); /* update the DMA channel1 registers with the LLI structure*/ DMALinkedModeTxEnable(); DMASynchEnable(); DMALinkedModeTxConfig(ENDP1); SetDMALLITxLength(0x4); DMA_ChannelCmd (DMA_Channel1, ENABLE); /*Enable the DMA channel*/ DMA_ChannelDESIncConfig (DMA_Channel1, ENABLE); DMA_ChannelSRCIncConfig (DMA_Channel1, ENABLE); DMA_ITMaskConfig(DMA_Channel1, DMA_ITMask_ITC, ENABLE); // src USBDMA_Link[0] = (u32)(&AD_buffer[0x0000]); USBDMA_Link[4] = (u32)(&AD_buffer[0x0800]); USBDMA_Link[9] = (u32)(&AD_buffer[0x1000]); USBDMA_Link[12] = (u32)(&AD_buffer[0x1800]); //des USBDMA_Link[1] = (u32)(PMAAddr+(u32)((GetEPDblBuf1Addr(ENDP1)))); USBDMA_Link[5] = (u32)(PMAAddr+(u32)((GetEPDblBuf1Addr(ENDP1)))); USBDMA_Link[10] = (u32)(PMAAddr+(u32)((GetEPDblBuf1Addr(ENDP1)))); USBDMA_Link[13] = (u32)(PMAAddr+(u32)((GetEPDblBuf1Addr(ENDP1)))); USBDMA_Link[2] = (u32)(&USBDMA_Link[4]); USBDMA_Link[6] = (u32)(&USBDMA_Link[8]); USBDMA_Link[10] = (u32)(&USBDMA_Link[12]);