How STM32 Alternate Functions work
STM32 microcontrollers are one of the most popular MCUs in the world. There are many reasons for that. The Input/Output flexibility is not one of them. All SMT32 microcontrollers have a limited IO matrix that allows general input-output pins to work only with selected peripherals. There is no easy swap of pin functions. Some pins can be only UARTs, some only SPI, and some work only with 1 or 2 timers. This is called Alternate Functions.
Never crack the ESP32 OLED again https://youtu.be/IZuS45jlcJ4
Each pin in each input-output port can have only one assigned Alternate Function at a time and no Alternate Functions are available.
This is extremely important during the hardware planning phase, as it might be hard to change the originally created pin assignment.