cancel
Showing results for 
Search instead for 
Did you mean: 

how to configure GPIO pins in high impedance input floating mode ?

controller369
Associate
Posted on August 29, 2013 at 07:47

Hi All,

  GPIO_InitStruct->GPIO_Pin  = GPIO_Pin_1;

  GPIO_InitStruct->GPIO_Mode = GPIO_Mode_IN;

  GPIO_InitStruct->GPIO_Speed = GPIO_Speed_2MHz;

  GPIO_InitStruct->GPIO_OType = GPIO_OType_PP;

  GPIO_InitStruct->GPIO_PuPd = GPIO_PuPd_NOPULL;

    GPIO_Init(GPIOD, &GPIO_InitStruct);

1. Is the above configuration is correct way to configure PD1 in high impedance input floating mode ?

2. what is the effect if I change output type to Open drain (GPIO_OType_OD)...?

Thanks
2 REPLIES 2
dthedens23
Associate II
Posted on August 29, 2013 at 16:00

When the pin is set to an input, the output driver is disconnected.

Setting open drain will have not effect on an input

jj2
Associate II
Posted on August 29, 2013 at 22:06

There is potential danger should you select, ''input floating mode.'' 

If that really is your well considered decision - you must insure that all such GPIO inputs are in receipt of their ''outside world'' signals/terminations - at all times - while the MCU is powered.  True ''floating/unterminated'' inputs are not your friend...