Electronic – Is it really a bad idea to leave an MCU input pin floating

microcontrollerpins

I've heard that leaving a pin floating on an MCU when configured as an input (vs. the default output) is bad for the pin, and can eventually cause it to fail prematurely. Is this true? N.B. in my instance the pin is floating somewhere between 0.3V and 1.3V due to an incoming video signal. This sometimes falls in the no man's zone of 0.8V – 2.0V when operating from 3.3V.

Best Answer

Problem:
Leaving a pin configured as an input floating is dangerous simply because you cannot be sure of the state of the pin. Like you mentioned, because of your circuit, your pin was sometimes LOW or sometimes in no-man's land or could sometimes go to HIGH.

Result:
Essentially, the floating input WILL definitely cause erratic chip operation or unpredictable behaviour. I have noticed some chips froze by simply moving my hand closer to the board (I wasn't wearing a ESD wrist band) or some would have different startup behaviour each time the board would powerup.

Why:
This happens simply because if there is external noise on that pin, the pin would oscillate, which would drain power as CMOS logic gates drain power when they switch states.

Solution:
Most micros nowdays have internal pullups as well, so that could prevent this behaviour from occuring. Another option would be to configure the pin as an output so it does not affect the internals.