Skip to main content
Steve Melnikoff
Senior
November 13, 2025
Solved

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

  • November 13, 2025
  • 3 replies
  • 249 views

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.

 

Best answer by Souhaib MAZHOUD

Hello ​@Steve Melnikoff 

This issue has been fixed in the latest version of STM32CubeMX 6.18.0 

Download STM32CubeMX6.18.0 from this link. 

Regards,

Souhaib

3 replies

ST Technical Moderator
November 14, 2025

Hello @Steve Melnikoff 

Thank you for your contributions,

Could you provide your .ioc in order to investigate the issue?

KR, Souhaib

To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Steve Melnikoff
Senior
November 14, 2025

Hi. Thank you for the quick reply. I've sent the file to you via private message.

ST Technical Moderator
November 17, 2025

Hello @Steve Melnikoff 

This issue has been raised to the development team for analysis and revision of upcoming releases (Ticket 221843 This is an internal tracking number and is not accessible or usable by customers).)

KR, Souhaib

To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Souhaib MAZHOUDBest answer
ST Technical Moderator
July 1, 2026

Hello ​@Steve Melnikoff 

This issue has been fixed in the latest version of STM32CubeMX 6.18.0 

Download STM32CubeMX6.18.0 from this link. 

Regards,

Souhaib

To give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.
Steve Melnikoff
Senior
July 1, 2026

Thank you!