1 Reply Latest reply on Sep 14, 2017 1:28 AM by anks

    I2C bus issue

    patrickciccone

      Hello all,

         

      I have been troubleshooting this problem for about a week now and have finally hit a wall.  Due to IP I cant post any code, but here is what is happening.  We have an intermittent problem of the I2C bus hanging.  When this happens We get an error code of 1 which is the I2C_MSTR_BUS_BUSY code.  I have probed the i2c lines and can verify that SDA is HIGH when this happens, which is confusing me.  I have tried issuing an I2C_Stop; I2C_Start; when this happens but to no avail.  

         

      A little more info; we are using  low power mode so I think there may be a timing issue.  Our current workflow is as follows

         

      [Put device to sleep] -> [I2C calls to devices] -> [power rails off] ->[ put peripherals to sleep, CyPmSleep(PM_SLEEP_TIME_NONE, PM_SLEEP_SRC_CTW);] -> [restore clocks, wake up devices] -> [ power rails on] -> [I2C calls to devices]

         

      The pullups for the I2C bus are currently going to one of the power rails that are turned off during sleep, so technically the I2C peripheral is woke up WITHOUT the power rails being turned on.  I have tried moving those pullups to a power rail that does NOT turn off during low power mode and our issue goes away then, but we would prefer to fix the issue in firmware now.

         

      Just to clarify our issue is that, occasionally the I2C bus becomes unusable, only when exiting sleep mode, returning an error code of 1 for  i2c_error = I2C_MasterSendStart(deviceAddr, 0u).  And when this happens a software I2C Stop / Start doesn't help.  I have to issue a soft reset (CySoftwareReset();) which we have implemented as a watchdog.

         

      So here are my questions. 

         

      1) I am using the fixed function I2C block.  Is there a way to reset the actual I2C hardware?  I see there is a reset pin for the UDB version, but we are running low on UDB's in our implementation.

         

      2) What does Bus busy mean?  I believe it should be that SDA is being pulled low by some peripheral, but in this case that is not the issue.  Is there a way to "force" a bus check?

         

      3) Anything else I can check / try ?

        • 1. Re: I2C bus issue
          anks

          1) I am using the fixed function I2C block.  Is there a way to reset the actual I2C hardware?  I see there is a reset pin for the UDB version, but we are running low on UDB's in our implementation.

          1)Can you clarify what you mean by actual I2C hardware

            

          2) What does Bus busy mean?  I believe it should be that SDA is being pulled low by some peripheral, but in this case that is not the issue.  Is there a way to "force" a bus check?

          2)It means data transaction is still going on