What is the correct initialization order of GPIOs as alternate function output and associated peripherals in order to have full control over the state of the output pins?
We are currently working with STM32F103VE MCU and we have a dilemma about the order of initialization GPIO pins as alternate function outputs and associated peripherals. The goal is to have full control over the pin states.
We have checked order of initialization done by CubeMX and outcome is that AF GPIOs are firstly initialized and then associated peripherals. But in the reference manual (RM0008 Rev 21) we have found the next info.
It seems that output is not specified and is not under control if GPIO is initialized as AF output before associated peripheral is initialized?
It seems that the peripherals should be initialized first and only then GPIO as AF output?
If one AF output pin is shared between more peripherals, as it is usually, which peripheral exactly has control over the AF output pin? Does it depend on order of peripherals initialization?
E.g. PB13 can be assigned to SPI2_SCK and to TIM1_CH1N.
Thank you for answers!
Nenad
