Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information