Fix USBH_MIDI_Transmit: use DMA-safe buffer and serialize transfers#698
Open
jpanneton wants to merge 1 commit intoelectro-smith:masterfrom
Open
Fix USBH_MIDI_Transmit: use DMA-safe buffer and serialize transfers#698jpanneton wants to merge 1 commit intoelectro-smith:masterfrom
jpanneton wants to merge 1 commit intoelectro-smith:masterfrom
Conversation
The caller's buffer was passed directly to USBH_BulkSendData. On the STM32H750, this buffer may reside in DTCM or cached AXI SRAM, which are memory regions the USB OTG peripheral cannot reliably access. This caused the device to ACK but silently discard the payload, leading to OUT transfers sending corrupted data. Additionally, rapid back-to-back calls would re-submit on the same OUT pipe before the previous transfer completed, since USBH_BulkSendData sets the URB state to URB_IDLE on submission, making it indistinguishable from "no transfer pending" Changes to USBH_MIDI_Transmit: - Copy TX data into the handle's txBuffer before sending - Track in-flight state with a txActive flag and wait for URB_DONE from the previous transfer before submitting the next
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The caller's buffer was passed directly to USBH_BulkSendData. On the STM32H750, this buffer may reside in DTCM or cached AXI SRAM, which are memory regions the USB OTG peripheral cannot reliably access. This caused the device to ACK but silently discard the payload, leading to OUT transfers sending corrupted data.
Additionally, rapid back-to-back calls would re-submit on the same OUT pipe before the previous transfer completed, since USBH_BulkSendData sets the URB state to URB_IDLE on submission, making it indistinguishable from "no transfer pending"
Changes to USBH_MIDI_Transmit: