Skip to content

Commit

Permalink
imxrt:lpi2c Fix interrupt storm on failed write.
Browse files Browse the repository at this point in the history
   The SDF was not acked if ther was an error
   on the last write.
  • Loading branch information
davids5 committed Dec 21, 2019
1 parent 0050ba9 commit 3dcd238
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions arch/arm/src/imxrt/imxrt_lpi2c.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,11 +1245,17 @@ static int imxrt_lpi2c_isr_process(struct imxrt_lpi2c_priv_s *priv)

imxrt_lpi2c_tracenew(priv, status);

/* Continue with either sending or reading data */
/* After an error we can get an SDF */

if (priv->intstate == INTSTATE_DONE && (status & LPI2C_MSR_SDF) != 0)
{
imxrt_lpi2c_traceevent(priv, I2CEVENT_STOP, 0);
imxrt_lpi2c_putreg(priv, IMXRT_LPI2C_MSR_OFFSET, LPI2C_MSR_SDF);
}

/* Check if there is more bytes to send */

if (((priv->flags & I2C_M_READ) == 0) && (status & LPI2C_MSR_TDF) != 0)
else if (((priv->flags & I2C_M_READ) == 0) && (status & LPI2C_MSR_TDF) != 0)
{
if (priv->dcnt > 0)
{
Expand Down

0 comments on commit 3dcd238

Please sign in to comment.