5 Replies Latest reply on Nov 15, 2018 1:29 AM by yizd

    cyapi.lib  Control Center I2C EEPROM

    yumingfoy_3247926

      Hi!

       

      1.bmp

      The IDE gives packaged applications control center without specific code to look up. Now I'm going to use the method provided by cypress in cyapi.lib to do this transfer through EP0. How do I do that?

      At the same time, if the slave device FX3 receives such instructions, I require it to be fed back through EP0, and the upper computer software receives it again, then how should the upper computer software be implemented?

      Because I didn't find a similar example. Cypress provides cyapi.lib, but I didn't find any examples and don't know how to use these methods.Could you help me?

       

        • 1. Re: cyapi.lib  Control Center I2C EEPROM
          yizd

          Hi,

           

          We have a instruction document tells you how to use the cyapi.lib:

          http://www.cypress.com/file/138766/download

           

          Regards,

          Yi

          • 2. Re: cyapi.lib  Control Center I2C EEPROM
            yumingfoy_3247926

            Hi!

            You didn't understand my question.

            I have loaded UsbI2cDmaMode into FX3,if I use control center 1.png,1.png

            I can get 1.png by Hyper Terminal as I wrote  CyU3PDebugPrint (4, "I'm in write\r\n");   in cyfxusbi2cdmamode.c

             

            1.png

             

            As like this,I wrote my own PC code:

                     CCyUSBDevice *USBDevice = new CCyUSBDevice(NULL);

             

                     CCyControlEndPoint *ept = USBDevice->ControlEndPt;

                     ept->Target = TGT_DEVICE;

                     ept->ReqType = REQ_VENDOR;

                     ept->Direction = DIR_TO_DEVICE;

                     ept->ReqCode = 0xBA;

                     ept->Value = 0;

                     ept->Index = 0;

                     unsigned char buf[1];

                     ZeroMemory(buf, 1);

                     LONG buflen = 1;

                     ept->XferData(buf, buflen);

            but no result.Which is wrong? What should i do?

            The pc code's architecture is right,because I used it to other test.

            • 3. Re: cyapi.lib  Control Center I2C EEPROM
              yizd

              Hi,

               

              Can you program detect whether your device is connected?

              If your firmware works well, then the problem is in your PC applications.

              I suggest you take a look at the link I sent to you first, it has helpful content in develop application including ANALYZING & DEBUGGING THE CODE you write.

               

              Regards,

              Yi

              • 4. Re: cyapi.lib  Control Center I2C EEPROM
                yumingfoy_3247926

                Hi,

                Didn't i write clear! Assume all environment is all right!

                I just want to send vendor order ,write and read.

                In the CYAPI.pdf only like this:

                 

                 

                 

                CCyUSBDevice *USBDevice = new
                CCyUSBDevice(NULL);
                // Just for typing efficiency
                CCyControlEndPoint *ept = USBDevice-
                >ControlEndPt;
                ept->Target = TGT_DEVICE;
                ept->ReqType = REQ_VENDOR;
                ept->Direction = DIR_TO_DEVICE;
                ept->ReqCode =
                0x05;
                ept->Value =
                1;
                ept->Index =
                0;
                unsigned char buf[512];
                ZeroMemory(buf,
                512);

                 

                 

                 

                 

                it doesn't have nothing.It didn't work.

                Do you have any detailed demos?

                • 5. Re: cyapi.lib  Control Center I2C EEPROM
                  yizd

                  Hi, 

                   

                  The code you put here is quoted from the CyAPI.pdf. It is just constructing the CCyControlEndPoint class. I can't see anything wrong from it.

                  I suggest you can add some debugging code to you code to find where is wrong, like printing the return value of XferData to see if the data transferring succeed.

                   

                  Regards,

                  Yi