henk wrote:Hi aneves,
At a guess, you have to wait for the ACK to be received by the host; the device cannot tell when that is?
Cheers,
Henk
I think we're getting confused. When a SetAddress request is sent, the following sequence of events occur:
[SetAddress]
--> Setup Transaction: //Setup Stage. Host requests device to set its address to the number stored in wValue
--> SETUP packet
--> DATA0 packet
<-- ACK packet
--> IN Transaction: //Status Stage. Device acknowledges request and will set its address AFTER status stage
--> IN packet
<-- DATA1 packet //No data
--> ACK packet // Once device sees this packet, set address
Does this make sense? We should be waiting for the ACK sent by the host to be
received by the device during the status stage. Is there a way to do this with lib_usb?
In other words, in my handler which handles SetAddress request from the host, how can I detect the ack sent back by the host after my device sends the zero length packet? It is at this point we should assign the address of the device.
Thanks.