3 Replies Latest reply on Feb 26, 2013 7:01 AM by nikhil.naik

    Is there any way for i2c debugging without oscilloscope?

    lee.carter

       Hi

         

      I want find ack signal in EZUSB_i2c function. 

         

      But i have not oscilloscope so i need to find way without oscilloscope to find ack status . 

         

      And i want find status ack signal in read or write in i2c. 

         

      So, is there any way how to find ack signal ?

        • 1. Re: Is there any way for i2c debugging without oscilloscope?
          user_1377889

          I found me a logic analizer to check my I²C connection and it worked like a charm, not only showing ACK/NAK but the address and data transferred as well. Depending on where you are located, you'll use a different manufacturer, I bought mine from here : http://www.ikalogic.com/

             

           

             

          Bob

          • 2. Re: Is there any way for i2c debugging without oscilloscope?
            lee.carter

             Thanks. But it is not what i want answer. 

            • 3. Re: Is there any way for i2c debugging without oscilloscope?
              nikhil.naik

               Hi

                 

              You can check the ACK flag  after writing the I2C data and report 1 or 0 on EP0 endpoint and check what value you are receiving on the EP0.

                 

              For Eg check the following code:

                 

               

                 

              BYTE y;

                 

              y=0;

                 

              while (I2CS & bmSTOP);

                 

              // set the START bit and write the address

                 

              I2CS = bmSTART;

                 

              I2DAT = SETUPDAT[5];

                 

              while (!(I2CS & bmDONE));

                 

              while (!(I2CS & bmACK));

                 

              // write at requested address

                 

              I2DAT = SETUPDAT[3];

                 

              while (!(I2CS & bmDONE));

                 

              while (!(I2CS & bmACK));

                 

              I2DAT = SETUPDAT[2];

                 

              while (!(I2CS & bmDONE));

                 

              while (!(I2CS & bmACK));

                 

              // write at requested byte

                 

              I2DAT = SETUPDAT[4];

                 

              while (!(I2CS & bmDONE));

                 

              while (!(I2CS & bmACK));

                 

              I2CS = bmSTOP;

                 

              y=1;

                 

              EP0BUF[0]=0xFF;

                 

              EP0BCH=0;

                 

              EP0BCL=1;

                 

               

                 

               

                 

              In the above code snippet, for IN transfer you will receive 0xFF on EP0 if all the I2C tranfers complete otherwise the program will get stuck in loop:  while (!(I2CS & bmACK));

                 

              and the IN transfer would fail.

                 

              I hope this post answers your question.

                 

               

                 

              Thanks

                 

              Nikhil