Part Number: TMS320F28388D
Other Parts Discussed in Thread: C2000WARE
Hi,
I am still in the process of making a personal working example of using the CM uDMA with USB and I could use some advice to speed up the development.
At first I followed the existing examples that involve uDMA and did my best to infer what needed to be done to have it interact with the USB peripheral. Of course, I quickly ran into complications.
I assumed that USBEndpointDMAEnable() simply makes the USB peripheral available to the uDMA and that without calling any uDMA functions there would be no effect on the application. What I've discovered is that after calling USBEndpointDMAEnable() with the desired endpoint and direction, is that the application enters into an unending interrupt loop where the USB ISR keep getting called. When I halted the debugger in the USB interrupt handler function I found that the USBDMARIS and USBDMAISC registers had values indicating the device has finished transmitting data (0x2 for both registers). Combined with the default USBDMAIM register value, a USB interrupt will occur as a result. To break out of the loop, I had to modify the default CM_USB0DeviceIntHandler() ISR (provided by the usb_ex4_device_bulk_cm example) to call USBEndpointDMADisable() and USBDMAInterruptStatusClear().
From what I can tell, an empty TX FIFO results in an USB_DMAA_TX_DONE event (even though the application has yet to put any data into the TX FIFO), is that correct? If so, how should I call USBEndpointDMAEnable() to avoid this kind of pre-mature interrupt?
Sincerely,
Howard Li
EDIT:
Alright, I've tried using a software triggered uDMA transfer to load some data into the transmit FIFO. It did not work as the endpoint status register remained unchanged when I do not call USBEndpointDMAEnable(). When I do call that function and mask out the interrupt to avoid the interrupt loop, the endpoint status register showed that the endpoint has stalled (regardless of how the transfer trigger, by the way).
Currently, I have no idea how one is suppose to configure the USB peripheral to work with uDMA, as there are no examples provided by C2000Ware and online searches revealed no additional useful information. I really want to know how to get at least one byte into the transmit FIFO using uDMA.