LPC82x I2C freeze/hang

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC82x I2C freeze/hang

673 Views
krissielski
Contributor I

I am using the LPC824 with LPCOpen and if I attempt more than one I2C access in a row, the I2C hangs.

Using the LPC824 example project "periph_i2cm_polling" and modifying it to do 2 consecutive reads from a Si7021 (Humidity  and temp), it consistently hangs in the LPCOpen driver code.

<< i2cm_8xx.c >>

/* Transmit and Receive data in master mode */
uint32_t Chip_I2CM_XferBlocking(LPC_I2C_T *pI2C, I2CM_XFER_T *xfer)
{
    uint32_t ret = 0;
    /* start transfer */
    Chip_I2CM_Xfer(pI2C, xfer);

    while (ret == 0) {
        /* wait for status change interrupt */
        while (!Chip_I2CM_IsMasterPending(pI2C)) {}    <<<<<<< HANGS HERE ON THE SECOND READ
        /* call state change handler */
        ret = Chip_I2CM_XferHandler(pI2C, xfer);
    }
return ret;
}

Even if I add a small delay (10ms or so) in between reads, it still freezes once in a while.

I have tried LPCOPEN  2.19 (default for MCUXpresso v10.1.1) and 3.02

Is there a cause/fix for this condition?

Labels (2)
0 Kudos
1 Reply

427 Views
victorjimenez
NXP TechSupport
NXP TechSupport

Hi Kris,

Please refer the next community post:

I²C malfunction/freezing of lpc824 I²C communication  

Hope it helps!

Victor.

 

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

0 Kudos