Switching alternate functions for on input pin
Hello experts,
I am using a stm32F446RET6 (HAL and C) and I am using the PA1 input pin for receiving a serial stream with the TIM2 Channel for frequency and logic detection. This Input capture timer works perfectly. But prior to decode the stream I first need to check if there is an active signal on that pin. So my question concerns the use of an alternate function on the PA1 pin, for example as EXTI or GPIO. Is it possible to switch from EXTI or GPIO input to the TIM2 CH2 without destroying all the settings that have been done. I read that there is a way to use the GPIOx_AFRL register.
i would be thankful to anybody who already did that. I tried several things and so far it s not working, it is not as trivial as expected obviously. The goal would be to use the PA1 pin as EXTI or GPIO input to detect if the signal is present and if positive switch the pin back to the TIM2 Channel for logic decoding.
Regards,
