AnsweredAssumed Answered

Aduc7060 i2c read

Question asked by Croman13n3c on Jul 9, 2012
Latest reply on Jul 10, 2012 by Croman13n3c

I am try to read data from this mcu ( its i2c slave), but its always answer NACK

Writing data is doing properly

 

Init i2c:

 

     GP0CON0 = BIT4+BIT12;

    GP0KEY1 = 0x07;

    GP0CON1 = BIT1;   

    GP0KEY2 = 0x13;

           

        I2CID0 = 0xA0;

        I2CID1 = 0xA0;

        I2CID2 = 0xA0;

        I2CID3 = 0xA0;

        I2CFSTA = BIT8;// Flush Slave Tx FIFO

        I2CFSTA &=~BIT8;

    I2CSCON = BIT0+BIT4+BIT9+BIT8+BIT10;

 

I2C IRQ :

 

 

if ((IRQSTATUS & BIT16 )==BIT16 ) //i2C interrupt

      {     

        I2CSSTATUS =  I2CSSTA;

                if ((I2CSSTATUS & BIT3)==BIT3)    //I2C slave RX int - FIFO not empty

                {

                        if (storeCount <9)

                        {

                            protocol.data[storeCount]=I2CSRX;

                            storeCount++;

                        }

                        else

                        {

                           

                            storeCount = 0;   

                        }

                }

               

                if ((I2CSSTATUS & BIT2)==BIT2) //I2C Master TX

                    {

                       

                        I2CSTX=0x02;

                    }

               

                if ((I2CSSTATUS & BIT10)==BIT10)    //Stop after start

                    {

                        storeCount = 0;         // Reset counter Array pointer.

                        I2CFSTA = BIT8;       // Flush Slave Tx FIFO

                        I2CFSTA &= ~BIT8;

                    }

               

                if ((I2CSSTATUS & BIT13) == BIT13) // If I2C Repeated Start detected

                    {                       

                        storeCount = 0;            // Reset counter Array pointer.

                        I2CFSTA = BIT8;            // Flush Slave Tx FIFO

                        I2CFSTA &= ~BIT8;

                        }

      }

 

I2C  data from sniffer attached

In which direction to watch ?

Attachments

Outcomes