cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7Rx/Sx: Cube generates incorrect config when I2C2 + I2C3 use PLL clock

Steve Melnikoff
Associate III

Using an STM32H7Rx or Sx, with both I2C2 and I2C3 in use, and clocked by PLL3R:

Cube correctly configures I2C2. However, it doesn't seem to be aware that I2C2 and I2C3 share a clock, so it:

  • incorrectly computes the timing for I2C3, as if it were using PCLK1 (the default), in MX_I2C3_Init();
  • fails to insert the line "PeriphClkInit.I2c23ClockSelection = RCC_I2C23CLKSOURCE_PLL3R;" in the init code for I2C3, in HAL_I2C_MspInit(). This sets both I2C channels back to PCLK1, thereby breaking I2C2 as well.

(I didn't try the other clock sources - HSI and CSI - but it's possible that they too don't work for I2C3.)

Fortunately, it is possible to manually add the correct code in the user areas immediately after the two sections of affected code, so there is a workaround for now.

 

0 REPLIES 0