aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/STM32
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-04-01 16:16:18 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2013-04-01 16:16:18 +0000
commit356fb1a2a03fa00622580077007622d5c5e62555 (patch)
tree9044349351cd922c62f2343ce377b4e548086e55 /os/hal/platforms/STM32
parent0ebb7959d58256bea8e65b2cbed282e840297880 (diff)
downloadChibiOS-356fb1a2a03fa00622580077007622d5c5e62555.tar.gz
ChibiOS-356fb1a2a03fa00622580077007622d5c5e62555.tar.bz2
ChibiOS-356fb1a2a03fa00622580077007622d5c5e62555.zip
I2Cv2 driver tested on STM32F37x.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@5526 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/STM32')
-rw-r--r--os/hal/platforms/STM32/I2Cv2/i2c_lld.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/os/hal/platforms/STM32/I2Cv2/i2c_lld.c b/os/hal/platforms/STM32/I2Cv2/i2c_lld.c
index 6668c212f..3b7b52e3b 100644
--- a/os/hal/platforms/STM32/I2Cv2/i2c_lld.c
+++ b/os/hal/platforms/STM32/I2Cv2/i2c_lld.c
@@ -177,10 +177,20 @@ static void i2c_lld_serve_interrupt(I2CDriver *i2cp, uint32_t isr) {
}
else {
dp->CR2 |= I2C_CR2_STOP;
- wakeup_isr(i2cp, RDY_OK);
}
}
+ else if (isr & I2C_ISR_STOPF) {
+ /* Stops the associated DMA streams.*/
+ dmaStreamDisable(i2cp->dmatx);
+ dmaStreamDisable(i2cp->dmarx);
+
+ wakeup_isr(i2cp, RDY_OK);
+ }
else if (isr & I2C_ISR_NACKF) {
+ /* Stops the associated DMA streams.*/
+ dmaStreamDisable(i2cp->dmatx);
+ dmaStreamDisable(i2cp->dmarx);
+
i2cp->errors |= I2CD_ACK_FAILURE;
wakeup_isr(i2cp, RDY_RESET);
}
@@ -503,8 +513,8 @@ void i2c_lld_start(I2CDriver *i2cp) {
dmaStreamSetPeripheral(i2cp->dmatx, &dp->TXDR);
/* Reset i2c peripheral.*/
- dp->CR1 = i2cp->config->cr1 | I2C_CR1_ERRIE | I2C_CR1_NACKIE |
- I2C_CR1_TCIE | I2C_CR1_TXDMAEN | I2C_CR1_RXDMAEN;
+ dp->CR1 = i2cp->config->cr1 | I2C_CR1_ERRIE | I2C_CR1_STOPIE |
+ I2C_CR1_NACKIE | I2C_CR1_TCIE | I2C_CR1_TXDMAEN | I2C_CR1_RXDMAEN;
/* Set slave address field (master mode) */
dp->CR2 = (i2cp->config->cr2 & ~I2C_CR2_SADD);