Skip to main content
Associate
December 8, 2025
Question

I2C1 pin assignment on PB8/PB9 is removed when SPI1 is enabled in STM32CubeMX v6

  • December 8, 2025
  • 2 replies
  • 632 views

Overview

After migrating a project from CubeMX v5 to v6 (DB 6.0.150), the pin assignment for I2C1_SCL (PB8) and I2C1_SDA (PB9) is automatically removed when SPI1 is enabled.

This issue did not occur in CubeMX v5, and on real hardware both I2C1 and SPI1 can operate simultaneously.

 

Steps to Reproduce

  1. Open a project created in CubeMX v5 and migrate to CubeMX v6

  2. Assign PB8 → I2C1_SCL, PB9 → I2C1_SDA

  3. Enable SPI1 (Full-Duplex, Master or Slave)

  4. PB8/PB9 immediately lose their I2C1 assignments

  5. In some cases, I2C1 disappears entirely from the .ioc, and MX_I2C1_Init is no longer generated

 

Environment

  • MCU: STM32F103CBTx

  • CubeMX: 6.15.0

  • DB: 6.0.150

  • Firmware Package: STM32CubeF1 v1.8.4 / v1.8.6

  • Previous project created with: CubeMX 5.x (DB 5.x)

 

Requests

  • Please confirm whether this behavior is a known issue

  • Provide any available workaround

2 replies

Technical Moderator
December 8, 2025

Hello @yuichiro and welcome to the Community,

Please share your ioc file, this will help to reproduce the issue.

I will move this post to the "STM32CubeMX" forum.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
yuichiroAuthor
Associate
December 8, 2025

Hello @Imen.D ,
Thanks for your reply! I have attached the .ioc file.

TDK
December 8, 2025

Use the pin feature to lock pins into their current assignment. Otherwise CubeMX will rearrange pins to ensure all peripherals can be enabled.

"If you feel a post has answered your question, please click ""Accept as Solution""."