cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4: GPIOx_AFRL/H value vs. GPIOx_MODER AF mode

picguy2
Associate II
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
1 REPLY 1
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