arch/arm/src/stm32h7 and stm32l4: Apply David Sidrane's fix for the STM32F7 to the STM32L4 and STM32H7. The same change might be appropropriate to STMF0/LO and STM32, but the patch does not apply cleanly. It would have to be manually checked.

This commit is contained in:
Gregory Nutt 2019-02-19 14:47:27 -06:00
parent 44919b6723
commit 432f487581
2 changed files with 22 additions and 8 deletions

View File

@ -1710,7 +1710,7 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
* can't write NBYTES to clear TCR so it will fire forever.
*/
if ((priv->msgc - 1) == 0)
if (priv->msgc == 1)
{
stm32_i2c_disable_reload(priv);
}
@ -1861,11 +1861,18 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
i2cinfo("TC: ENTER dcnt = %i msgc = %i status 0x%08x\n",
priv->dcnt, priv->msgc, status);
/* Prior message has been sent successfully */
/* Prior message has been sent successfully. Or there could have
* been an error that set msgc to 0; So test for that case as
* we do not want to decrement msgc less then zero nor move msgv
* past the last message.
*/
priv->msgc--;
if (priv->msgc > 0)
{
priv->msgc--;
}
/* if additional messages remain to be transmitted / received */
/* Are there additional messages remain to be transmitted / received? */
if (priv->msgc > 0)
{

View File

@ -1880,7 +1880,7 @@ static int stm32l4_i2c_isr_process(struct stm32l4_i2c_priv_s *priv)
* can't write NBYTES to clear TCR so it will fire forever.
*/
if ((priv->msgc - 1) == 0)
if (priv->msgc == 1)
{
stm32l4_i2c_disable_reload(priv);
}
@ -2031,11 +2031,18 @@ static int stm32l4_i2c_isr_process(struct stm32l4_i2c_priv_s *priv)
i2cinfo("TC: ENTER dcnt = %i msgc = %i status 0x%08x\n",
priv->dcnt, priv->msgc, status);
/* Prior message has been sent successfully */
/* Prior message has been sent successfully. Or there could have
* been an error that set msgc to 0; So test for that case as
* we do not want to decrement msgc less then zero nor move msgv
* past the last message.
*/
priv->msgc--;
if (priv->msgc > 0)
{
priv->msgc--;
}
/* if additional messages remain to be transmitted / received */
/* Are there additional messages remain to be transmitted / received? */
if (priv->msgc > 0)
{