This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

I2C session abruptly ends

Hi!

I'm working on LPC1857 controller and I required to test the i2c code I wrote. As far as I can see,as per data-sheet I've got all right with code. While the application is run, i2c is disabled.

I debugged and found that while clearing only the i2c-interrupt flag the entire control register for i2c is cleared, thereby disabling i2c.

>LPC_I2C0->CONCLR |= 0X00000008; // clear i2c interrupt only

Hope I made my doubt clear.

Thanks for anyone suggest anything to avoid this problem.

Parents
  • LPC_I2C0->CONCLR |= 0X00000008;
    


    You do a read/modify/write there when you perform a bit-or.

    Without using your specific processor I still wonder if you really need to do that.

    A register named "CLR" normally don't require any read/modify/write.

    Can't you just write the following?

    LPC_I2C0->CONCLR = 0X00000008;
    

Reply
  • LPC_I2C0->CONCLR |= 0X00000008;
    


    You do a read/modify/write there when you perform a bit-or.

    Without using your specific processor I still wonder if you really need to do that.

    A register named "CLR" normally don't require any read/modify/write.

    Can't you just write the following?

    LPC_I2C0->CONCLR = 0X00000008;
    

Children