Page 1 of 1

patch : fix dma_mask for F76X F77X I2C4_RX  Topic is solved

Posted: Thu Apr 18, 2019 10:49 pm
by alex31
Hello,

STM32_DMA_STREAM_ID_MSK(1, 5) is a missing for STM32_I2C4_TX_DMA_MSK in 18.2, 19.1 and trunk

patch for 18.2 :
[code]
[diff --git a/os/hal/ports/STM32/STM32F7xx/stm32_registry.h b/os/hal/ports/STM32/STM32F7xx/stm32_registry.h
index 124a57f92..ce9138395 100644
--- a/os/hal/ports/STM32/STM32F7xx/stm32_registry.h
+++ b/os/hal/ports/STM32/STM32F7xx/stm32_registry.h
@@ -1177,7 +1177,8 @@
STM32_DMA_STREAM_ID_MSK(1, 2) |\
STM32_DMA_STREAM_ID_MSK(1, 1))
#define STM32_I2C4_RX_DMA_CHN 0x00200280
-#define STM32_I2C4_TX_DMA_MSK STM32_DMA_STREAM_ID_MSK(1, 6)
+#define STM32_I2C4_TX_DMA_MSK (STM32_DMA_STREAM_ID_MSK(1, 5) |\^M
+ STM32_DMA_STREAM_ID_MSK(1, 6))^M
#define STM32_I2C4_TX_DMA_CHN 0x08000000

/* QUADSPI attributes.*/
/code]

Alexandre

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Mon Apr 22, 2019 8:14 am
by Giovanni
The manual seems to be wrong, because (1, 5) is shown as I2C4 RX and (1, 5) is I2C4 TX.

Do you confirm? if so then I also need to remove (1, 5) from I2C4 RX.

Giovanni

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Mon Apr 22, 2019 8:20 am
by Giovanni
In the meanwhile, fixed as bug #1026.

Giovanni

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Mon Apr 22, 2019 2:33 pm
by alex31
Do you confirm? if so then I also need to remove (1, 5) from I2C4 RX.


Did not verify on the reference manual, but that's what is in CUBEMX files :

from cubemx (5.1.0) files for stm32f[6/7]xx :

I2C4_TX : [stream(1, 5) Channel 2]

I2C4_TX : [stream(1, 6) Channel 8]

I2C4_RX : [stream(1, 1) Channel 8]

I2C4_RX : [stream(1, 2) Channel 2]

Don't have hardware on the hand right now, but i will check that is works with all the above setting tomorrow and will report here.

In the past, when i found mismatch between RM and CUBEMX, CUBEMX was right, will see tomorrow how true is this rule :-)

Alexandre

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Mon Apr 22, 2019 4:23 pm
by Giovanni
I think the RM is wrong too, I fixed like in cubemx.

Giovanni

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Wed Apr 24, 2019 3:52 pm
by alex31
Hello,

I have made tests on the target, and as usual, CUBE is right over RM, so your patch resolves the problem, thanks.

There is another one line patch needed to use I2C4 on chibios 18.2 (its already OK on 19.x and trunk) :

Code: Select all

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 beb7c63fe..e94e48afe 100644
--- a/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c
+++ b/os/hal/ports/STM32/LLD/I2Cv2/hal_i2c_lld.c
@@ -1658,7 +1658,7 @@ void i2c_lld_stop(I2CDriver *i2cp) {
 #error "I2C4 interrupt numbers not defined"
 #endif
 
-      rccDisableI2C4(FALSE);
+      rccDisableI2C4();
     }
 #endif
   }


Alexandre

Re: patch : fix dma_mask for F76X F77X I2C4_RX

Posted: Sun May 12, 2019 12:59 pm
by Giovanni
Hi,

Are you sure? it is OK here, perhaps I fixed it and don't remember.

Giovanni