STM32 GPIO Lecture 19 : Alternate functionality setting of GPIO pin with example

 

 

Alternate functionality setting of GPIO pin with example


 

When GPIO pin is in alternate functionality mode, it can be used for 16 different functionalities from AF0 to AF15. These possible 16 different functionalities are, used for system-related tasks, used by the timer peripherals, used by SPI or I2C peripherals and also for audio interfaces. 

 

Alternate functionality
Figure 1. 16 Different Alternate functionalities

 

Example: List out all 16 possible alternate functionalities supported by GPIO port ‘A’ PIN ‘8’ (GPIOA.8)

For GPIOA.8,

For AFO: MCO1 

For   AF1: TIM1_CH1. 

For   AF2: – (Not defined, behaves as standard GPIO).

For   AF3: – (Not defined, behaves as standard GPIO).

For   AF4: – I 2C3_SCL.

For   AF5: – (Not defined, behaves as standard GPIO).

For   AF6: – (Not defined, behaves as standard GPIO).

For   AF7: – USART1_CK

For   AF8: – (Not defined, behaves as standard GPIO).

For   AF9: – (Not defined, behaves as standard GPIO).

For AF10:-   OTG_FS_SOF

For AF11: – (Not defined, behaves as standard GPIO).

For AF12: – (Not defined, behaves as standard GPIO).

For AF13: – (Not defined, behaves as standard GPIO).

For AF14: – (Not defined, behaves as standard GPIO).

For AF15:-  EVENT OUT

 

Alternate function mapping
Figure 2. Alternate Function Mapping

 

In the following article, let’s see Enabling and disabling GPIO peripheral clock.

 

FastBit Embedded Brain Academy Courses,

Click here: https://fastbitlab.com/course1

FastBitLab

The FastBit Embedded Brain Academy uses the power of internet to bring the online courses related to the field of embedded system programming, Real time operating system, Embedded Linux systems, etc at your finger tip with very low cost. Backed with strong experience of industry, we have produced lots of courses with the customer enrolment over 3000+ across 100+ countries.