Skip to content

Commit 1dd4112

Browse files
authored
Merge pull request #14030 from arduino/i2c_stm32_wrong_clock
STM32H7: Compute I2C timing according current I2C clock source
2 parents 266e5f8 + dc2d860 commit 1dd4112

File tree

5 files changed

+428
-31
lines changed

5 files changed

+428
-31
lines changed

targets/TARGET_STM/TARGET_STM32H7/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ target_sources(mbed-stm32h7
1515
analogout_device.c
1616
flash_api.c
1717
gpio_irq_device.c
18+
i2c_device.c
1819
pwmout_device.c
1920
serial_device.c
2021
spi_api.c

targets/TARGET_STM/TARGET_STM32H7/STM32Cube_FW/STM32H7xx_HAL_Driver/stm32h7xx_hal_rcc_ex.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,7 +2403,11 @@ typedef struct
24032403
* @arg RCC_I2C4CLKSOURCE_HSI: HSI selected as I2C4 clock
24042404
* @arg RCC_I2C4CLKSOURCE_CSI: CSI selected as I2C4 clock
24052405
*/
2406+
#if defined(RCC_D3CCIPR_I2C4SEL)
24062407
#define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->D3CCIPR, RCC_D3CCIPR_I2C4SEL)))
2408+
#else
2409+
#define __HAL_RCC_GET_I2C4_SOURCE() ((uint32_t)(READ_BIT(RCC->SRDCCIPR, RCC_SRDCCIPR_I2C4SEL)))
2410+
#endif /* RCC_D3CCIPR_I2C4SEL */
24072411

24082412
#if defined(I2C5)
24092413
/** @brief macro to configure the I2C5 clock (I2C5CLK).

0 commit comments

Comments
 (0)