Hello community,
I am using the LPC824 I2C to talk with a IC slave. The goal is to have this kind of communication as reported in the slave manual
Precondition: I2C HW is correctly working in my board since I can talk to different I2C slaves without issues ( I mean different type of devices...i have more than one unit of the I2C slave that is giving me the problem and I tried all of them and nothing changes).
The problem is that everything is fine until the part pointed by the arrow: LPC824 sends out the slave address which is ACK by the slave, then I have the register and then the I see another ACK in the SDA line but from now on: SCL line is stopped and no clock is present, SDA line keeps staying low forever. I think that the problem comes from the fact that no clock is present ( see oscilloscope screenschot attached).
The code is the following:
if((LPC_I2C0->STAT & MSTSTATE) == MSTSTATE_IDLE){ /* if idle */
LPC_I2C0->MSTDAT=(devaddr<<1); /* send addr w/ R/W bit =0 */
LPC_I2C0->MSTCTL=(1<<MSTSTART); /* send start condition */
}
while(!(LPC_I2C0->STAT & MSTPENDING)) /* wait for i2c0 idle or pending */
I forgot the scope screenshot
Hello @tommino
Thank you for your contacting us.
MSTCONTINUE
before sending the read address. This causes the timing to not comply with the standard I2C specification. Therefore, please change LPC_I2C0->MSTCTL=(1<<MSTCONTINUE);
to LPC_I2C0->MSTCTL = (1 << MSTSTART);
before the read operation.
BR
Alice