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
voila it's WORKING Tsuneo.... I kicked all the stuff out of the endpoint isr and it works with 300Byte..
I made a small test example with 256 bytes so that I have to add a ZLP - but it still fails....I can't see anything with my software usb sniffer...
void SendDataToHost() { USB_DMA_DESCRIPTOR DD; DD.BufAdr = (unsigned int)pStartBufAddr; /* DMA Buffer Address */ DD.BufLen = 256; /* DMA Packet-size */ DD.MaxSize = 64; /* 64Byte for bulk-transfer */ //DD.Cfg.Type.IsoEP = 0; //DD.Cfg.Type.ATLE = 0; DD.Cfg.Val = 0; /* Initial DMA Configuration */ USB_DMA_Setup (CDC_DEP_IN, &DD); /* Setup DMA */ /* ************* ZLP **********/ DD.BufLen = 0; DD.MaxSize = 0; //DD.Cfg.Type.Link = 1; ???? DD.Cfg.Val = 0; USB_DMA_Setup (CDC_DEP_IN, &DD); USB_DMA_Enable(CDC_DEP_IN); /* Enable DMA */ LPC_USB->USBDMARSet = 1 << EPAdr(CDC_DEP_IN); }
My endpoint ISR is still empty. It seems that the ZLP is not yet recognized.... What does the DD.Cfg.Type.Link stand for???