This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to enable and use DMA for USB bulk IN endpoints

Hi,

I'm using uVision 4 with the MCB2300 development board. I'm developing a software that periodically transmits data (status information) from the device to the host (as first step, the data are sent without being explicitly requested by the host as soon as a connection has been established). Thereto I've modified the USBCDC example included with uVision. The software transmits 20 bytes periodically, using USB_WriteEP (in usbhw.c, which uses the register interface). This works fine so far. Now I would like to use the DMA engine to avoid copying the bytes word by word into the register. I've enabled DMA in the USB configuration for logical IN endpoint 2 (physical endpoint 5 which is called CDC_DEP_IN in the example), and I have managed to set up DMA descriptors. But how do I trigger a DMA transfer?
I've tried several combinations of USB_DMA_Setup and USB_DMA_Enable. Manually setting the appropriate bit in DMA_REQ_SET to trigger the interrupt results in an error state. What am I doing wrong?
Could anyone please give me some hints concerning USB DMA? Thanks a lot.
I'll be back in January, after my Christmas vacation. I wish everybody a merry Christmas and a happy new year!

CC

Parents
  • Hi,

    I'm back from Christmas vacation and first want to thank you all for your replies. And I have some good news: my example works now. My solution was almost correct, the only problem was that the data buffer the DMA descriptor points to was not located in USB RAM (obviously this is required - thanks for the hint). I've moved it to USB RAM (a higher region starting at 0x7fd01f00), and now my code works as expected.
    The next thing I'm going to do is to implement DMA for OUT endpoints...

    CC

Reply
  • Hi,

    I'm back from Christmas vacation and first want to thank you all for your replies. And I have some good news: my example works now. My solution was almost correct, the only problem was that the data buffer the DMA descriptor points to was not located in USB RAM (obviously this is required - thanks for the hint). I've moved it to USB RAM (a higher region starting at 0x7fd01f00), and now my code works as expected.
    The next thing I'm going to do is to implement DMA for OUT endpoints...

    CC

Children
No data