Content originally posted in LPCWare by Tsuneo on Thu Dec 11 02:01:13 MST 2014
Quote:
2. i am writing the new address into DEVCMDSTAT register inside the ISR of the endpoint0 IN interrupt (which correspond to the STATUS stage completion).
When your firmware sees the completion ISR on the IN EP0, the STATUS stage has finished on the bus. I know you are faithful to the USB2.0 spec, 9.2.6.3 Set Address Processing ;-)
But the user manual of this MCU states as follows,
11.6.1 USB Device Command/Status register (DEVCMDSTAT)
DEV_ADDR
When receiving a SetAddress Control Request from the USB host, software must program the new address before completing the status phase of the SetAddress Control Request.
Your firmware has to write to DEV_ADDR, when it sees SETUP stage of Set_Address request.
The process of Set_Address depends on SIE design so much. To implement your own stack, always refer to the MCU manual, if it would require specific sequence or not.
Tsuneo