aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2017-05-29 09:39:09 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2017-05-29 09:39:09 +0000
commitceb326112d0dfd0ec3ab53995b6b7810903b8a42 (patch)
tree44812606b68a412a4e74de87083e6d89d043c5c1
parent1ab61e8d8f03953e328466e58c041372164f14a4 (diff)
downloadChibiOS-ceb326112d0dfd0ec3ab53995b6b7810903b8a42.tar.gz
ChibiOS-ceb326112d0dfd0ec3ab53995b6b7810903b8a42.tar.bz2
ChibiOS-ceb326112d0dfd0ec3ab53995b6b7810903b8a42.zip
Fixed bug #781.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@10228 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c18
-rw-r--r--os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c12
-rw-r--r--readme.txt1
3 files changed, 16 insertions, 15 deletions
diff --git a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c
index fe53809a0..20b8cf8b6 100644
--- a/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c
+++ b/os/hal/ports/STM32/LLD/I2Cv1/hal_i2c_lld.c
@@ -537,18 +537,18 @@ void i2c_lld_init(void) {
void i2c_lld_start(I2CDriver *i2cp) {
I2C_TypeDef *dp = i2cp->i2c;
- i2cp->txdmamode = STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE |
- STM32_DMA_CR_MINC | STM32_DMA_CR_DMEIE |
- STM32_DMA_CR_TEIE | STM32_DMA_CR_TCIE |
- STM32_DMA_CR_DIR_M2P;
- i2cp->rxdmamode = STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE |
- STM32_DMA_CR_MINC | STM32_DMA_CR_DMEIE |
- STM32_DMA_CR_TEIE | STM32_DMA_CR_TCIE |
- STM32_DMA_CR_DIR_P2M;
-
/* If in stopped state then enables the I2C and DMA clocks.*/
if (i2cp->state == I2C_STOP) {
+ i2cp->txdmamode = STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE |
+ STM32_DMA_CR_MINC | STM32_DMA_CR_DMEIE |
+ STM32_DMA_CR_TEIE | STM32_DMA_CR_TCIE |
+ STM32_DMA_CR_DIR_M2P;
+ i2cp->rxdmamode = STM32_DMA_CR_PSIZE_BYTE | STM32_DMA_CR_MSIZE_BYTE |
+ STM32_DMA_CR_MINC | STM32_DMA_CR_DMEIE |
+ STM32_DMA_CR_TEIE | STM32_DMA_CR_TCIE |
+ STM32_DMA_CR_DIR_P2M;
+
#if STM32_I2C_USE_I2C1
if (&I2CD1 == i2cp) {
bool b;
diff --git a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c
index 89607d772..f2c9c95e9 100644
--- a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c
+++ b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c
@@ -672,18 +672,18 @@ void i2c_lld_init(void) {
void i2c_lld_start(I2CDriver *i2cp) {
I2C_TypeDef *dp = i2cp->i2c;
-#if STM32_I2C_USE_DMA == TRUE
- /* Common DMA modes.*/
- i2cp->txdmamode = DMAMODE_COMMON | STM32_DMA_CR_DIR_M2P;
- i2cp->rxdmamode = DMAMODE_COMMON | STM32_DMA_CR_DIR_P2M;
-#endif
-
/* Make sure I2C peripheral is disabled */
dp->CR1 &= ~I2C_CR1_PE;
/* If in stopped state then enables the I2C and DMA clocks.*/
if (i2cp->state == I2C_STOP) {
+#if STM32_I2C_USE_DMA == TRUE
+ /* Common DMA modes.*/
+ i2cp->txdmamode = DMAMODE_COMMON | STM32_DMA_CR_DIR_M2P;
+ i2cp->rxdmamode = DMAMODE_COMMON | STM32_DMA_CR_DIR_P2M;
+#endif
+
#if STM32_I2C_USE_I2C1
if (&I2CD1 == i2cp) {
diff --git a/readme.txt b/readme.txt
index 0b9bed532..e9b74eada 100644
--- a/readme.txt
+++ b/readme.txt
@@ -261,6 +261,7 @@
(backported to 16.1.6).
- HAL: Fixed STM32F105 port not compiling (bug #782)
(backported to 16.1.6, 3.0.6, 2.6.10).
+- HAL: Fixed I2Cv1 Freeze when started twice (bug #781)(backported to 16.1.9).
- HAL: Fixed wrong registry for STM32F205xx and STM32F215xx port
(bug #780)(backported to 16.1.6, 3.0.6).
- HAL: Fixed wrong HSE checks and PLL2 enable switch in STM32F105 and