PaulStoffregen / USBHost_t36

USB Host Library for Teensy 3.6 and 4.0
170 stars 87 forks source link

No SetAddress() recovery interval observed in enumeration.cpp #87

Open liudr opened 2 years ago

liudr commented 2 years ago

https://github.com/PaulStoffregen/USBHost_t36/blob/1f96ca65f4fac3c8b08313807411c0ab1f72d42d/enumeration.cpp#L172

This is the case that enqueues SET_ADDRESS request and returns to the caller (ISR). I didn't see an observation of the 2ms SetAddress() recovery interval, per USB 2.0 page 246 9.2.6.3

What I've clocked with my analyzer is as short as 0.25ms between the SET_ADDRESS request and the next request to get the full device descriptor. This may not cause issues on some newer devices but I've just seen an older USB 2.0 device having trouble responding to the get-full-dev-desc request that was immediately issued after set_addr. Its response was a bit slow, taking some time to accept the ZLP OUT after the INs of get-full dev-desc and produced "unexpected PINs" according to my analyzer. I glanced at other devices, more recent ones. They never issue NAK or NYET to a ZLP OUT after sending IN data to host. So is it possible to either add a delay such as delayMicroseconds() or else an extra state to wait out the 2ms? This older device takes a couple of ms to accept the ZLP OUT after transmitting some IN data. It's 10-yr old.

Thanks!