Skip to content

Conversation

MrKevinWeiss
Copy link
Contributor

Backport of #19459

Contribution description

This PR fixes the interrupt handling for IN endpoints in DMA mode.

In DMA mode, both the XFRC (Transfer Complete) interrupt and the TXFE (TX FIFO Empty) interrupt for IN EP1 ... EPn were used to generate the USBDEV_EVENT_TR_COMPLETE. This led to problems with USBUS MSC. With this fix, the TXFE interrupt is used only in non-DMA mode or only for IN EP0 in DMA mode while the XFRC (Transfer Complete) is used only in DMA mode for IN EP1 ... EPn.

Testing procedure

This PR should work together with PR #19458 for SD Card interface for a board with USB HS port, for example:

USEMODULE='sdcard_spi mtd_sdcard_default periph_usbdev_hs_ulpi' \
CFLAGS='-DSDCARD_SPI_PARAM_CLK=GPIO_PIN\(PORT_I,1\) -DSDCARD_SPI_PARAM_MISO=GPIO_PIN\(PORT_B,14\) -DSDCARD_SPI_PARAM_MOSI=GPIO_PIN\(PORT_B,15\) -DSDCARD_SPI_PARAM_CS=GPIO_PIN\(PORT_A,8\)' \
BOARD=stm32f746g-disco make -j8 -C tests/usbus_msc flash

It should still work for CDC ECM for such a board:

USEMODULE='periph_usbdev_hs_ulpi stdio_cdc_acm' BOARD=stm32f746g-disco make -j8 -C tests/usbus_cdc_ecm flash

Issues/PRs references

@MrKevinWeiss MrKevinWeiss added Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors) labels Apr 15, 2023
@MrKevinWeiss
Copy link
Contributor Author

Thanks @gschorcht

@riot-ci
Copy link

riot-ci commented Apr 15, 2023

Murdock results

✔️ PASSED

34ac920 drivers/usbus_synopsys_dwc2: fix interrupt handling in DMA mode

Artifacts

@MrKevinWeiss
Copy link
Contributor Author

ping @jia200x

Copy link
Member

@dylad dylad left a comment

Choose a reason for hiding this comment

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

ACK.

@dylad
Copy link
Member

dylad commented Apr 17, 2023

bors merge

@bors
Copy link
Contributor

bors bot commented Apr 18, 2023

Build succeeded:

@bors bors bot merged commit 760b2af into RIOT-OS:2023.04-branch Apr 18, 2023
@gschorcht
Copy link
Contributor

Thanks for backporting.

@MrKevinWeiss MrKevinWeiss deleted the backport/2023.04/drivers/usbdev_sysnopsys_dwc2/fix_int_handling_dma_mode branch April 18, 2023 07:08
@jia200x jia200x added this to the Release 2023.04 milestone Apr 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: drivers Area: Device drivers CI: ready for build If set, CI server will compile all applications for all available boards for the labeled PR Process: release backport Integration Process: The PR is a release backport of a change previously provided to master Type: bug The issue reports a bug / The PR fixes a bug (including spelling errors)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants