STM32F (429) USB EP0 IN with DMA does not work, always sends zero bytes
program EP0 for an simple IN transmit
epIn->DIEPINT = -1; //clear ints
epIn->DIEPTSIZ &=~ (USB_OTG_DIEPTSIZ_PKTCNT_Msk | USB_OTG_DIEPTSIZ_XFRSIZ_Msk);
epIn->DIEPTSIZ |= (numPackets << USB_OTG_DIEPTSIZ_PKTCNT_Pos) | (len << USB_OTG_DIEPTSIZ_XFRSIZ_Pos);
//set pointer to data (in ram, 4 byte aligned)
epIn->DIEPDMA = (uintptr_t)data;
//go (i have tried EVERY POSSIBLE BIT COMBINTATION HERE, not just these two)
epIn->DIEPCTL |= USB_OTG_DIEPCTL_CNAK | USB_OTG_DIEPCTL_EPENA;
yes, data is 4-byte aligned
length is 18
packet count is 1
then you wait for interrupt..it comes, and what do we see?
chip sent a zero sized packet instead, and claimed fifo undrran. all the while it had DMA pointer set, and could have slurped up all the data it wanted!
what gives?
in interrupt for EP0 in, i see this
out0.DIEPCTL = 0x00008000
out0.DIEPINT = 0x000020D2
out0.DIEPTSIZ = 0x00080012
out0.DIEPDMA = 0x20000004
out0.DTXFSTS = 0x00000020
I've spent *A WEEK* trying every which way to get this thing to send a reply to GET_DESCRIPTOR **USING DMA**, no luck. all i can get it to do is send a ZLP
i even tried writing to fifo (so i can send PIO, RX via DMA since RX path works)
no go
yes yes yes i know: i can use the st library, but that is not an option, and the docs SHOULD be good enough to actually use them to make the thing work, no?
complete code attached
