stm32:stm32 alt I2C ensure proper error handling.

Injecting data errors would cause the driver to
  continually reenter the isr with BERR an RxNE.
  This fix allows the error to be cleared and
  propagated to the waiting task.
This commit is contained in:
David Sidrane 2017-09-12 13:42:18 -10:00
parent 617c91b373
commit ef411578d5

View File

@ -1840,6 +1840,20 @@ static int stm32_i2c_isr_process(struct stm32_i2c_priv_s *priv)
* the ISR cycle to handle the sending/receiving of the messages.
*/
/* First check for errors */
if ((status & I2C_SR1_ERRORMASK) != 0)
{
stm32_i2c_traceevent(priv, I2CEVENT_ERROR, status & I2C_SR1_ERRORMASK);
/* Clear interrupt flags */
stm32_i2c_putreg(priv, STM32_I2C_SR1_OFFSET, 0);
priv->dcnt = -1;
priv->msgc = 0;
}
if (priv->dcnt == -1 && priv->msgc == 0)
{
i2cinfo("Shutting down I2C ISR\n");