-
Notifications
You must be signed in to change notification settings - Fork 2k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers/usbdev_synopsys_dwc2: add GD32V support #19389
Conversation
30ee6cb
to
cdc62d0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm and I see you already have tested this on a wide range of implementations.
Please squash.
I see one potential race condition here, but not sure if it is the case. For the non-DMA case both the rxfifolvl and the transfer complete interrupts are enabled. I previously had a similar issue with the DMA case where both the transfer complete and the rxfifolvl interrupts were enabled (see #18726). On fast microcontrollers with HS phy this could trigger unstable behaviour quickly when using cdc ecm and pinging the device with large icmp packets. I wonder if this issue returns here but for the non-dma case, with a HS phy. I'm also curious why a different interrupt is used during the address state. |
The causal order should be that
Because |
* while (un)blocking works on the stm32f401, needs more | ||
* investigation with a larger set of chips */ | ||
#if defined(STM32_USB_OTG_CID_1x) | ||
#if defined(MCU_STM32) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bergzand I am not sure if this change could cause it to stop working on the stm32f446. I have tested it with a number of non CID 1.x core versions but could not find a problem.
925d38c
to
670951a
Compare
I had to rebase to resolve the conflicts. |
XFRC (Transfer Complete) interrupts are now also used for IN EPs in non-DMA mode. TXFE (TX FIFO Empty) interrupts are not necessarily needed but are still enabled.
1f671ac
to
ce97aa6
Compare
ce97aa6
to
7c807d1
Compare
XFRC (Transfer Complete) interrupts are now also used for OUT EPs in non-DMA mode. RXFLVL (RX FIFO Level) interrupts are no longer used to signal completed transfers, but only to copy data from FIFO to memory and to set a flag indicating that a SETUP stage is in progress. STUP (SETUP phase done) interrupts are then used to signal a completed SETUP stage and to reset the flags that indicates the SETUP stage. The flag that indicates the SETUP stage in progress is used to ignore additional XFRC interrupts for EP0 during the SETUP stage.
Since RXFLVL (RX FIFO Level) interrupt doen't complete transfers anymore, they are handled now directly in the ISR.
After changing IN EPs also to use XFRC (Transfer Complete) interrupts in non-DMA mode, the TXFE (TX FIFO Empty) interrupt is no longer needed to signal the completion of an IN transfer.
7c807d1
to
1e983f3
Compare
tryBuild succeeded: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, thanks for the many improvements!
bors merge
Build succeeded: |
Thanks for reviewing, testing und merging. |
Contribution description
This PR provides the GD32V support in
drivers/usbdev_synopsys_dwc2
. It also includes some cleanup and bug fixes.To support GD32V (CID 1.000) the PR includes the following changes:
The following fixes, improvements and cleanup has been added:
The PR could be split into a PRs with cleanups and improvements and a PR with GD32V support if necessary.
Testing procedure
should work with
stdio_cdc_acm
.periph_usbdev
should still work for other platforms. The PR was tested withtests/usbus_cdc_ecm
together withstdio_cdc_acm
if possible:Boards with HS interfaces were tested in DMA and none-DMA mode.
Issues/PRs references