LPCOpen bug : Chip_I2CM_XferHandler()

Discussion created by lpcware Employee on Jun 15, 2016
Content originally posted in LPCWare by pierre on Tue Oct 14 00:49:45 MST 2014
This is for LPC4330 and related.

Chip_I2CM_XferHandler() contains a switch/case reacting to the I2C hardware state.

Sometimes it reports an "error" and aborts mid-transaction, but does not reset the hardware, so the next I2C transaction gets stuck.

In fact there is no error. The hardware sometimes sends status code 0xF8 to the IRQ and the manual specifically states that it should be ignored, while LPCOpen treats it as an error.

To fix it, please add this case in the switch :

    /* FIX : STAT = 0xF8
        This status code indicates that no relevant information is available because the serial
        interrupt flag, SI, is not yet set. This occurs between other states and when the I2C block
        is not involved in a serial transfer.

        This function should do nothing at all, modify no registers, and simply return.
case 0xF8:
return 0;

Have a nice day !