6
\$\begingroup\$

I read the following from a book titled "An Embedded Software Primer" by David E. Simon. (23rd print Nov/2014 - Page 16)

enter image description here

If no part on the circuit is driving a signal, then that signal is said to be floating. Its voltage will be indeterminate and may change as time passes. The results of a floating signal vary between harmless and disastrous, depending upon how the parts with inputs connected to the floating signal cope with the problem.

Based on this, it looks like there is no good reason why would a circuit have a floating signal. If this is right, then why would such signal be allowed?

Is this done due to a mistake in the board design?

Are there scenarios where such a signal is needed?

\$\endgroup\$
  • 13
    \$\begingroup\$ You really shouldn't accept a answer so quickly (less than 30 minutes in this case). Now others will likely skip this question, and you'll never know what else they might have said. A good rule is to wait at least one day so answerers around the world get a full day cycle to chime in. \$\endgroup\$ – Olin Lathrop Sep 7 '16 at 14:32
  • 1
    \$\begingroup\$ @OlinLathrop Good point, will try to be wiser next time. It looks like I can un-select the answer! \$\endgroup\$ – M. A. Kishawy Sep 7 '16 at 14:34
  • 2
    \$\begingroup\$ In addition to the wonderful answers below, some chips may use a floating input as a third input value, e.g. modem chips and battery charger chips. \$\endgroup\$ – Ignacio Vazquez-Abrams Sep 7 '16 at 14:51
  • 2
    \$\begingroup\$ Imagine an audio amplifier whose input is left unplugged. It's not needed to have it unplugged, but the amplifier should be designed to cope with such a case. \$\endgroup\$ – Dmitry Grigoryev Sep 7 '16 at 14:54
  • 1
    \$\begingroup\$ @Dmitry Grigoryev: but the designer should take care that in exact that case the input is not floating (e.g. by pulling it to GND by a resistor) \$\endgroup\$ – Curd Sep 7 '16 at 16:38
23
\$\begingroup\$

Floating signals are usually not a good thing, but can be acceptable in some cases. In all those cases, the value of the signal does not matter.

Not every signal is relevant all the time. A common example is the MISO line of a SPI bus. This is only actively driven when a slave device is selected (enabled). It's value is only relevant for a short time around one of the SCK clock edges. At all other times, the signal can be any state without affect on the system since the system ignores it.

So what happens to MISO when no slave is selected, as is the case whenever the SPI bus is not in use? The answer is you don't care. It doesn't matter what its value is since nobody is looking at it. Since MISO is driven only by the single selected slave, all unselected slaves and anything else on that line must be high impedance. That means when no slave is selected, the line is left floating as described in the passage you quoted above. This causes no bad data, since again, the system is ignoring the line at that time.

While a floating line is OK logically when nothing is looking at its value, it can be a problem electrically. Many logic inputs are intended for the voltage to be either solidly low or solidly high. In-between values can cause higher than specified currents in the input circuit, and in some cases can even cause this circuit to oscillate.

For this reason, there is often a weak pulldown or pullup resistor on lines that could float. I usually use a 100 kΩ pulldown on MISO, for example. When a slave is selected, it drives the line regardless of the small extra current it takes to hold it in the high state. However, when nothing is driving the line, it will go low, preventing the unwanted extra current and oscillations in anything receiving the signal.

There are also types of digital inputs that can handle any voltage within the valid range without undesirable characteristics, like extra current or oscillations. Schmitt triggers are one example. These have hysteresis so that after flipping one way, it takes a different voltage to flip the other way. A floating line may cause the digital signal to be interpreted randomly as its voltage floats around, but the digital input is designed to handle that. Of course the rest of the system still needs to be designed to not care what the value of that digital signal is during the time its floating.

In general, truly floating signals are bad, but can be easily addressed with a weak pulldown or pullup resistor.

\$\endgroup\$
  • 2
    \$\begingroup\$ Great answer. Like Olin pointed out, if you're trying to implement an ultra-low-power design, you need to pay attention to any floating digital inputs that you might have. Microprocessor datasheets quote impressive current draw numbers while in sleep modes, but I can say from experience that you could be stuck with a few extra mW unless you pay careful attention to terminating all of your digital inputs, either via pullups/pulldowns or by adjusting the I/O buffer on your microprocessor to drive signals (set them to an output) when they aren't being used. \$\endgroup\$ – Jason R Sep 8 '16 at 0:58
  • 1
    \$\begingroup\$ Another feature seen on some chips (and which IMHO should be more common) is a "bus keeper" which will pull a line weakly high when it's high, and pull it weakly low when it's low. Unlike pull-ups or pull-downs which waste power constantly whenever a pin is in the dis-favored state, a bus keeper won't consume power in either steady-state condition. Further, since bus keepers don't have to overcome line capacitance, they don't need to be very strong and thus don't need to waste much power even when switching. \$\endgroup\$ – supercat Sep 8 '16 at 17:06
7
\$\begingroup\$

You can have a lot of floating lines on your board during start-up of a microcontroller.

Usually most of the pins of a microcontroller are initialized as input or even analog input, because the controller can't know how to configure its pins for the board it's placed upon.

In this scenario most of the later outputs are floating at first, typically only a few milliseconds until the software initializes the pins accordingly. Still enough time to cause some trouble, which is why on critical lines (write protect on an EEPROM for example) we use pull-up or pull-down resistors to have a safe startup sequence.

I've encountered some chips where the logic was not as robust as Olins answer suggests, so I like to have my signals fixed.

An antenna might be seen as a floating line which is wanted - sort of...

\$\endgroup\$
6
\$\begingroup\$

One example comes to my mind: bus lines which are used by several ports at different times may be floating when there aren't any ports currently using them.

I think the book made clear that you do not need them but they might just happen.

The least thing that should be done in systems that have lines that may float (e.g. a data and address bus in a microprocessor system) is to ensure that no device uses the signal of those lines as input as long as they are floating (e.g. by setting the enable input of memory, peripheral etc. components to inactive).

\$\endgroup\$
  • 2
    \$\begingroup\$ I don't think that these lines will really be floating. On most devices, the high-impedance state, when the line is not being accessed with only have a resistance of a few mega ohms. \$\endgroup\$ – Gremlin Sep 7 '16 at 15:43
  • 1
    \$\begingroup\$ @Eoin: A "a few mega ohms" is practically floating. E.g. the min. insulation resistance of this switch is specified as 2M\$\Omega\$! farnell.com/datasheets/1684954.pdf If e.g. 10M\$\Omega\$ is't floating for you then you will have difficulty in finding any floating line! \$\endgroup\$ – Curd Sep 7 '16 at 16:11
  • 1
    \$\begingroup\$ A few megaohms is easily enough to discharge trace capacitance (probably less than nanofarads) in a fraction of a second. This switch's resistance means that it can't create a floating line. But you can have traces that are separated by e.g. relays that will have gigaohms between them. Those are floating, because it will take significant amounts of time to discharge any charge that's built up. \$\endgroup\$ – Gremlin Sep 7 '16 at 16:21
  • 2
    \$\begingroup\$ If the relay is soldered to a PCB I doubt that you will have G\$\Omega\$ of insulation especially if it gets dusty.... And why is 10MΩ not floating but 10GΩ is? Why not 10TΩ?... \$\endgroup\$ – Curd Sep 7 '16 at 16:31
  • 1
    \$\begingroup\$ Let's just agree that we have different definitions of floating. \$\endgroup\$ – Curd Sep 7 '16 at 16:31
2
\$\begingroup\$

The danger of a floating pin is that its value can't be predetermined, but that is not in itself a problem. The problem comes from something making use of that value, or making assumptions about it.

Many chips internally accept and handle floating some of their pins, which moves the responsibility from board designers to chip designers. This is most common in communication buses, multi purpose pins, and chips with many options.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.