Skip to main content
controller369
Visitor II
Aug 29, 2013 5:47 AM UTC
Question

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

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
    This topic has been closed for replies.

    2 replies

    dthedens23
    Associate
    Aug 29, 2013 2:00 PM UTC
    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
    Aug 29, 2013 8:06 PM UTC
    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...