Well, you don't see it on schematics because either "it just worked", or they didn't need it anyway, or they didn't bother to write it down or put a hack around it or so on.
Logic pin drivers for 3.3 and 5V chips are on the order of a few nanoseconds risetime, so you can easily trash signals on wires more than a few 10s of cm. Especially so if the wires are flying willy-nilly through space, without any ground pairing, or termination or damping.
The most fundamental principle is this:
1. Whenever you have a signal, have a ground close by. Preferably, have that ground closer than the next signal, and so on.For signal quality and RF purposes, "ground" is any signal or supply that is bypassed to common. Thus, VCC is usually included, but other signals might also happen to be handy, if they are slow and bypassed (an ADC thermistor input, with capacitors on either end, might be such a beast).
Perhaps the most common misunderstanding in applying this is:
2. Signal bandwidth is NOT clock frequency or pulse/data rate. Signal bandwidth is risetime.It doesn't matter if you're toggling a pin at 1kHz or 1MHz; in both cases, you can get ~ns range bounce on the edge. And if you do, every time the bounce crosses the input pin's logic threshold, you get extra transitions. Put that on a clock pin and your data goes byebye.
Which leads into two other important observations:
- Circuits don't know your intent. No one has invented an intention detector circuit. The circuit simply is what it is. If you've set it up in a way which you did not intend... that's your misunderstanding.
- Circuits's gonna do what a circuit's gonna do. Whether you can measure it or not. A 20MHz oscilloscope won't detect any problems -- basically by definition! But the input pins reading that level can respond to signals in the 100MHz range. So you either need the equipment to verify that the signals are going through correctly, or limit the bandwidth (by filtering) to the point where you can verify it.
3. Only use the minimum bandwidth you need for the application. Filter the rest.There are a great many applications out there, but some examples might include:
- Digital logic input, low bitrate (terminal block inputs, RS232, etc.?)
- Digital logic input, high bitrate (often differential too, e.g. RS422, USB, LVDS, etc.?)
- Analog input, slow (e.g., thermistor sense, audio amplifier?)
- Analog input, fast or high-impedance or high-precision (e.g. oscilloscope?)
- Radio signals (limited bandwidth)
For each of these, you're only concerned about some range of bandwidth. Many of them include DC, so you don't want to filter that. (Digital pins that need to be static (stable at DC) can't be AC-coupled. Some signaling methods get around this, like Manchester encoding on 10BASE-T Ethernet, which is transformer coupled and extremely robust!)
The upper frequency limit is defined by your filtering: almost always, never by your naked circuit. The most offensive example of this: an audio amplifier, with skookum low noise bipolar op-amps, that beeps like an alarm clock every time your phone is about to go off! Indeed, that's the cause and solution in one: GSM phones emit powerful radio pulses, and bipolar op-amps typically rectify and detect this. Even though the 900MHz+ noise is well beyond their normal operating bandwidth (which is a minimum 20kHz for audio, up to a few 10s MHz for the GBW of typical op-amps).
So one lesson is, just because a part lists a few frequency cutoffs (like fT or GBW or -3dB point or...), doesn't mean it doesn't respond to anything above there! A trivial example is a photodiode, which responds to 300-600THz radiation (visible light), yet has a useful bandwidth of neither 300 nor 600THz, but perhaps a few MHz. Bipolar op-amps do the same thing, where they detect (in a square-law or diode-rectifying manner) ambient RF, most often these days from mobile phones and Wifi.
For your most common situations, you can filter away gross swaths of RF interference (whether it's from a nearby phone, or generated by output pins in your own circuit) by adding series ferrite beads or resistors, and parallel capacitors (to ground). For digital (CMOS) circuits, it's often enough to simply add a series resistor, at each output pin, usually 100-1000 ohms. This will likely solve your present SPI problem, but now you know a bit more about why.
For terminals exposed to the scary outside world, transient protection (ESD or surge) is also necessary. These are applied in precisely the same way: series current limiting, and parallel voltage limiting, components. Instead of reducing bandwidth, you're reducing the voltage and current levels to a kind range.
Tim