STM32_USB-FS-Device_Lib_V4.1.0 file :usb_core.c funciton name: RESULT Standard_ClearFeature(void) code : if (wIndex0 & 0x80) { /* IN endpoint */ if (_GetTxStallStatus(Related_Endpoint )) { ClearDTOG_TX(Related_Endpoint); SetEPTxStatus(Related_Endpoint, EP_TX_VALID); } } else { /* OUT endpoint */ if (_GetRxStallStatus(Related_Endpoint)) { if (Related_Endpoint == ENDP0) { /* After clear the STALL, enable the default endpoint receiver */ SetEPRxCount(Related_Endpoint, Device_Property.MaxPacketSize); _SetEPRxStatus(Related_Endpoint, EP_RX_VALID); } else { ClearDTOG_RX(Related_Endpoint); _SetEPRxStatus(Related_Endpoint, EP_RX_VALID); } } } question: i saw that status of IN endpint was set to VALID(EP_TX_VALID) after recover from HALT; i wonder why we don't set the status to NAK; The USB spec doesn't specify how to leave the endpoints after a halt is cleared. but for an interrupt IN endpoint such as a HID device,at that point when the endpoint recover from halt status,the device will send an packet with uncertain data to the host,since the host automatically query the device by IN token in a determined interval constantly,and it can be quite possible for the packet buffer contains uncertain data at that point; possible advice: just set the status to NAK,firmware could set it to VALID if necessary data get ready to transfer to host later. 主要意思是在一个端点从HALT状态恢复后,发送是有效的,那样的话,比如对于一个中断型的IN端点,会自动发给主机一个数据包,这个数据包的内容是不定的,很可能包含未知的数据; 疑问就是为何不在端点恢复后将发送端点设置为NAK,在固件准备好数据后在由固件设为VALID。 |
使用STM32G431做HID Keyboard与CDC符合设备,发现根本做不成,可能是ST提供的库的问题
STM32U073的usb问题。
STM32F103标准库配置的虚拟串口,设备描述符请求失败
STM32L4R9最大支持SD卡的容量是?支持SDXC 64G卡吗?
usb虚拟多个串口如何操作?
USBX在F407上创建CDC不能正常使用
stm32F407作为usb device时,PC发数据下去,为什么会收到一样的数据?
USB复合设备MSC+CDC,MSC异常影响CDC收发
STM32F407 作USB host 驱动 声卡 问题
STM32F407 USB 的FIFO究竟有多少空间?