From c048ac69ff536f95a814b8b121842e120b36988b Mon Sep 17 00:00:00 2001 From: barthess Date: Thu, 5 Jan 2012 19:19:13 +0000 Subject: I2C. Initialization of RC2 register now doing only once in start() function. git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@3744 35acf78f-673a-0410-8e92-d51de3d6d3f4 --- os/hal/platforms/STM32/i2c_lld.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/os/hal/platforms/STM32/i2c_lld.c b/os/hal/platforms/STM32/i2c_lld.c index 8865be470..eade3bb8a 100644 --- a/os/hal/platforms/STM32/i2c_lld.c +++ b/os/hal/platforms/STM32/i2c_lld.c @@ -147,6 +147,7 @@ static void i2c_lld_abort_operation(I2CDriver *i2cp) { /* Stops the I2C peripheral.*/ i2cp->i2c->CR1 = I2C_CR1_SWRST; i2cp->i2c->CR1 = 0; + i2cp->i2c->CR2 = 0; i2cp->i2c->SR1 = 0; /* Stops the associated DMA streams.*/ @@ -311,11 +312,9 @@ static void i2c_lld_serve_event_interrupt(I2CDriver *i2cp) { break; case I2C_EV6_MASTER_REC_MODE_SELECTED: dmaStreamEnable(i2cp->dmarx); - i2cp->i2c->CR2 |= I2C_CR2_DMAEN | I2C_CR2_LAST; break; case I2C_EV6_MASTER_TRA_MODE_SELECTED: dmaStreamEnable(i2cp->dmatx); - i2cp->i2c->CR2 |= I2C_CR2_DMAEN | I2C_CR2_LAST; break; case I2C_EV8_2_MASTER_BYTE_TRANSMITTED: /* Catches BTF event after the end of transmission.*/ @@ -669,7 +668,8 @@ void i2c_lld_start(I2CDriver *i2cp) { /* Reset i2c peripheral.*/ i2cp->i2c->CR1 = I2C_CR1_SWRST; i2cp->i2c->CR1 = 0; - i2cp->i2c->CR2 = I2C_CR2_ITERREN | I2C_CR2_ITEVTEN; + i2cp->i2c->CR2 = I2C_CR2_ITERREN | I2C_CR2_ITEVTEN | + I2C_CR2_DMAEN | I2C_CR2_LAST; /* Setup I2C parameters.*/ i2c_lld_set_clock(i2cp); -- cgit v1.2.3