This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 285520c0878 arch/arm: Disable I2C NACKIE when a transfer ends.
285520c0878 is described below
commit 285520c08783ca0d7a0b8f35ce622b5e07f1f6e7
Author: danielbuleandra <[email protected]>
AuthorDate: Fri Nov 13 17:02:26 2026 +0100
arch/arm: Disable I2C NACKIE when a transfer ends.
The STM32F7, STM32H7, STM32L4, STM32U5, STM32WB, common STM32 (M0 v1,
M3/M4 v2, M33/M55 v2) and AT32 I2C drivers enable NACKIE for every
transfer, but NACKIE is missing from I2C_CR1_ALLINTS, so it stays
enabled after the transfer ends. A late NACK from a transfer that timed
out can then fire the ISR while the next transfer is being set up. The
ISR ends that transfer and sets priv->msgv to NULL, and
stm32_i2c_sendstart() dereferences it, which causes a hard fault.
Add NACKIE to I2C_CR1_ALLINTS so it is disabled together with the
other I2C interrupts when a transfer ends.
Also fix the nxstyle alignment errors in these files.
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: danielbuleandra <[email protected]>
---
arch/arm/src/at32/at32_i2c.c | 43 +++++++++++++------------
arch/arm/src/common/stm32/stm32_i2c_m0_v1.c | 43 +++++++++++++------------
arch/arm/src/common/stm32/stm32_i2c_m33m55_v2.c | 3 +-
arch/arm/src/common/stm32/stm32_i2c_m3m4_v2.c | 43 +++++++++++++------------
arch/arm/src/stm32f7/stm32_i2c.c | 43 +++++++++++++------------
arch/arm/src/stm32h7/stm32_i2c.c | 43 +++++++++++++------------
arch/arm/src/stm32l4/stm32l4_i2c.c | 43 +++++++++++++------------
arch/arm/src/stm32u5/stm32_i2c.c | 43 +++++++++++++------------
arch/arm/src/stm32wb/stm32wb_i2c.c | 9 +++---
9 files changed, 161 insertions(+), 152 deletions(-)
diff --git a/arch/arm/src/at32/at32_i2c.c b/arch/arm/src/at32/at32_i2c.c
index f1cff26a278..2374352ccd5 100644
--- a/arch/arm/src/at32/at32_i2c.c
+++ b/arch/arm/src/at32/at32_i2c.c
@@ -209,7 +209,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
@@ -644,8 +645,8 @@ static uint32_t at32_i2c_toticks(int msgc, struct i2c_msg_s
*msgs)
#ifndef CONFIG_I2C_POLLED
static inline void at32_i2c_enableinterrupts(struct at32_i2c_priv_s *priv)
{
- at32_i2c_modifyreg32(priv, AT32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ at32_i2c_modifyreg32(priv, AT32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2257,7 +2258,7 @@ static int at32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2544,31 +2545,31 @@ static int at32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/common/stm32/stm32_i2c_m0_v1.c
b/arch/arm/src/common/stm32/stm32_i2c_m0_v1.c
index b8cbdebce4c..79500ed6e15 100644
--- a/arch/arm/src/common/stm32/stm32_i2c_m0_v1.c
+++ b/arch/arm/src/common/stm32/stm32_i2c_m0_v1.c
@@ -289,7 +289,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
@@ -756,8 +757,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
#ifndef CONFIG_I2C_POLLED
static inline void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2369,7 +2370,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2656,31 +2657,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/common/stm32/stm32_i2c_m33m55_v2.c
b/arch/arm/src/common/stm32/stm32_i2c_m33m55_v2.c
index f77cce4db4a..71081becc5e 100644
--- a/arch/arm/src/common/stm32/stm32_i2c_m33m55_v2.c
+++ b/arch/arm/src/common/stm32/stm32_i2c_m33m55_v2.c
@@ -271,7 +271,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
diff --git a/arch/arm/src/common/stm32/stm32_i2c_m3m4_v2.c
b/arch/arm/src/common/stm32/stm32_i2c_m3m4_v2.c
index 8b0fd802c5e..14228ce2a35 100644
--- a/arch/arm/src/common/stm32/stm32_i2c_m3m4_v2.c
+++ b/arch/arm/src/common/stm32/stm32_i2c_m3m4_v2.c
@@ -300,7 +300,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
@@ -771,8 +772,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
#ifndef CONFIG_I2C_POLLED
static inline void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2385,7 +2386,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2672,31 +2673,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/stm32f7/stm32_i2c.c b/arch/arm/src/stm32f7/stm32_i2c.c
index 4c3dc112a8b..5a82b2b78db 100644
--- a/arch/arm/src/stm32f7/stm32_i2c.c
+++ b/arch/arm/src/stm32f7/stm32_i2c.c
@@ -329,7 +329,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
@@ -798,8 +799,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
#ifndef CONFIG_I2C_POLLED
static inline void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2410,7 +2411,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2689,31 +2690,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/stm32h7/stm32_i2c.c b/arch/arm/src/stm32h7/stm32_i2c.c
index 65eb3df23e1..af82b6e0005 100644
--- a/arch/arm/src/stm32h7/stm32_i2c.c
+++ b/arch/arm/src/stm32h7/stm32_i2c.c
@@ -287,7 +287,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* Unused bit in I2c_ISR used to communicate a bad state has occurred in
* the isr processing
@@ -768,8 +769,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
#ifndef CONFIG_I2C_POLLED
static inline void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2386,7 +2387,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2673,31 +2674,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/stm32l4/stm32l4_i2c.c
b/arch/arm/src/stm32l4/stm32l4_i2c.c
index 235ae86b9ff..a991c4c8525 100644
--- a/arch/arm/src/stm32l4/stm32l4_i2c.c
+++ b/arch/arm/src/stm32l4/stm32l4_i2c.c
@@ -314,7 +314,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* I2C event tracing
*
@@ -791,8 +792,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
static inline
void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2574,7 +2575,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2857,31 +2858,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/stm32u5/stm32_i2c.c b/arch/arm/src/stm32u5/stm32_i2c.c
index 2f99e55a86f..9a1bf53a9b2 100644
--- a/arch/arm/src/stm32u5/stm32_i2c.c
+++ b/arch/arm/src/stm32u5/stm32_i2c.c
@@ -315,7 +315,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) | I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* I2C event tracing
*
@@ -792,8 +793,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
static inline
void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2622,7 +2623,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;
@@ -2905,31 +2906,31 @@ static int stm32_i2c_pm_prepare(struct pm_callback_s
*cb, int domain,
switch (pmstate)
{
- case PM_NORMAL:
- case PM_IDLE:
- break;
+ case PM_NORMAL:
+ case PM_IDLE:
+ break;
- case PM_STANDBY:
- case PM_SLEEP:
+ case PM_STANDBY:
+ case PM_SLEEP:
- /* Check if exclusive lock for I2C bus is held. */
+ /* Check if exclusive lock for I2C bus is held. */
- if (nxmutex_is_locked(&priv->lock))
- {
- /* Exclusive lock is held, do not allow entry to deeper PM
- * states.
- */
+ if (nxmutex_is_locked(&priv->lock))
+ {
+ /* Exclusive lock is held, do not allow entry to deeper PM
+ * states.
+ */
- return -EBUSY;
- }
+ return -EBUSY;
+ }
- break;
+ break;
- default:
+ default:
- /* Should not get here */
+ /* Should not get here */
- break;
+ break;
}
return OK;
diff --git a/arch/arm/src/stm32wb/stm32wb_i2c.c
b/arch/arm/src/stm32wb/stm32wb_i2c.c
index e2c67abe444..fdff859f2c8 100644
--- a/arch/arm/src/stm32wb/stm32wb_i2c.c
+++ b/arch/arm/src/stm32wb/stm32wb_i2c.c
@@ -231,7 +231,8 @@
#define MKI2C_OUTPUT(p) (((p) & (GPIO_PORT_MASK | GPIO_PIN_MASK)) |
I2C_OUTPUT)
#define I2C_CR1_TXRX (I2C_CR1_RXIE | I2C_CR1_TXIE)
-#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE)
+#define I2C_CR1_ALLINTS (I2C_CR1_TXRX | I2C_CR1_TCIE | I2C_CR1_ERRIE | \
+ I2C_CR1_NACKIE)
/* I2C event tracing
*
@@ -631,8 +632,8 @@ static uint32_t stm32_i2c_toticks(int msgc, struct
i2c_msg_s *msgs)
static inline
void stm32_i2c_enableinterrupts(struct stm32_i2c_priv_s *priv)
{
- stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
- (I2C_CR1_TXRX | I2C_CR1_NACKIE));
+ stm32_i2c_modifyreg32(priv, STM32_I2C_CR1_OFFSET, 0,
+ (I2C_CR1_TXRX | I2C_CR1_NACKIE));
}
#endif
@@ -2227,7 +2228,7 @@ static int stm32_i2c_process(struct i2c_master_s *dev,
}
else if (status & I2C_INT_PECERR)
{
- /* PEC Error in reception (SMBus Only) */
+ /* PEC Error in reception (SMBus Only) */
i2cerr("ERROR: I2C PEC Error\n");
errval = EPROTO;