-
Notifications
You must be signed in to change notification settings - Fork 106
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
USB fails to enumerate when running CPU at 480MHz #503
Comments
@jamesmunns noted that he fixed an errata around this in embassy in embassy-rs/embassy#2823 that relates to USB being used in multiple ISR contexts |
I think I ran in to this when I started my Arduino H7 project. I'm running at 480MHz but I'm specifying that USB should use the HSI48 clock source which seems to work fine. |
@olback That's interesting to me because we're running with very similar clock configurations: https://github.com/quartiq/stabilizer/blob/main/src/hardware/setup.rs#L292 Can you confirm that you're not seeing any USB-related issues with the cod eyou just referenced? I'm confused because yous aid you ran into this issue, but also that it seems to work fine now |
I experienced this issue. The USB peripheral did work ~1 out of 5 flashing attempts. Also, I noticed my code specifically hang in the |
Noting that My suggestion is to insert a delay here: https://docs.rs/synopsys-usb-otg/latest/src/synopsys_usb_otg/bus.rs.html#366-517 after |
I've been grappling with this issue trying to get to a reliable fix. Some of the above fixes work, sometimes, but changing code elsewhere in the project seems to arbitrarily break the build for all of them. The core reset is where the hang occurs: https://github.com/stm32-rs/synopsys-usb-otg/blob/master/src/bus.rs#L446 I've observed that adding a random count of discrete Issuing a full data/instruction synchronization ( In my case I'm on an h723 and it occurs above 400 MHz. Here is the proposed change in a fork to more easily point a project to for test: https://github.com/AetherWareFoundation/synopsys-usb-otg/tree/work-h7coreresethang |
I also noticed it hanging at that point. I worked around it by just adding a |
I am able to cause the hang with I'm not sure that link is really relevant, it seems to describe a case of clearing an interrupt flag. Here one possible explanation is that the preceding write and the AHBIDL bit check read are re-ordered because the M7 is super scalar, letting the core reset attempt proceed in a state we're supposed to prevent. That should be something covered by the memory barrier instructions, though in my testing the ISB was required as well. Or maybe its something with cache lines, I'm not really sure, but in my testing barriers before the AHBIDL read are the only thing that work reliably. 20ms in critical section is too much for my application, though it does seem to achieve the result. If only a handful of instructions are required that can remove whatever race/sync issue is inherent it would be reasonable enough to get upstreamed. |
It was noted today that USB devices appear to not function if the CPU SYSCLK is set to 480MHz. However, if the CPU is dropped to 400MHz, USB works fine.
It's unknown if this is a HAL-related issue, USB-device issue, or silicon defect at this time.
I'm opening this just so we can get an initial read on things and get this documented somewhere.
The text was updated successfully, but these errors were encountered: