AnsweredAssumed Answered

Strange CUBE USB device driver behaviour

Question asked by pi.ka on Dec 4, 2015
Latest reply on Dec 11, 2015 by pi.ka

I work with STM32F429-Disco. I have problem understanding how USB class device driver should be implemented.

From MSC class driver implementation I see:

- DataOut is called for ep out where Receive() is called, and Prepare_Receive() - so next data can be received, this makes URB complete to appear on the bus (at least this is what I expect).
- DataIn is called for ep in urb submit, and this is where Transmit() is called - so e.g. response to some command sent over ep out can be transmitted - this makes urb complete on ep in to appear.

But this does not work for me this way. When I call only Prepare_Receive() in DataOut then DataIn is never called. Only if I call both Transmit() and Prepare_Receive() in DataOut then DataIn is activated (anyway this is too late as I already transmitted the response). But this way I can communicate with PC host (I have some python script writing and reading to/from the device which correctly sends receives data). I based my implementation on CDC device code, could this be any reason for the driver to behave this way? Am I missing some configuration to have DataOut, DataIn activated the way it is expected? Or my understanding of control flow for DataIn, DataOut is not correct?

Thanks for any suggestions on how this should be understood/implemented.