Skip to main content
Graduate II
June 20, 2025
Solved

Can I2C pins be in different ports?

  • June 20, 2025
  • 2 replies
  • 408 views

Hi,
I’m currently implementing I2C in slave mode using the STM32G491 series. Due to pin constraints, we’re considering using SCL and SDA pins from different GPIO ports—for example, SCL from port PA and SDA from port PC. Is it acceptable to assign I2C pins from different ports for a single peripheral?

Also, we noticed a pin labeled I2C_SMBA. Could you explain its purpose? Can we use it for CLK or DATA?

    This topic has been closed for replies.
    Best answer by Andrew Neil

    @abhijith_raj wrote:

     Due to pin constraints, we’re considering using SCL and SDA pins from different GPIO ports—for example, SCL from port PA and SDA from port PC. Is it acceptable to assign I2C pins from different ports for a single peripheral?


    So long as they are both for the same I2C peripheral - ie, both for I2C1, or both for I2C2, or both for I2C3.

    The peripheral number is included in the AF pin name; eg,

    AndrewNeil_0-1750411121827.png

    AndrewNeil_1-1750411142500.png

    https://www.st.com/resource/en/datasheet/stm32g491re.pdf

    via: https://www.st.com/en/microcontrollers-microprocessors/stm32g491re.html#documentation

    So there, for example, you have the SDA for I2C1 available in both Port A and Port B

     


    @abhijith_raj wrote:

    Also, we noticed a pin labeled I2C_SMBA. Could you explain its purpose? Can we use it for CLK or DATA?


    See the Reference Manual:

    AndrewNeil_2-1750411265664.png

    https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf#page=1626

     

    Note:

    You didn't give a full part number; the above documents are for STM32G491RE 

     

     

    2 replies

    Graduate II
    June 20, 2025

    Which STM32G491xx? Upload your IOC file so we can see what pins have been used already..

    Super User
    June 20, 2025

    @abhijith_raj wrote:

     Due to pin constraints, we’re considering using SCL and SDA pins from different GPIO ports—for example, SCL from port PA and SDA from port PC. Is it acceptable to assign I2C pins from different ports for a single peripheral?


    So long as they are both for the same I2C peripheral - ie, both for I2C1, or both for I2C2, or both for I2C3.

    The peripheral number is included in the AF pin name; eg,

    AndrewNeil_0-1750411121827.png

    AndrewNeil_1-1750411142500.png

    https://www.st.com/resource/en/datasheet/stm32g491re.pdf

    via: https://www.st.com/en/microcontrollers-microprocessors/stm32g491re.html#documentation

    So there, for example, you have the SDA for I2C1 available in both Port A and Port B

     


    @abhijith_raj wrote:

    Also, we noticed a pin labeled I2C_SMBA. Could you explain its purpose? Can we use it for CLK or DATA?


    See the Reference Manual:

    AndrewNeil_2-1750411265664.png

    https://www.st.com/resource/en/reference_manual/rm0440-stm32g4-series-advanced-armbased-32bit-mcus-stmicroelectronics.pdf#page=1626

     

    Note:

    You didn't give a full part number; the above documents are for STM32G491RE