-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
STM32L475 will not send ACK packets after data stage finished #1494
Comments
this is mostly tested with my L476 discovery board. These line of codes are done when doing generic dwc2 driver #1163 with tons of testing (trial/error). Maybe I didn't fully resolve this issue with L4 series just yet (possibly an race condition that is less likely to happen on my L476 discovery board due to clock/hw set up etc..). I don't have official dwc2 specs and the stm manual are not very helpful on this particular issue. I kind of forget the detail, #126 may contain some useful info with links to stm32 cube driver. Unfortunately I don't have any L475 to test/fix this, but I will try to pull out L476 to test along your suggested changes later on. |
I am running into what appears to be this problem. I cam reliably reproduce it on the L476disco board by reducing the system clock to 16MHz (or anything under 48MHz actually). Applying the suggested change makes the problem go away. Is this then the correct fix? |
I am not sure either, I will try to lower clock and pull out my L476 to test with whenever I got time. |
Thanks for looking. |
#2576 changed the interrupt flow, although L475 doesn't have DMA but worth a try. |
Thanks. I will test that change. But can only do that next week. I will post an update. |
I have tested this change on an L476, this does not seem to fix the issue described
|
@HiFiPhile Without that case statement, I end up at the And with that statement, I end up in an infinite loop, because the DOEPINT_STPKTRX flag is not cleared. The comment claims that it is cleared later, but (Should this comment move to #2576?) |
Hum... in ST's code
tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c Lines 1084 to 1086 in 02ec486
But I don't have L47x board to see what really happens. |
I have tried to change the interrupt handling to match what STM32 HAL does: HiFiPhile#2 |
@electretmike could you confirm if issue is resolved with latest #2576 ? |
I was busy on other projects for the last weeks, and will be away the next few. I hope to be able to test in about 4 weeks. |
Operating System
Windows 10
Board
STM32L475VET6
Firmware
custom firmware, basically CDC.
What happened ?
During device enumeration, after data stage of
SET_LINE_CODING
, it won't send ACK packet. After checking the log, I think theXFRC
bit should not be cleared whenOTEPSPR
is set butSTPKTRX
is cleared.tinyusb/src/portable/synopsys/dwc2/dcd_dwc2.c
Lines 1028 to 1040 in fa895ed
By changing line 1038 to
if (doepint & DOEPINT_STPKTRX)
, it works fine for me. But after I compile it with-O2
, it occurs some assert failed. Maybe we can have a better way to handle it?How to reproduce ?
TinyUSB
v0.13.0
. Use CDC on STM32L475VET6.Debug Log as txt file
Screenshots
stuck on status stage:
assert failed after changing:
The text was updated successfully, but these errors were encountered: