how to reduce the delay of i2c

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

how to reduce the delay of i2c

ソリューションへジャンプ
1,692件の閲覧回数
jeffgu
Contributor I

Hello,

I'm using the i2c to read data from device. Presently it is OK to read the data correctly. See the attached waveform:

yellow line: i2c SCL

green line:  i2c SDA

This figure indicates a 10bytes data read, SCL frq=300KHz

In thewaveform, there are 2 long delay during i2c access. The first delay happens between address and first data read, the second delay happens between i2c Nack and i2c Stop. Is there any way to shorten or eliminate these 2 delays?

good_i2c.bmp

For a easy understanding, the source code for i2c reading is like:

    i2c_Start();

    i2c_write_byte(W9002_ADDRESS<<1|I2C_READ);
    i2c_Wait();

    i2c_EnterRxMode();
    i2c_read_byte(dst[0]);   //Dummy read
    i2c_Wait();

    for(i=0;i<8;i++){
        i2c_read_byte(dst[i]);
        i2c_Wait();      
    }

    i2c_DisableAck();

    i2c_read_byte(dst[i++]);
i2c_Wait();

    i2c_Stop();
    i2c_read_byte(dst[i]);

ラベル(1)
タグ(3)
0 件の賞賛
1 解決策
1,035件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello jeff gu:

Those delays can actually be caused by your I2C slave holding the clock line. Can you try with a different slave? Or even without a slave?


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

元の投稿で解決策を見る

0 件の賞賛
3 返答(返信)
1,035件の閲覧回数
jeffgu
Contributor I

Anyone who can help me?

0 件の賞賛
1,036件の閲覧回数
Jorge_Gonzalez
NXP Employee
NXP Employee

Hello jeff gu:

Those delays can actually be caused by your I2C slave holding the clock line. Can you try with a different slave? Or even without a slave?


Regards!,
Jorge Gonzalez

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
1,035件の閲覧回数
jeffgu
Contributor I

Jorge,

Thank you so much for your answer. I tried it without i2c slave, the result is exactly as you said. The delay should be caused by the slave device.

I would like to put the empty slave waveform here for a easy understanding to everyone.

i2c_withoutDigitizer.bmp

0 件の賞賛