You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by an...@apache.org on 2021/09/09 18:27:52 UTC

[incubator-nuttx] 01/03: stm32f7:USB otgdev Ensure proper EP state

This is an automated email from the ASF dual-hosted git repository.

antmerlino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git

commit 21f049b43a852f08a946f99a0eb5b36d901c609a
Author: David Sidrane <Da...@NscDg.com>
AuthorDate: Thu Sep 9 07:13:23 2021 -0700

    stm32f7:USB otgdev Ensure proper EP state
    
       Repeated automated sercon, serdis on VBUS proved to fail
       for CDCACM DATA IN (device Serial TX). The root cause was
       that the EP was left active after disconnect. This resulted
       in the first serial write falling to kick-off the EP IN request.
       That should restart the EP ISR.
---
 arch/arm/src/stm32f7/stm32_otgdev.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/arm/src/stm32f7/stm32_otgdev.c b/arch/arm/src/stm32f7/stm32_otgdev.c
index 22a2e49..7884d1f 100644
--- a/arch/arm/src/stm32f7/stm32_otgdev.c
+++ b/arch/arm/src/stm32f7/stm32_otgdev.c
@@ -2121,6 +2121,8 @@ static void stm32_usbreset(struct stm32_usbdev_s *priv)
       /* Reset IN endpoint status */
 
       privep->stalled = false;
+      privep->active  = false;
+      privep->zlp     = false;
 
       /* Return read requests to the class implementation */
 
@@ -2130,6 +2132,8 @@ static void stm32_usbreset(struct stm32_usbdev_s *priv)
       /* Reset endpoint status */
 
       privep->stalled = false;
+      privep->active  = false;
+      privep->zlp     = false;
     }
 
   stm32_putreg(0xffffffff, STM32_OTG_DAINT);
@@ -4017,8 +4021,10 @@ static int stm32_epout_configure(FAR struct stm32_ep_s *privep,
       /* Save the endpoint configuration */
 
       privep->ep.maxpacket = maxpacket;
-      privep->eptype = eptype;
-      privep->stalled = false;
+      privep->eptype       = eptype;
+      privep->stalled      = false;
+      privep->active       = false;
+      privep->zlp          = false;
     }
 
   /* Enable the interrupt for this endpoint */
@@ -4114,8 +4120,10 @@ static int stm32_epin_configure(FAR struct stm32_ep_s *privep,
       /* Save the endpoint configuration */
 
       privep->ep.maxpacket = maxpacket;
-      privep->eptype = eptype;
-      privep->stalled = false;
+      privep->eptype       = eptype;
+      privep->stalled      = false;
+      privep->active       = false;
+      privep->zlp          = false;
     }
 
   /* Enable the interrupt for this endpoint */