Skip to main content
qing2
Associate
July 1, 2009
Question

How should I treat unused GPIO pins?

  • July 1, 2009
  • 7 replies
  • 3648 views
Posted on July 01, 2009 at 10:33

How should I treat unused GPIO pins?

    This topic has been closed for replies.

    7 replies

    mikael1
    Visitor II
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    A good idea is to set them to output, unused inputs can pick up noise.

    qing2
    qing2Author
    Associate
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    How should I treat unused GPIO pins?

    pswenson
    Associate II
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    If you look in ''\FWLib\examples\GPIO\IOToggle\main.c'' (v2), there's this:

    /* Configure all unused GPIO port pins in Analog Input mode

    (floating input trigger OFF), this will reduce the power

    consumption and increase the device immunity against EMI/EMC */

    sjo
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    This is a very much age old discussion, and depends on the actual design and silicon used.

    For most designs i set unused io as output low (no external resistor).

    But even with this there is a tiny window where the floating io could oscillate - chances are very rare however.

    You will find quite a few threads on this topic around the web.

    Cheers

    Spen

    st3
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    Quote:

    A good idea is to set them to output

    What kind of output?

    And, if it's an output, what state should you write to it?

    Quote:

    unused inputs can pick up noise.

    But, when a GPIO is not used, is it an input?

    Doesn't the design ensure that unused pins are inherently in a sensible state...?

    dmatheis
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    hmm-> ''In Run mode you can just leave all your unused I/O pins on your PCB not connected and thru software configure them as Push-pull with Data 0.

    This maintains a static level with zero consumption and finally is the best reliable mode for EMI and EMS.''

    Qouted from STOne-32's post in the thread:

    http://www.st.com/mcu/forums-cat-6110-23.html

    st3
    Associate III
    May 17, 2011
    Posted on May 17, 2011 at 13:13

    Quote:

    On 04-06-2009 at 22:24, Anonymous wrote:

    If you look in ''\FWLib\examples\GPIO\IOToggle\main.c'' (v2), there's this..

    Bad ST: this is the kind of thing that should be properly & clearly documented - not hidden as some aside in some example code! :|