You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by da...@apache.org on 2019/12/21 10:56:12 UTC
[incubator-nuttx] 04/05: imxrt:lpi2c Fix interrupt storm on failed
write.
This is an automated email from the ASF dual-hosted git repository.
davids5 pushed a commit to branch master_imxrt
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit 3dcd238d5e81b7f2ba987e32d5623cd1d89aa446
Author: David Sidrane <Da...@NscDg.com>
AuthorDate: Thu Dec 12 16:29:42 2019 -0800
imxrt:lpi2c Fix interrupt storm on failed write.
The SDF was not acked if ther was an error
on the last write.
---
arch/arm/src/imxrt/imxrt_lpi2c.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/arch/arm/src/imxrt/imxrt_lpi2c.c b/arch/arm/src/imxrt/imxrt_lpi2c.c
index 2a90c16..20c0f80 100644
--- a/arch/arm/src/imxrt/imxrt_lpi2c.c
+++ b/arch/arm/src/imxrt/imxrt_lpi2c.c
@@ -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)
{