Skip to main content
picguy2
Associate III
July 25, 2014
Question

STM32F4: GPIOx_AFRL/H value vs. GPIOx_MODER AF mode

  • July 25, 2014
  • 1 reply
  • 626 views
Posted on July 25, 2014 at 02:53

What is the use of the GPIOx_MODER Alternate function mode?  Is it needed when an appropriate non-zero value is put into GPIOx_AFRL/H?  Is the GPIOx_MODER alternate function mode value only needed for those few alternates using GPIOx_AFRL/H AF=0?

Does the alternate function take over the entire GPIO port bit.  Or are GPIOx_OSPEEDR and GPIOx_PUPDR settings used as specified by the values stored in these registers?

(I have never had the occasion to use any AF=0 alternate functions.  When setting a non-zero alternate function have a tendency to set alternate function mode in GPIOx_MODER.  My guess is that I am doing something unnecessary.) 

#gpio-alternate-function
This topic has been closed for replies.

1 reply

waclawek.jan
Super User
July 25, 2014
Posted on July 25, 2014 at 12:01

You set _MODER to AF for any of the alternate function, both zero and nonzero _AFRL/H.

> Does the alternate function take over the entire GPIO port bit. 

No. The mapped peripheral determines the direction (IN/OUT), but you still have speed, pullup/down and open-collector/push-pull under ''manual'' control through the respective registers.

JW