cancel
Showing results for 
Search instead for 
Did you mean: 

What are the numbers on Alternate functions AF1, AF2, ...?

Tobe
Senior III

I cant find any reference to these numbers.

4 REPLIES 4
######
Senior

Its the pin function setting.

i.e. if you want PA1 (in your example) to use UART then you have to select Alternate Function 7. A different pin function e.g. I2C will be a different Alternate Function.

The value you select is loaded into the GPIOx_AFRL / GPIOx_AFRH registers.

See page 272 of RM090 for an explanation of Alternate Function GPIO Multiplexing:

https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405-415-stm32f407-417-stm32f427-437-and-stm32f429-439-advanced-arm-based-32-bit-mcus-stmicroelectronics.pdf

STTwo-32
ST Employee

Hell @Tobe @###### 

AFx represent as said @###### the alternate function number x. you can configure a pin for a specific AFy by writing y to specific 4 bits of the:

  • GPIOx_AFRLx if the pin is pin n (n = 7 to 0) 
  • GPIOx_AFRHx if the pin is pin n (n = 8 to 15).

STTwo32_0-1701173548944.png

 

For more details, take a look at the RM0440. pages 365/366

Best Regards.

STTwo-32

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Thanks.

I have searched in the wrong Datasheet. There i could not find the meaning of the AF numbers. I really dont like having two datasheets!

 

The Data Sheet/Manual covers the pin level stuff as there are multiple packages with different pins and sizing.

The Reference Manual covers a lot of the general die / family level stuff, the registers and peripherals, some of which won't escape from smaller packages.

They've been doing this for more than a decade, don't anticipate this strategy changing.

Probably shouldn't mention the Programming Manual..

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