2020-12-28 02:05 PM
Hi :)
So I keep reading everywhere that leaving a CMOS input pin floating is bad because it is high impedance, can oscillate, etc. I understand and agree.
But while a MCU is starting up (or when you're programming it) all its pin are in input state until the program has started to set them as output or add an internal pull-up.
Or, to take another example, an IC with CMOS inputs might be directly connected to the outputs of an MCU, but again while the MCU is starting up these pins will be floating.
So what is the solution then - to use external pull-ups or pull-down on every single line?
Or is is acceptable (in a professional product) that these pins might float for a few milliseconds at startup?
Thank you!
2020-12-28 02:25 PM
It depends on the application. It you need a pin tied high or low while the STM32 is off, you'll need an external pullup/pulldown. If you're driving a high-power motor based on the pin status, probably want an external resistor on that line. If the pin is driving an LED or something else with similar low-consequence, probably fine to let it float. UART and I2C pins should have an external pullup, unless you're willing to accept the consequence of bad signals on those lines.
2020-12-28 02:55 PM
Which STM32?
Some of them, mainly the 'Fxxx, default to digital inputs and those are Schmitt triggers. That probably mitigates most of oscillation concerns as long as it's in a reasonably quiet environment.
Others, mainly the 'Lxxx, default to analog inputs, those are mainly transmission gates, possibly closed most of them by default, so the pin is true high impedance, with no consequence of any (spurious) input voltage on it whatsoever.
Disclaimer: I'm not ST and may be wrong.
JW
2020-12-29 02:54 AM
Ha ha I know you're not ST Jan :)
Thank you both for your answers. To be honest I was asking generally because overall I was wondering, but right now I am working on a project with an STM8L151 and no motors or like (i.e. a pin floating a bit at startup will have no bad effect on the fonctionallity).
I am more interested in whether leaving inputs floating for too long could do any damage to the device.
But really nice to know about the schmitt triggers :D Basically if I understand well any IC that has digital inputs with a schmitt trigger would be more or less ok? I guess this is a large subject, but what about TTL inputs instead of CMOS inputs?
2020-12-29 05:21 AM
> TTL inputs
Unless you are using chips from the 1980s or older, you won't come across TTL inputs. (Also, there's no such thing as a TTL input; there were several different arrangements of the TTL chips inputs, although they indeed share certain common characteristics - most remarkably, there's a huge difference between input current in log. 0 and log. 1).
If you're talking about TTL-level CMOS, well that's still CMOS in this regard.
The thing is, that behaviour of unconnected input depends heavily on the exact arrangement of the internal input circuitry, and also on the external connections (this sounds contradictory, but a stub not intentionally connected anywhere from the circuit designer point of view (e.g. leading to an unconnected connector) is an antenna). However, except very early CMOS and some specialty ICs, and in any reasonable environment/circuit, I don't think there's any chance of chips getting *damaged* from having inputs left floating. Yes, they can cause increased power consumption, oscillations, pick up noise; but none of that will *damage* the IC.
JW
2020-12-30 03:46 AM
Thank you Jan for great info as always!!
2020-12-30 04:28 AM
Floatinng input results in substantial current flow in the input buffer. Switch to analog mode so the input buffer gets switched off. Beside the current I do not know about other problems.
2020-12-30 02:13 PM
Thank you for the info Uwe :)