你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

STM32_USB-FS-Device_Lib_V4.1.0 : not sure if this is a bug in usb_core.c

[复制链接]
uzslm 提问时间:2017-10-18 17:48 /
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。

收藏 评论0 发布时间:2017-10-18 17:48

举报

0个回答
关于意法半导体
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
招聘信息
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
关注我们
st-img 微信公众号
st-img 手机版