xmos / lib_xud

XMOS USB code and associated examples
Other
8 stars 25 forks source link

Full control transfers are assumed #74

Open xross opened 3 years ago

xross commented 3 years ago

Universal Serial Bus Specification Revision 2.0

5.5.5 Control Transfer Data Sequences

If a Setup transaction is received by an endpoint before a previously initiated control transfer is completed, the device must abort the current transfer/operation and handle the new control Setup transaction. A Setup transaction should not normally be sent before the completion of a previous control transfer. However, if a transfer is aborted, for example, due to errors on the bus, the host can send the next Setup transaction prematurely from the endpoint’s perspective.

XUD needs to provided a buffer for Setup transfers. A proof of concept API has been developed.

mbanth commented 3 years ago

Under what conditions will a host issue a new Setup transaction? The description lists one, an error on the bus. Are there others? Could the device taking a long time to complete a previously initiated control transfer result in the host sending the next Setup transaction?

xross commented 3 years ago

The specification states:

9.2.6.1 Request Processing Timing All devices are expected to handle requests in a timely manner. USB sets an upper limit of 5 seconds as the upper limit for any command to be processed.

There are some exceptions to this but, yes, I should imagine that a very slow responding device may cause the host to retry sending a new SETUP trans. I've not seen this though, unless something has gone quite wrong.