2021-12-22 06:03 PM
Hello,
I need a clarification whether it is possible to read any pin status in alternate function just as it were a normal GPIO input pin. Is it so?
For ex. I configured the alternate function for a pin as a Timer Channel Input Capture pin, yet I can still access it to read as HAL_GPIO_ReadPin() ?
And also : if pin direct reading is possible, is it the same with all the alternate functions, or with some of them?
Thanks in advance for any help,
Vlad
Solved! Go to Solution.
2021-12-22 08:13 PM
Yes, GPIOx_IDR is valid when the pin is in any AF mode. The Schmitt trigger, which feeds IDR, is only disconnected when the pin is in analog mode.
2021-12-22 08:13 PM
Yes, GPIOx_IDR is valid when the pin is in any AF mode. The Schmitt trigger, which feeds IDR, is only disconnected when the pin is in analog mode.
2021-12-22 08:46 PM
Thank you very much, provided link is of value too...
Ch.4.3.3 dedicated to the alternate functions indeed confirms that
"A read access to the input data register provides the I/O state"
Yet page 7 introduces a contradiction though, it says:
"• Input data to input data register (GPIOx_IDR) or peripheral (alternate function input)"
It says GPIOx_IDR OR peripheral , implying it is one or another...
Just a confusing wording?
2021-12-22 09:02 PM