3 Replies Latest reply on Nov 22, 2013 12:58 AM by rama.sai.krishna.vakkantula

    I2C issues on CY7C68013A

    zenith.thomsan

      I am using Cy3684 to test my code. I am writing following code to write some data on lg eeprom, but it doen't seem to work. i also tried tweaking function definition inside i2c.c provided by cypress. I am attaching my keil code here, and the edited i2c.c. I am checking SCL SDA lines using a DSO, but there is no fluctuation. Whereas when a burn iic file to lg eeprom using cyconsole i get fluctuations on SCL SDA lines.

         

       

         

      //main code to write data to eeprom. The data is any dummy data, but it should write.

         

      #include <fx2.h>
      #include <fx2regs.h>
      #include "i2c.c"

      void main(void)
      {

      EZUSB_InitI2C();

      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x02);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x01);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x09);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x02);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x01);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x03);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x10);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x02);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x12);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x02);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x14);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x01);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0xe2);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x16);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x02);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x82);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x20);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0xd0);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0xC2);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x00);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x08);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x25);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x06);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x26);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x5B);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x27);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x9A);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x30);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x10);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x31);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x10);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x32);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x10);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x33);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x10);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x34);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x17);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x35);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x7F);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x40);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0xFF);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x41);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x7F);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x42);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x7F);EZUSB_WaitForEEPROMWrite(0xC2);

      EZUSB_WriteI2C(0xC2,0x01,0x43);EZUSB_WaitForEEPROMWrite(0xC2);
      EZUSB_WriteI2C(0xC2,0x01,0x7F);EZUSB_WaitForEEPROMWrite(0xC2);
      }

         

      Thanks !

        • 1. Re: I2C issues on CY7C68013A
          zenith.thomsan

          I THINK THIS IS A DEAD FORUM.

          • 2. Re: I2C issues on CY7C68013A
            vavc

            Hi

               

             

               

            EZUSB_WriteI2C() function has three parameter. first byte should be the address of the I2C slave, second one is length of data to be written into that address. Third one is the pointer to the data field.

               

            Regarding the first byte, LSB indicates whether to write(0) or read (1). Out of remaing 7 indicates the address. For details about this address refer EZ-USB technical reference manual.

               

            In the  definition of EZUSB_WriteI2C() , the address will be left shifted. It is given in i2c.c file. So if you have to write 0XBA to wirte into a particualr slave, then you have to use 0x5D in the first byte  of EZUSB_WriteI2C.

               

            From you respone i Think you have 0xC2 which is not the proper address of EEPROM on our board.For 0XC2 loading first byte inside the EEPROm should be 0xc2. It is not the address.

               

             

               

            Regards,

               

            Vikas.

            • 3. Re: I2C issues on CY7C68013A
              rama.sai.krishna.vakkantula

               Hi Zen,

                 

              We are really sorry for the delay in responding to your question.

                 

              Please create a tech support case whenever you are looking for a timley response.

                 

              You can create tech support case at:

                 

              https://secure.cypress.com/myaccount/?id=25&techSupport=1

                 

              Please let me know if you need any help in creating a tech support case.

                 

              Thanks,

                 

              Sai Krishna.