For STM32Gxxx, is it possible to sample (read) GPIO input while pin is assigned to peripheral (alternate function)?
For some other MCU vendors, it is possible to read the GPIO input pin, while the pin is assigned to a peripheral (using alternate function).
I haven't tested this for STM32Gxx family, but it appears to work, according RM
And this is the block diagram
I have this use case for a protective purpose: The pin is normally assigned to a TIMER for capture, but I also want to detect if the GPIO is stuck in LOW (or HIGH)
Thanks for clarifications and hints.
Yes. IDR
register can be read in any mode but its value will not have any meaningful value in analogue mode. The Schmitt trigger, which feeds IDR, is disconnected when the pin is in analogue mode.
So you can read it in any AF mode and get the actual state of the pin.