Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dwc2_reset 方法在HS上需要修改手动清除RST状态 #276

Closed
1 task
Clearhu opened this issue Nov 24, 2024 · 8 comments
Closed
1 task

dwc2_reset 方法在HS上需要修改手动清除RST状态 #276

Clearhu opened this issue Nov 24, 2024 · 8 comments

Comments

@Clearhu
Copy link

Clearhu commented Nov 24, 2024

描述一下这个bug / Describe the bug

我在一款测试芯片上,发现 USB_OTG_GLB->GRSTCTL |= USB_OTG_GRSTCTL_CSRST 后该位一直保持为1,并没有自动清除

复现步骤 / To Reproduce

内部测试芯片所以无法给出复现方法,可能其他芯片会遇到

设备信息 / Target Device

内部测试芯片所以无法给出复现方法

日志 / Log

错误的日志:
00> GRSTCTL111: 80000000, 40040010
00> GRSTCTL222: A0000001, 40040010
00> GRSTCTL333: A0000001, 40040010

正确的日志:
00> GRSTCTRL111: 80000000, 40040010
00> GRSTCTRL222: 80000001, 40040010
00> GRSTCTRL333: 80000000, 40040010

配置 / Configuration

原始代码为:
do {
if (++count > 200000U) {
return -1;
}
} while ((USB_OTG_GLB->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);

修改后位:
do {
if (++count > 200000U) {
break;
}
} while ((USB_OTG_GLB->GRSTCTL & USB_OTG_GRSTCTL_CSRST) == USB_OTG_GRSTCTL_CSRST);
USB_OTG_GLB->GRSTCTL &= ~(USB_OTG_GRSTCTL_CSRST);

USB中断 / USB Interrupt

不修改前无法进入中断

缓存 / Cache

No response

商业 / Business

  • 是 / Yes
@sakumisu
Copy link
Collaborator

这个应该是ic那边设计问题,建议找ic设计,目前没有遇到过哪家芯片有这问题

@Clearhu
Copy link
Author

Clearhu commented Nov 25, 2024

3aa0949d5459e24e653fe8a39e7744b 这个IC确实不会自动清除,看能不能把我这个修改帮忙合进去,也不会影响到其他的ic

@sakumisu
Copy link
Collaborator

以下是IP 手册原文:

The application can write to this bit any time it wants to reset the core. This is a self-clearing bit and the core clears this bit after all the necessary logic is reset in the core, which can take several clocks, depending on the current state of the core. Once this bit is cleared software must wait at least 3 PHY clocks before doing any access to the PHY domain (synchronization delay).

@Clearhu
Copy link
Author

Clearhu commented Nov 25, 2024

d239b81d7f81df194fcb0a00744c447 我在ST H7系列的描述看到过这个句话,确实是会自清除的,但是现在我碰到的这个IC没有这么做,并且已经开始量产了,看能不能把这个修改加入进去,再纠结原版这个问题意义也不大,毕竟Cherryusb也是尽可能支持更多IC

@sakumisu
Copy link
Collaborator

可以增加,提PR 把

@Clearhu
Copy link
Author

Clearhu commented Nov 25, 2024

你帮我弄了算了吧,哈哈

@sakumisu
Copy link
Collaborator

好的

sakumisu added a commit that referenced this issue Nov 25, 2024
@sakumisu
Copy link
Collaborator

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants