cancel
Showing results for 
Search instead for 
Did you mean: 

How to use USB_NOT_READY in ClassDataSetup()

dger
Associate II
Posted on September 22, 2009 at 20:48

How to use USB_NOT_READY in ClassDataSetup()

2 REPLIES 2
dger
Associate II
Posted on May 17, 2011 at 13:23

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!

-Dan

dger
Associate II
Posted on May 17, 2011 at 13:23

The answer to this question can be found in the USB section of this forum:

http://www.st.com/mcu/forums-cat-8927-12.html

-Dan