Skip to content

Commit

Permalink
cpu/stm32f1: fixed i2c driver
Browse files Browse the repository at this point in the history
the _stop() function now blocks until the transfer
is complete. Not waiting can lead to concurrent bus
access and subsequent to bus errors.
  • Loading branch information
haukepetersen committed Nov 18, 2015
1 parent 20364ff commit 3d35c33
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cpu/stm32f1/periph/i2c.c
Expand Up @@ -451,6 +451,8 @@ static inline void _stop(I2C_TypeDef *dev)
while (!(dev->SR1 & I2C_SR1_BTF));
/* send STOP condition */
dev->CR1 |= I2C_CR1_STOP;
/* wait until transmission is complete */
while (dev->SR2 & I2C_SR2_BUSY);
}

#if I2C_0_EN
Expand Down

0 comments on commit 3d35c33

Please sign in to comment.