usbdev_synopsys_dwc2: Mask RX FIFO irq when using DMA #18726
Merged
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.
Contribution description
When using DMA to transfer endpoint data from the RX FIFO to the endpoint memory, the RXFLVL irq is not needed as that is already handled by the DMA. Furthermore, servicing this irq anyway can cause the event handling to interpret data from the FIFO as the endpoint and status marker during the DMA transfer.
This commit masks the RXFLVL irq while DMA is used for the endpoint transfers.
On my side current master quickly triggers faults because the somewhere halfway through the DMA transaction, the RXFLVL irq is serviced and the logic reads out data from the RX FIFO and assumes it is the first value containing the endpoint number (which has already been removed by the DMA).
Testing procedure
On the nucleo-f746zg everything still works (not using DMA):
And with DMA on the stm32f446re with an ulpi HS phy:
Before
The address resolves to an assert failure in
atomic_utils.h
, caused by an invalid endpoint number passed to usbuswith 8cecb81
And on the RIOT shell:
Issues/PRs references
None