1 Reply Latest reply on Feb 8, 2017 1:58 AM by nisa

    Trying to make a control trnasfer doubts about SETUPDATA

    aurquiel_2047911

      I am trying to comunicate form a Linux Host Laptop using libusb1.0

         

       

         

      I get the all the device descriptor i can recognize de device, I am trying to send a data now

         

       

         

      unsigned char *datatx = new unsigned char[1]; //data to write
              datatx[0]=0xA6;

         

      //Response 1 fail, response 0 successful

         

      int response = libusb_control_transfer(device_handle,???, //bmRequestType
                      ??? , //bRequest
                      ???, //wValue
                      ???, //wIndex
                      datatx, //data to write
                      1, //wLength lehnt on bytes of data
                      1 //timeout waitting response
                  );

         

       

         

      My questions are about those fields bmRequestype, bRequest, wValueL, wValueH, wIndexL, wIndexH, wLengthL, wLengthH .This are 8 bytes, "b" prefix means byte and "w" prefix means word=2bytes.

         

       

         

      This bytes mark as ??? i must declare in my firmware SETUPDATA or there are by default with some value?

         

      If i must to declare those register where there are what are their names?

        • 1. Re: Trying to make a control trnasfer doubts about SETUPDATA
          nisa

          Please refer to the USBBulkSourceSink example firmware in the FX3 SDK. We have decoded the values of  "bmRequestype, bRequest, wValueL, wValueH, wIndexL" using the setupdata information.  Please refer: CyFxBulkSrcSinkApplnUSBSetupCB

             

          I understand you are concerned about the host application on how to send control transfer. We have provided cyusb_linux application in the FX3 SDK for linux, where we have use these for various kind of transfers. Please refer the src file of the cyusb_linux where we have used cyusb_control_transfer funtion to do the same which internally calls the libusb_control_transfer.  You can use the libusb function libusb_control_transfer(h, bmRequestType, bRequest, wValue, wIndex, data, wLength, timeout) These parameters will geneate the setupdata0/1 for the USB device. There are multiple things you can do with these parameters, so whatever you do, these parameters need to be handled by the device. If you look at the CyFxBulkSrcSinkApplnUSBSetupCB, you will know how we are handling these event. Please refer and let us know if you need any clarification