5 Replies Latest reply on Dec 12, 2012 10:28 AM by lee.carter

    Is vendor command working by i2c?

    lee.carter

       Hi 

         

      I willing to make slave fifo with i2c in 56pin fx2lp. 

         

      And i2c make by fx2lp's hardware. 

         

      I heard that i2c should using vendor command. 

         

      So i willing to use i2c_hw.c. 

         

       

         

      But i have question in here.

         

      Vendor command is working on i2c?

         

      I'm not sure how can  i call i2c func in windows application. 

         

      What is relationship between vendor command and i2c_hw.c?

        • 1. Re: Is vendor command working by i2c?
          rama.sai.krishna.vakkantula

          Dv2,

             

          Basically you want to do I2C read and write from the PC application. right?.

             

          So whenever you want to do I2C read, your PC side application should send some command to FX2LP so that FX2LP firmware does the I2C read operation (by calling the functions present in i2c_hw.c) whenever it receives that perticular command.

             

          Similarly for I2C write operation.

             

          Your data path is as follows...

             

          Whenever you want to do I2C read..

             

          PC side application sends vendor command to EP0 of FX2LP --> FX2LP parse that command and understands that it has to do I2C read --> FX2LP firmware executes I2C read function in i2c_hw.c file --> FX2LP gets data from the I2C device --> FX2LP can send that data back to PC side application.

             

          You can look at the example projects that you get along with the Cypress Suite USB to get an idea on how to implement PC side application.

             

          Thanks,

             

          sai krishna.

          • 2. Re: Is vendor command working by i2c?
            lee.carter

            Hi. Thanks for reply.

               

            you mean that pc side use vendor command. ok. i understand fully.

               

             

               

            But i  have still some questions.

               

             

               

            1) Are there need any configuration setting(such as DSCR.A51) for I2C work in HW?

               

             

               

             

               

            2) May i just only use following functions for i2c work ? (declared in EZUSE.LIB)?

               

                    EZUSB_InitI2C(); // Initialize I2C Bus

               

            EZUSB_ReadI2C(I2C_Addr, length, buf);

               

            EZUSB_WriteI2C(I2C_Addr, i, ee_str);

            • 3. Re: Is vendor command working by i2c?
              rama.sai.krishna.vakkantula

              Hi,

                 

              You don't have to do any other settings.

                 

              You can directly use the functions

                 

              bit I2CWrite(BYTE i2cAddr, WORD addr, BYTE write_dat) and

                 

              bit I2CRead(BYTE i2cAddr, WORD addr, BYTE *read_dat) which are present in the i2c_hw.c file.

                 

              Thanks,

                 

              sai krishna.

              • 4. Re: Is vendor command working by i2c?
                lee.carter

                Hi sai krishna.

                   

                 

                   

                You mean that i can work i2c without i2c_hw.c?

                   

                Because EZUSB.LIB have I2CWrite(BYTE i2cAddr, WORD addr, BYTE write_dat) and  I2CRead(BYTE i2cAddr, WORD addr, BYTE *read_dat). Right?

                   

                 

                   

                 

                   
                        
                • 5. Re: Is vendor command working by i2c?
                  rama.sai.krishna.vakkantula

                  Yes. You can use them (functions from EZUSB.lib) as well.

                     

                  It's your choice. But you have more flexibility in using the functions present in i2c_hw.c since you have the source code for each function.

                     

                  It is your choice.

                     

                  Thanks,

                     

                  sai krishna.