Skip to main content
Associate II
Nov 10, 2026 11:25 AM UTC
Solved

STM32H5 Pin = both output (from peripheral A) and input (to peripheral B)

Hello ST,

On STM32H5, we would like assign PA5 to SPI1_SCK (AF5) = output (SPI Master) and simultaneously to SPI6_SCK (AF8) = input (SPI slave). The port structure seems to allow for this. Could you confirm that this is possible, please?

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
Nov 10, 2026 11:42 AM UTC

Hello ​@bernhardb ,

1- You’ve posted that question in “STM32 MPU ….” forum board while STM32H5 is a MCU (a microcontroller)

2- In next time please provide the exact part number you are using. STM32H5 is having many part numbers and we cannot determine which document we need to refer to support you. After several attempts to find what part number you are using, I think you are referring to STM32H5E/F or something like that.

3- For you question, that’ not possible. You’ve already indirectly answered the question in your prompt:

SPI1_SCK (AF5) = output / SPI6_SCK (AF8). You are trying to assign the same IO two different alternate functions.

Look at the reference manual RM0517:

So you’ll overwrite the register field content in the second configuration.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.

6 replies

mƎALLEm
mƎALLEmBest answer
ST Technical Moderator
Nov 10, 2026 11:42 AM UTC

Hello ​@bernhardb ,

1- You’ve posted that question in “STM32 MPU ….” forum board while STM32H5 is a MCU (a microcontroller)

2- In next time please provide the exact part number you are using. STM32H5 is having many part numbers and we cannot determine which document we need to refer to support you. After several attempts to find what part number you are using, I think you are referring to STM32H5E/F or something like that.

3- For you question, that’ not possible. You’ve already indirectly answered the question in your prompt:

SPI1_SCK (AF5) = output / SPI6_SCK (AF8). You are trying to assign the same IO two different alternate functions.

Look at the reference manual RM0517:

So you’ll overwrite the register field content in the second configuration.

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
Ozone
Principal
Nov 10, 2026 11:50 AM UTC

> 2- In next time please provide the exact part number you are using. STM32H5 is having many part numbers and we cannot determine which document we need to refer to support you.

In this specific case, the exact part number is redundant.
No STM32 MCU allows more than one alternate function (AF) for any GPIO pin at a time.
They are all mutually exclusive, i.e. this is a “1 out of n” relation.


The other way around usually works - one can enable a specific peripheral functionality (like SPI1_SCK) on two GPIO pins simultaneously, if it is routed to those pins.

mƎALLEm
ST Technical Moderator
Nov 10, 2026 1:53 PM UTC

In this specific case, the exact part number is redundant.
No STM32 MCU allows more than one alternate function (AF) for any GPIO pin at a time.
They are all mutually exclusive, i.e. this is a “1 out of n” relation.

→ SPI6 is not available on STM32H503 nor on STM32H523/STM32H533 for example … Before analyzing the case need to ensure the user inputs are correct (who knows SPI6_SCK is not mapped at PA5 ;) ). So I needed to check different H5 datasheets available to find which one corresponds to what he’s using.

Moreover, providing the MCU part number is the info that should be provided no matter the case is.

 

To give better visibility on the answered topics, please click "Best answer" on the reply which solved your issue or answered your question.
bernhardbAuthor
Associate II
Nov 10, 2026 2:19 PM UTC

OK, thank you. Pity that ST chose this limitation. All AFs should be able to listen on a pin, as long as only one can drive out.

Ozone
Principal
Nov 10, 2026 2:52 PM UTC

Show me a device that can do that - a MCU were a single GPIO can work as output pin for one peripheral unit and simultaneously as input pin for a different peripheral unit.

bernhardbAuthor
Associate II
Nov 10, 2026 3:10 PM UTC

TI AM170x / AM18xx / L13x / TMS320C674x: