最近在做燒寫工具的優化工作,有一些關於USB的內容需要總結一下其中包括設備的初始化過程和枚舉過程。
在枚舉的過程中,設備會一直等PC端的狀態,當等到reset命令時會對設備進行重新枚舉。但是這個reset終端是如何而來呢?
Halt Conditions
A control endpoint may recover from a halt condition upon receiving a SETUP packet. If the endpoint does not recover from a SETUP packet, it may need to be recovered via a different pipe. If an endpoint with the endpoint number 0 does not recover with a SETUP packet, the host should issue a device reset.
在usb協議中有上面的描述,大致意思是:控制斷電在接收到SETUP包的時候慧聰掛起狀態恢復。如果端點沒有從SETUP包恢復,它可能需要通過不同的管道來進行恢復。如果端點0沒有從SETUP包中恢復,那麼主機端將產生設備重啓的事件。
這樣就能夠解釋,在DFU文件工作的過程中程序要持續接收中斷,等待reset之後,會對設備進行重新的枚舉過程。具體的操作後續進行描述。
usb 相關文件下載: