4 Replies Latest reply on Nov 12, 2014 6:26 PM by pavankumarv_71

    Changing USB Endpoint 1 (EP1) direction during runtime

    david.castonguay

      Hi,

         

      I'm developping an USB application using USB interface on PSoC 3. I'm performing a migration from Microchip PIC18F to PSoC.

         

      I would like to know if it is possible to change EP1 diection while the apllication is running?

         

      I would like to reuse some code from the PIC source code. I noticed that the endpoint is used in both direction.

         

      Thank you!

        • 1. Re: Changing USB Endpoint 1 (EP1) direction during runtime
          pavankumarv_71

           Hi,

             

          During enumeration, USB device informs host about how many end points it has and whether they are IN or OUT. Once communication starts there is no provision to change direction of end points by USB spec. However, you can re-enumerate your device again and have different set of descriptors while enumerating second time. The different set of descriptors can have end point in opposite direction. 

             

          So if you can re-enumerate your device then it is possible to have single end point in opposite directions. 

          • 2. Re: Changing USB Endpoint 1 (EP1) direction during runtime
            david.castonguay.2

            Alright. Thank you for the info.

            I'll analyze the code more in depth to make it work properly.

            I'm using a proprietary application to send data to the device. The issue I'm having right now is that when I set the endpoint to be OUT, the host is able to send data to the device and I see the data I've sent when running the code in debug mode, but the application I'm using to send data is unable to read the reply form the device.

            I asked this question because I' ve tested setting the endpoint either in IN and OUT direction noticing that when in the former direction, sending data form device to host was possible and when in the later direction, sending data from host to device was possible. This is normal since the USB data exchange is host-centric.

            Then, the problem right now is, even with to endpoints, EP1 OUT and EP2 IN, bidirectional data exchange is not working.

            Since direction is setted at enumeration, the driver associated with this device must be set accordingly right?

            Thank you for your time.

            • 3. Re: Changing USB Endpoint 1 (EP1) direction during runtime
              pavankumarv_71

              Hi,

                 

              You can go through this application note which shows simple IN and OUT transfers.

                 

              http://www.cypress.com/?rID=39553

                 

              It makes use of sample PC application "Cypress Suite USB" from which you can understand drivers and C# code. You can modify your app and drivers according to that. 

              • 4. Re: Changing USB Endpoint 1 (EP1) direction during runtime
                david.castonguay

                Thanks a lot.

                   

                It is much more clearer now!