mirror of
https://github.com/apache/nuttx.git
synced 2026-05-27 11:26:12 +08:00
STM32 I2C: Bring in PX4 fix for I2C in very high noise environments or with rogue perpipherals. Taken from the PX4 commit by Tridge
This commit is contained in:
@@ -7322,4 +7322,8 @@
|
|||||||
* binfmt/libpcode, pcode.c, include/nuttx/poff.h, and binfmt/pcode.h:
|
* binfmt/libpcode, pcode.c, include/nuttx/poff.h, and binfmt/pcode.h:
|
||||||
Now uses apps/interpreters/prun and is basically functional. More work
|
Now uses apps/interpreters/prun and is basically functional. More work
|
||||||
is needed because (1) it is too coupled with apps/ and (2) will not work
|
is needed because (1) it is too coupled with apps/ and (2) will not work
|
||||||
with CONFIG_NUTTX_KERNEL (2014-5-9).
|
with CONFIG_NUTTX_KERNEL (2014-5-9).
|
||||||
|
* arch/arm/src/stm32/stm32_i2c.c: Bring in PX4 fix for I2C in very high
|
||||||
|
noise environments or with rogue perpipherals. Taken from the PX4 commit
|
||||||
|
099b2017ccfa0fc7696f168db2a0c2e13fe5edbc by Tridge here:
|
||||||
|
https://github.com/PX4/NuttX (2014-5-10).
|
||||||
|
|||||||
@@ -698,7 +698,6 @@ config STM32_STM32F207
|
|||||||
default n
|
default n
|
||||||
select STM32_HAVE_OTGFS
|
select STM32_HAVE_OTGFS
|
||||||
select STM32_HAVE_FSMC
|
select STM32_HAVE_FSMC
|
||||||
select STM32_HAVE_CCM
|
|
||||||
select STM32_HAVE_USART3
|
select STM32_HAVE_USART3
|
||||||
select STM32_HAVE_USART4
|
select STM32_HAVE_USART4
|
||||||
select STM32_HAVE_USART5
|
select STM32_HAVE_USART5
|
||||||
|
|||||||
@@ -1617,7 +1617,14 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
|
|
||||||
stm32_i2c_clrstart(priv);
|
stm32_i2c_clrstart(priv);
|
||||||
|
|
||||||
/* Old transfers are done */
|
/* Old transfers are done
|
||||||
|
*
|
||||||
|
* Reset ptr and dcnt to ensure an unexpected data interrupt doesn't
|
||||||
|
* overwrite stale data.
|
||||||
|
*/
|
||||||
|
|
||||||
|
priv->dcnt = 0;
|
||||||
|
priv->ptr = NULL;
|
||||||
|
|
||||||
priv->msgv = msgs;
|
priv->msgv = msgs;
|
||||||
priv->msgc = count;
|
priv->msgc = count;
|
||||||
@@ -1754,6 +1761,11 @@ static int stm32_i2c_process(FAR struct i2c_dev_s *dev, FAR struct i2c_msg_s *ms
|
|||||||
stm32_i2c_enablefsmc(ahbenr);
|
stm32_i2c_enablefsmc(ahbenr);
|
||||||
stm32_i2c_sem_post(dev);
|
stm32_i2c_sem_post(dev);
|
||||||
|
|
||||||
|
/* Ensure that any ISR happening after we finish can't overwrite any user data */
|
||||||
|
|
||||||
|
priv->dcnt = 0;
|
||||||
|
priv->ptr = NULL;
|
||||||
|
|
||||||
return -errval;
|
return -errval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user