1 Reply Latest reply on Jan 29, 2016 5:31 AM by user_1377889

    I2C Reset PSoC Creator 3.3

    cyguevara_1509311

      Hi everyone,

         

       

         

      I had a similar situation to the topic posted here: http://www.cypress.com/forum/psoc-4-architecture/reset-i2c

         

      I'm trying to communicate with an I2C device but sometimes the device is hung up, (SDA low), and it doesn't work until I turn off the power, I was trying to use teh directives of the previous post, but the new component doesn't include them.

         

       

         

          while(I2C_1_sda_Read() == 0) // SDA hang low
          {
              I2C_1_SET_I2C_SCL_HSIOM_SEL(I2C_1_HSIOM_GPIO_SEL); //Switch to GPIO    
              I2C_1_scl_Write(0);
              CyDelay(1);
              I2C_1_scl_Write(1);
              CyDelay(1);
              I2C_1_SET_I2C_SCL_HSIOM_SEL(I2C_1_HSIOM_I2C_SEL); //Switch to Component
          }
          I2C_1_I2CMasterSendStop();

         

       

         

      Is there another way to reset the I2C bus and get out from the infinite loop (Waiting ACK or NACK) in case the device got hung in the middle of the program?

        • 1. Re: I2C Reset PSoC Creator 3.3
          user_1377889

          I have seen solutions to pull down the sda low for 9 or more clock cycles. This will be seen by "hanging" slaves as a lost arbitration and will release the bus cancelling current transmission. There is a generated file.h for the sda pin. Use those functions to access the pin directly.

             

          When starting a master-slave communication, try to check the result from I2C_SendStart() and in case of error do no further access.

             

           

             

          Bob