cancel
Showing results for 
Search instead for 
Did you mean: 

RESOLVED: Push-Pull and weak Pull up [Can they be activated together]?

selmesal
Associate II
Posted on October 05, 2016 at 02:31

Hello, 

If a pin is configured as Push Pull, can we still specify a pull up resistor to go with it?

(Is the pull up used to avoid floating conditions even in Push-Pull configurations?)

 /**USART2 GPIO Configuration    

    PA2     ------> USART2_TX

    PA3     ------> USART2_RX 

    */

    GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;

    GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;

 

    GPIO_InitStruct.Pull = GPIO_PULLUP;

    GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;

    GPIO_InitStruct.Alternate = GPIO_AF7_USART2;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
2 REPLIES 2
selmesal
Associate II
Posted on October 05, 2016 at 04:17

ok, I think I understand it now. 

GPIO_InitStruct.Mode = GPIO_MODE_AF_PP is relevant only to the output [Tx] pin of the UART port. 

GPIO_InitStruct.Pull = GPIO_PULLUP applies only to the input [Rx] pin of the UART port. 

Feel free to comment if you see it differently. 

Uwe Bonnes
Principal III
Posted on October 05, 2016 at 12:40

From what I understand, you can activate Pull (up|down) together with ush/pull output. However this does not make sense.