Go Down

Topic: What to do with unused pins (Read 1 time) previous topic - next topic

Jassper

I know this might be a noob questions, and I think I know the answer but;
For long term, is it best to set unused pins as OUTPUT or INPUT, HIGH or LOW?
Setting them as INPUT,HIGH would enable the internal pullup and a small amount of current would flow.
I'm thinking setting them as OUTPUT,LOW would be best.



Coding Badly

Quote
Setting them as INPUT,HIGH would enable the internal pullup and a small amount of current would flow.


Flow where?

skizoh

Un tien vaux mieux que deux tu l'auras !

michael_x

As long as you don't put in wrong wires, it does not matter. ( OUTPUT, LOW does not like to drain 5V without a resistor )

Rather tape the unused pins ;)

Jassper


As long as you don't put in wrong wires, it does not matter. ( OUTPUT, LOW does not like to drain 5V without a resistor )

Rather tape the unused pins ;)


I didn't know if the undefined/unused pins would or could cause issues if left "floating" so to speak. Like intermittent interference or something.

BulletMagnet83

I might be talking out of my arse here, but don't I/O pins on microcontrollers tri-state if you don't tell them what to do? So you don't REALLY need to do anything to them? I've never bothered doing anything special to my unused pins on arduino projects and nothing weird's happened so far.

Grumpy_Mike

While it is normal to tie unused logic inputs to a level on logic ICs, I don't think it matters on the processor because the floating pickup on them is not going to make it's way into the rest of the logic unless the code invites them in.
I don't do anything with unused inputs and I have not experienced any problems.

Quote
but don't I/O pins on microcontrollers tri-state

They default to inputs not tri-state.

Jassper


BulletMagnet83


While it is normal to tie unused logic inputs to a level on logic ICs, I don't think it matters on the processor because the floating pickup on them is not going to make it's way into the rest of the logic unless the code invites them in.
I don't do anything with unused inputs and I have not experienced any problems.

Quote
but don't I/O pins on microcontrollers tri-state

They default to inputs not tri-state.


Thanks for the correction :D Every day's a school day!

dc42

If you leave unused pins unconnected and unprogrammed, they default to (input, low). In this state the pin may float at a voltage that is neither high nor low, which slightly increases the current consumption of the input buffer. Unless you're using the sleep mode of the processor, you probably won't notice the difference. Programming unused pins as (input, high) to enable the internal pullup avoids the issue. So does programming them as outputs.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

Coding Badly


The recommended practice, only if the processor will be put to sleep...

Quote
13.2.6 Unconnected Pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. ... The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up.

Jassper



The recommended practice, only if the processor will be put to sleep...

Quote
13.2.6 Unconnected Pins
If some pins are unused, it is recommended to ensure that these pins have a defined level. ... The simplest method to ensure a defined level of an unused pin, is to enable the internal pull-up.



Doesn't that cause a bit more current consumption by the processor? If it's pulled to a 5v level via internal resistors, power must be flowing.

Grumpy_Mike

Not very much because the input has so high an impedance.

Coding Badly

Doesn't that cause a bit more current consumption by the processor? If it's pulled to a 5v level via internal resistors, power must be flowing.


I have a handheld gadget that: runs from 2 AA alkaline batters, is used a few times every day, for 30 minutes to one hour.  This is the third year of its existence and it is still running problem-free on the original AA batteries.  The unused pins are held high by internal pullups.

In my experience, any current consumption from the internal pullups enabled on unconnected pins is so very small as to be essentially zero.

Jassper


Go Up