Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fpistm merged 1 commit intostm32duino:mainfromgigaj0ule:main
Jul 15, 2024

Conversation

gigaj0ule
Copy link
Contributor

This PR fixes/implements the followingbugs/features

[Bug]

When using the debug mode, halting the CPU at a breakpoint can create a 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.

[Fix]

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.

[Breaking: None]

This commit does not break any functions of STM32DUINO and is a completely optional command-line option.

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.
@fpistmfpistm added the enhancementNew feature or request labelJul 15, 2024
@fpistmfpistm self-requested a reviewJuly 15, 2024 07:40
@fpistmfpistm linked an issueJul 15, 2024 that may beclosed by this pull request
Copy link
Member

@fpistmfpistm left a comment

Choose a reason for hiding this comment

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

No issue foreseen.
LGTM

@fpistmfpistm merged commit2d54735 intostm32duino:mainJul 15, 2024
23 checks passed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fpistmfpistmfpistm approved these changes

Assignees
No one assigned
Labels
enhancementNew feature or request
Projects
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

CDC_ReceiveQueue fails after CPU halt
2 participants
@gigaj0ule@fpistm

[8]ページ先頭

©2009-2025 Movatter.jp