3

I have recently started working on Embedded Systems. I am configuring GPIO pins for MCU. But I'm bit confuzed whether I should configure them pull up or pull down. Is there any configuration rule to be followed to minimize current consumption or these configurations are MCU Specific. Pls note that I have left unused pins as Input GPIOs. I am currently using ARM Coprtex M0+ MCU

anandamu16
  • 65
  • 7
  • 3
    It depends on the exact make of the controller. On STM32 I got the smallest current when configuring them as analog input, on the MSP430 output low was quite good. Leaving unconnected pins as input can spell trouble with interference. – Arsenal Sep 04 '17 at 06:19
  • 2
    Read the datasheet and you may find what you are looking for. They have a separate section of what to do with unused pins. – Sachin Sep 04 '17 at 06:31
  • 1
    How input pins should be configured will depend entirely on your application. We can't answer this question without knowing a lot more about what you're doing. –  Sep 04 '17 at 07:11
  • Thanks a lot, I will refer the datasheet. I was thinking that there is some common rule that is followed industrywide. But It seems based upon transistor (N type or p type) and other circuitory, Unused Gpio pins are configured. – anandamu16 Sep 11 '17 at 05:15

1 Answers1

5

The answer is: "it depends on your uC and system", as some IC draws a smaller current when the input is internally pulled up, others with a pull down. Other ICs (most AVR) only come with a pull-up option, so there's nothing to choose, except pu yes/no.

Still, you should avoid leaving them unconfigured without any pull-up/down. The high input impedance would have them to pick up all the noise (even by, but not limited to, capacitive coupling with nearby switching signals). This in turn, will make the input buffer to oscillate and waste "a lot of" power. Alternatively, the input voltage could come close to the midrail, where both the N and P MOSFETs of the input buffer are ON, something you want to avoid.

Another problem is: "what happens when the IC is initializing"? The unused inputs will be uncofigured. The solutions?

  • Shorting to GND/VCC: this could be not a good idea, because if accidentally (due to a bug, or during testing) you configure the PIN as output, this will of course cause problems. Furthermore, a permanent short could be deleterious if later you must modify your circuit or having an unused pin to be monitored for debugging purpose. Shorting to VDD might also have latch-up problems (or erratic behaviors) in IC that have multiple supply voltages.
  • Connecting a pull-up/down resistor. This takes space and BOM cost.
  • Live with it. If you expect a very short initialization/reset time, then you can live with this, and use the internal pu/pd.
next-hack
  • 5,297
  • 15
  • 33
  • Thanks for your answer. My uC is giving me both the options to internally pull up as well internally pull down. That's why I was bit confuzed. It seems, configuring Unused GPIOs are Controller specific, I have to refer the datasheet and other relevant documents. – anandamu16 Sep 11 '17 at 05:19