From b7ba56dfbd1a36587f97c4584a0d544330b58ccd Mon Sep 17 00:00:00 2001 From: dragonmux Date: Tue, 23 Apr 2024 07:46:44 +0100 Subject: [PATCH] usb/dwc: Cleanup in the setup interrupt handling and IN endpoint handling --- lib/usb/usb_dwc_common.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/usb/usb_dwc_common.c b/lib/usb/usb_dwc_common.c index 672d76562f..01eb9902a2 100644 --- a/lib/usb/usb_dwc_common.c +++ b/lib/usb/usb_dwc_common.c @@ -214,7 +214,7 @@ uint16_t dwc_ep_write_packet(usbd_device *const usbd_dev, const uint8_t addr, co if (ep == 0U) { REBASE(OTG_DIEPTSIZ(ep)) = OTG_DIEPSIZ0_PKTCNT | (len & OTG_DIEPSIZ0_XFRSIZ_MASK); } else { - REBASE(OTG_DIEPTSIZ(ep)) = OTG_DIEPSIZ0_PKTCNT | (len & OTG_DIEPSIZX_XFRSIZ_MASK); + REBASE(OTG_DIEPTSIZ(ep)) = OTG_DIEPSIZX_PKTCNT(1) | (len & OTG_DIEPSIZX_XFRSIZ_MASK); } REBASE(OTG_DIEPCTL(ep)) |= OTG_DIEPCTL0_EPENA | OTG_DIEPCTL0_CNAK; @@ -415,7 +415,9 @@ void dwc_poll(usbd_device *usbd_dev) if (pktsts == OTG_GRXSTSP_PKTSTS_OUT_COMP || pktsts == OTG_GRXSTSP_PKTSTS_SETUP_COMP) { #if defined(STM32H7) - REBASE(OTG_DOEPINT(ep)) = OTG_DOEPINTX_STUP; + if (pktsts == OTG_GRXSTSP_PKTSTS_SETUP_COMP) { + REBASE(OTG_DOEPINT(ep)) = OTG_DOEPINTX_STUP; + } #endif REBASE(OTG_DOEPTSIZ(ep)) = usbd_dev->doeptsiz[ep]; REBASE(OTG_DOEPCTL(ep)) |=