diff --git a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c index 8851435e9..24b1ace93 100644 --- a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c +++ b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.c @@ -461,7 +461,7 @@ static void i2c_lld_serve_error_interrupt(I2CDriver *i2cp, uint32_t isr) { if (isr & I2C_ISR_TIMEOUT) i2cp->errors |= I2C_TIMEOUT; - /* If some error has been identified then sends wakes the waiting thread.*/ + /* If some error has been identified then wake the waiting thread.*/ if (i2cp->errors != I2C_NO_ERROR) _i2c_wakeup_error_isr(i2cp); } @@ -770,16 +770,17 @@ void i2c_lld_init(void) { I2CD4.i2c = I2C4; #if STM32_I2C_USE_DMA == TRUE #if defined(STM32_I2C_DMA_REQUIRED) && defined(STM32_I2C_BDMA_REQUIRED) - I2CD4.is_bdma = true; -#endif #if STM32_I2C4_USE_BDMA == TRUE + I2CD4.is_bdma = true; I2CD4.rx.bdma = NULL; I2CD4.tx.bdma = NULL; #else + I2CD4.is_bdma = false; I2CD4.rx.dma = NULL; I2CD4.tx.dma = NULL; -#endif -#endif +#endif /* STM32_I2C4_USE_BDMA == TRUE */ +#endif /* defined(STM32_I2C_DMA_REQUIRED) && defined(STM32_I2C_BDMA_REQUIRED) */ +#endif /* STM32_I2C_USE_DMA == TRUE */ #if defined(STM32_I2C4_GLOBAL_NUMBER) || defined(__DOXYGEN__) nvicEnableVector(STM32_I2C4_GLOBAL_NUMBER, STM32_I2C_I2C4_IRQ_PRIORITY); #elif defined(STM32_I2C4_EVENT_NUMBER) && defined(STM32_I2C4_ERROR_NUMBER) diff --git a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h index a1d5f7b0b..351052f1b 100644 --- a/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h +++ b/os/hal/ports/STM32/LLD/I2Cv3/hal_i2c_lld.h @@ -379,6 +379,11 @@ #endif #endif +#if STM32_I2C_USE_I2C4 +#if !defined(STM32_BDMA_REQUIRED) +#define STM32_BDMA_REQUIRED +#endif +#endif #else /* STM32_I2C4_USE_BDMA != TRUE */ #if STM32_I2C_USE_I2C1 || STM32_I2C_USE_I2C2 || STM32_I2C_USE_I2C3 || STM32_I2C_USE_I2C4 @@ -390,15 +395,6 @@ #endif /* STM32_I2C4_USE_BDMA != TRUE */ -#if STM32_I2C4_USE_BDMA == TRUE -#if STM32_I2C_USE_I2C4 -#define STM32_I2C_BDMA_REQUIRED -#if !defined(STM32_BDMA_REQUIRED) -#define STM32_BDMA_REQUIRED -#endif -#endif -#endif /* STM32_I2C4_USE_BDMA == TRUE */ - #endif /* STM32_I2C_USE_DMA == TRUE */ /*===========================================================================*/ diff --git a/os/hal/ports/STM32/STM32L4xx+/stm32_isr.h b/os/hal/ports/STM32/STM32L4xx+/stm32_isr.h index 7d651fc48..9e25c8689 100644 --- a/os/hal/ports/STM32/STM32L4xx+/stm32_isr.h +++ b/os/hal/ports/STM32/STM32L4xx+/stm32_isr.h @@ -148,8 +148,8 @@ #define STM32_I2C2_ERROR_HANDLER VectorC8 #define STM32_I2C3_EVENT_HANDLER Vector160 #define STM32_I2C3_ERROR_HANDLER Vector164 -#define STM32_I2C4_EVENT_HANDLER Vector18C -#define STM32_I2C4_ERROR_HANDLER Vector190 +#define STM32_I2C4_ERROR_HANDLER Vector18C +#define STM32_I2C4_EVENT_HANDLER Vector190 #define STM32_I2C1_EVENT_NUMBER 31 #define STM32_I2C1_ERROR_NUMBER 32 @@ -157,8 +157,9 @@ #define STM32_I2C2_ERROR_NUMBER 34 #define STM32_I2C3_EVENT_NUMBER 72 #define STM32_I2C3_ERROR_NUMBER 73 -#define STM32_I2C4_EVENT_NUMBER 83 -#define STM32_I2C4_ERROR_NUMBER 84 +#define STM32_I2C4_ERROR_NUMBER 83 +#define STM32_I2C4_EVENT_NUMBER 84 + /* * OCTOSPI unit. diff --git a/readme.txt b/readme.txt index 288a00f7d..0fd8a1368 100644 --- a/readme.txt +++ b/readme.txt @@ -74,6 +74,7 @@ ***************************************************************************** *** 20.3.1 *** +- FIX: Fixed I2CD4 interrupt vectors are swapped versus I2CD1-I2CD3 (bug #1080) - FIX: Fixed incorrect clock check when using PLLSAI1R in ADCv3 (bug #1079) - FIX: Fixed missing checks in TIM6 and TIM7 STM32 mini drivers (bug #1078). - FIX: Fixed error in EXTIv1 ISRs (bug #1077).