0 Replies Latest reply on May 18, 2014 2:31 PM by michael.k

    Using control endpoint with CyAPI (troubleshooting)

    michael.k

      Hi, 

         

      Hi,

         

      I am using Windows 7 x64 operating system and cy7c80 controller device with FPGA.So far I have been able to successfully adapt Streamer example and use bulk endpoint.

         

      The problem I am facing at the moment is that I am unable to perform control endpoint transfers using CyAPI.

         

      I have been following the example from CyAPI Programmer's reference :

         
          CCyUSBDevice  *USBDevice = new  CCyUSBDevice(NULL);   
         
              
         
          //  Just for typing efficiency   
         
          CCyControlEndPoint  *ept = USBDevice->ControlEndPt;   
         
              
         
          ept->Target  = TGT_INTFC;   
         
          ept->ReqType = REQ_CLASS;   
         
          ept->ReqCode = 0x81;   
         
          ept->Value   = 4;   
         
          ept->Index   = 3;   
         
              
         
          unsigned char  buf[2]={0};   
         
          LONG bytesToRead = 2;   
         
              
         
          ept->Read(buf, bytesToRead);   
         
              
         
          In this instance and also in another example I get false as return value of the function.   
         
              
         
          I have tried to run the USB Control Center (VS 2010) CyUSB.NET example.I have set the values in the test program exactly   
         
          as above and I have been able to complete the transfer     successfully.   
         
          I have been using the following code in CyAPI (replication of .NET transfer code ):   
         
          CtrlEndPt->Target    = TGT_INTFC;   
         
          
           CtrlEndPt->ReqType   = REQ_CLASS;    
          
           CtrlEndPt->Direction = DIR_FROM_DEVICE ;    
          
           CtrlEndPt->TimeOut = 2000 ;    
          
           CtrlEndPt->ReqCode = 0x81 ;    
          
           CtrlEndPt->Value = 4 ;    
          
           CtrlEndPt->Index = 3;    
          
           if (CtrlEndPt->XferData (buf , buflen) == true)    
          
           {....    
          
           and I still get false as return value.Interesting fact is that I get this return value immediately,it seems like the function does not even attempt to make some kind of connection and returns immediately.Another interesting fact are the values that are set on the fileds of Control Endpoint in C# - they differ a lot from the values I have set above.Those values are impossible to set on CyAPI,you can get compilation errors.    
          
           Any help will be appresciated .Thanks in advance.    
          
                                                                                                    Michael