cancel
Showing results for 
Search instead for 
Did you mean: 

[Solved] What is the difference between GPIO_AF5_SPI2, GPIO_AF6_SPI2 and GPIO_AF7_SPI2 on the stm32h743zi?

angus schmaloer
Associate III

There are multiple alternating functions for one peripherals. Why and what is the difference?

1 ACCEPTED SOLUTION

Accepted Solutions
LuizLS
Associate II

Angus,

You have to look at the specific entries of the "Port x alternate functions" tables in the datasheet (that Clive mentioned) in order to know the relation among SPI functions, the GPIO ports and pins that implement them, and the corresponding AF codes.

AF codes don't have a special meaning by themselves. They are just codes you use to configure the GPIO pins.

The STM32H743xx can use, for example, five GPIO pins as SPI2 slave selection (NSS) : PA11, PB4, PB9, PB12 and PI0. All alternate function codes are AF5, except for one: AF7 is used for PB4.

Any given GPIO pin can be used for many different functions under different AF codes. That is the kind of information one gets from the tables mentioned above.

View solution in original post

5 REPLIES 5
Uwe Bonnes
Principal III

You should tell the device you talk about!

sorry, forgot, it is the stm32h743zi

Uwe Bonnes
Principal III

It means that for each pin you must look up if you should use GPIO_AF5_SPI2, GPIO_AF6_SPI2 or GPIO_AF7_SPI2.

Some of the newer STM32 have inconsistent muxing across multiple GPIO banks, especially when you get to higher pin counts/banks, The lower banks, with smaller packages get far more dense. Given me headaches on L0 devices.

You should look at the pin tables in the Data Sheet to confirm routing options. Choices aren't always ideal, and get locked in across new silicon as changing would be exceedingly disruptive, so badly thought out choices made early in the design get frozen in for a generation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LuizLS
Associate II

Angus,

You have to look at the specific entries of the "Port x alternate functions" tables in the datasheet (that Clive mentioned) in order to know the relation among SPI functions, the GPIO ports and pins that implement them, and the corresponding AF codes.

AF codes don't have a special meaning by themselves. They are just codes you use to configure the GPIO pins.

The STM32H743xx can use, for example, five GPIO pins as SPI2 slave selection (NSS) : PA11, PB4, PB9, PB12 and PI0. All alternate function codes are AF5, except for one: AF7 is used for PB4.

Any given GPIO pin can be used for many different functions under different AF codes. That is the kind of information one gets from the tables mentioned above.