2009-09-22 11:48 AM
How to use USB_NOT_READY in ClassDataSetup()
2011-05-17 04:23 AM
The STM32 USB library documentation gives a list of the possible return values for my ClassDataSetup() function. One of them, USB_NOT_READY, seems like it should be used when the device isn't ready to respond right away. That makes perfect sense for a USB transaction that requires data to be returned using an operation like an SEEPROM read, which might take a few msec to retrieve the data.
But the documentation does not explain how to resume the transaction and return the data. My presumption is: 1. In my ClassDataSetup() function (which is called from interrupt context), I save any info I need to complete the request from the setup packet, and set a flag so that my main loop knows to do the EEPROM read. Instead of setting a CopyRoutine, I call SetEPTxStatus(ENDP0, EP_TX_NAK) and return USB_NOT_READY. 2. In my main loop, I see the flag, pick up the relevant info I saved in step 1, and do the SEEPROM read. 3. When I've read the data, I need to do something to get the USB core out of state=PAUSE so that it can copy the initial data and resume the transaction. What do I do in step 3? Thank you! -Dan2011-05-17 04:23 AM
The answer to this question can be found in the USB section of this forum:
-Dan