I've discovered that the basic ST USB Custom HID demo (direct from the website) does not work if you shorten the magic number delay in the main loop to a reasonable level. It even continues to fail when you use end of transfer calls to ensure you are not overflowing the FIFO. Looks like the OTG USB stack gets into a state when interrupts are not being cleared and the handler goes around in circles... The uninitialized variable issue you mention may be part of the issue. However, searching through the code for ".b." and reviewing that all bit field assignments occurred on initialized variables does not fix the issue.
I also found the following, which looks like a method of clearing interrupts had been removed and not replaced (and I have no idea as yet how to fix this). There are several examples with the same comment throughout the OTG stack code.
/* Clear interrupt: this is a read only bit, it cannot be cleared by register
/* int_sts.d32 = 0;
int_sts.b.rxstsqlvl = 1;
WRITE_REG32 (&core_regs.common_regs->int_sts, int_sts.d32);
Without wishing to ruffle any feathers, I have to say that the condition of the OTG library and the total lack of documentation are appalling. USB support is critical to many of the projects the connectivity line targets, yet it looks like these devices were released without a working USB stack. Please, by all means, correct me if there is evidence that the stack really does work.
Can ST provide a timetable for release of a fully-tested and working OTG stack?
Does anyone have a working version of the OTG stack which can handle sending data back and forth at a reasonable rate (say 10 ms polling, one endpoint in each direction)?
How many projects out there are on hold because of this?
Shouldn't it read OTG_DEV_SetEPTxStatus(epnum, DEV_EP_TX_NAK); instead of EP1_IN?
Anyways I'm not able to receive anything from isochronous EP2 IN and I remember somebody else posting about this as well. Could STOne-32 or somebody else involved in developent of ST libraries please comment on this, since it seems that every time there is a bug reported ST replies with deep silence.
Retrieving data ...