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

Fix livelock on IN or OUT transactions #13

Merged
merged 1 commit into from
Dec 9, 2024

Conversation

RockyZeroFour
Copy link

  • Handles new interrupt flags for IN & OUT endpoints
  • Catches interrupts when certain error conditions occured
  • Prevents livelocks for some error conditions

- Handles new interrupt flags for IN & OUT endpoints
- Catches interrupts when certain error conditions occured
- Prevents livelocks for some error conditions
@@ -1348,7 +1354,7 @@ void dcd_int_handler(uint8_t rhport)
do
{
handle_rxflvl_irq(rhport);
} while(dwc2->gotgint & GINTSTS_RXFLVL);
} while(dwc2->gintsts & GINTSTS_RXFLVL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is kinda confusing, howcome it was like this before? Is this change valid for gd32 & stm32?

Copy link
Author

@RockyZeroFour RockyZeroFour Dec 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was a bug, likely because of a typo. The goal here is to remain in the FIFO handler until the FIFO is empty and the interrupt is then automatically cleared again. Before the handler would be triggered again until the FIFO is empty instead of staying there until done as intended.

During a code check I noticed that this was off so I looked closer. Checking the global OTG interrupt flag register (gotgint) isn't related to the FIFO so using that don't make sense, the naming of the bit also indicate that it's not supposed to be used with that register and a quick check on the current TinyUSB branch revealed that they also changed it.

@simon-wh simon-wh merged commit b7dcbca into feature/gd32f4-improved Dec 9, 2024
62 of 64 checks passed
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

Successfully merging this pull request may close these issues.

3 participants