LPC54018 I2C timeout register issue

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

LPC54018 I2C timeout register issue

1,890 次查看
Renuga_AKAS
Contributor I

Hi,

    I have tried to timeout the i2c communication but failed to achieve through i2c interrupt method. First i enabled the SCLTIMEOUT and EVENTTIMEOUT bit in INTENSET register and configured the TIMEOUT register as 500, then i disconnected the clock PIN from the evk board. The EEPROM IC didn't acknowledge the slave address and it was held in a loop for long time. Can you suggest me how to achieve the timeout in i2c interrupt communication?

0 项奖励
回复
5 回复数

1,869 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Because there is pull-up resistor on both the SCL and SDA pin, if you disable SCL, the SCL pin will be high, and SDA is also high, this is idle mode, timeout mechanism does not take effect.

 For a test, during the I2C transferring process, you can connect the SCL to GND manually, then the timeout will take effect.

Hope it can help you

BR

XiangJun Rong

0 项奖励
回复

1,867 次查看
Renuga_AKAS
Contributor I
Hi,
    Thanks for the reply. Actually I already tried this option too by connecting the SCL PIN directly to GND still it doesn't work. And I have one more doubt if I set I2C->TIMEOUT = 5000, then set baudrate in standard mode (100kHz). While debugging I2C->TIMEOUT shown as 5007. Is any  other way to attain I2C timeout?
0 项奖励
回复

1,857 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Pls try to post your code so that we can have a review.

BR

XiangJun Rong

0 项奖励
回复

1,853 次查看
Renuga_AKAS
Contributor I

Hi,

    First of all, I have initialized the I2C bus. Then send data through i2c interrupt concept. Hereby I have attached the code for your reference.

SYSCON->AHBCLKCTRLSET[1] = 1 << 12;

SYSCON->PRESETCTRLSET[1] = 1 << 12;

SYSCON

->PRESETCTRLCLR[1] = 1 << 12;

FLEXCOMM1->PSELID = 0x101073;

I2C1->CFG = 0x01;

I2C1->CLKDIV = 0x07;

I2C1->TIMEOUT = 5000;

I2C1->MSTTIME = 0x56;

I2C1->INTENCLR = (1 << 0) | (1 << 4) | (1 << 6) | (1 << 24) | (1 << 25);

    And the following i have used it while transmitting data through I2C interrupt.

I2C1->INTENCLR = (1 << 0) | (1 << 4) | (1 << 6) | (1 << 24) | (1 << 25);

I2C1->STAT = (1 << 4) | (1 << 6) | (1 << 24) | (1 << 25);

I2C1->INTENSET = (1 << 0) | (1 << 4) | (1 << 6) | (1 << 24) | (1 << 25);

I2C1->MSTDAT = I2C_Slave_addr | write_bit;

I2C1->MSTCTL = 0x02;

0 项奖励
回复

1,783 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

I have not seen the NVIC module configuration, pls try to use the instructions.

__NVIC_EnableIRQ(FLEXCOMM0_IRQ1);

__NVIC_SetPriority(FLEXCOMM0_IRQ1,0x00);

Hope it can help you

BR

XiangJun Rong

0 项奖励
回复