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

Add single buffer mode option to USB CDC to fix off-by-one corruption #2435

Merged
merged 1 commit into from
Jul 15, 2024

Commits on Jul 12, 2024

  1. Add single buffer mode option to USB to fix off-by-one corruption

    When using the debug mode, halting the CPU at a breakpoint can create an occasional condition where the HAL USB state machine encounters an off-by-one error in the packet handling. This error is un-recoverable. completely breaks USB communications, and requires you to reset the STM32.
    
    This is caused by an issue with the double-buffering option available in the endpoint hardware.
    
    Adding the option to disable double buffer mode, and to allow single buffer mode, fixes this issue, and, in my tests, also improves reliability in USB communication with noisy systems, such as motor controllers.
    
    Single buffer mode can now be enabled with -DUSBD_CDC_USE_SINGLE_BUFFER at compile time. 
    
    This commit does not break any other functions of STM32DUINO as far as I can tell.
    gigaj0ule authored Jul 12, 2024
    Configuration menu
    Copy the full SHA
    e75a9a1 View commit details
    Browse the repository at this point in the history