0 Replies Latest reply on Aug 18, 2017 2:34 PM by ya.guo

    about control transfer

    ya.guo

      I want to try Control transfer in PSoc 5, but never successful

         

      Here is my firmware

         

        case 0xA2:
          USBFS_1_currentTD.wCount=32;
          
          USBFS_1_currentTD.count=32;
          
          averageVolts=117;//averageVolates type is uint32
          USBFS_1_currentTD.pData=averageVolts;
                     
          requestHandled  = USBFS_1_InitControlRead();
          break;

         

         case 0xA3:
          USBFS_1_currentTD.wCount=32;
          
          USBFS_1_currentTD.count=32;

         

          USBFS_1_currentTD.pData=10;
          
          requestHandled  = USBFS_1_InitControlWrite();
             break;
          
          In PC

         

       CCyControlEndPoint* CtlEndpoint;

         

       CtlEndpoint=USBDevice->ControlEndPt;

         

       CtlEndpoint->Target=TGT_DEVICE;
       CtlEndpoint->ReqType=REQ_VENDOR;
       CtlEndpoint->Direction=DIR_FROM_DEVICE;
       CtlEndpoint->ReqCode=0xA2;
       CtlEndpoint->Value=0;
       CtlEndpoint->Index=0;
       PUCHAR buf=new UCHAR[32];//Receive data

         

       long buflen=32;
       
        
       ZeroMemory(buf,32);

         

       CtlEndpoint->XferData(buf,buflen);
       
       
       str.Format(_T("Voltagle=%4ld mV"), buf);
       
       dlg->SetDlgItemTextW(IDC_TEXTDEVINO, str);

         


       

         

      Is there anything wrong with the code? What is difference between USBFS_1_currentTD.wCount=32; and

         


          
          USBFS_1_currentTD.count=32;