Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

AM1806: "free data format" to resolve I2C communication hang

$
0
0

Part Number:AM1806

Dear Champs,

My customer faced I2C line hang and resolve it referring below. They are trying to apply recommendation 2 in below.

I2C Tips - Texas Instruments Wiki

processors.wiki.ti.com

But, they failed to resolve I2C communication hang with method 2 and requested to let them know how 'free data format' should be set to resolve issue.

Could you please let me know exact sequence to set 'free data format'?

Or could you please check below my customer's code to set 'free data format'?

They set FDF bit in ICMDR register as below, and they found it worked well in normal IDLE case(data=0xff).

In issued situation, they failed to resolve 'SDA Low' issue and there is no SCL even after 100 retries.

voidi2c_free_data_format(PI2C_REGS_T i2c)

{

        unsignedint icmdr, irq_status;

        unsignedint retry = 0, timeout = 0;

        unsignedchar data = 0;

 

        while( data != 0xff )

        {

               icmdr = I2C_ICMDR_IRS | I2C_ICMDR_MST | I2C_ICMDR_STT | I2C_ICMDR_STP | I2C_ICMDR_FDF;

 

               /* i2c mode register set */

               writel(icmdr, &i2c->ICMDR);

 

               for(timeout = 0; timeout < 100; timeout++)

               {

                       udelay(100);

 

                       irq_status = readl(&i2c->ICSTR);

 

                       if(irq_status & I2C_ICSTR_ICRRDY)

                       {

                              data = readl(&i2c->ICDRR);

 

                              for(timeout = 0; timeout < 100; timeout++)

                              {

                                      udelay(100);

 

                                      irq_status = readl(&i2c->ICSTR);

 

                                      if(irq_status & (I2C_ICSTR_SCD|I2C_ICSTR_NACK))

                                              break;

                              }

                              break;

                       }

               }

 

               /* clear interrupt status register */

               writel(0xffff, &i2c->ICSTR);

 

               /* clear mode control register */

               writel(0, &i2c->ICMDR);

               writel(0, &i2c->ICMDR);

 

               retry++;

               if(retry == 100)

                       break;

 

               mdelay(1);

        }

 

        console_printf("\nFree Data format SDA [0x%02x] Retry [%d]", data, retry);

}

 

Thanks and Best Regards,

SI.


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>