RussellMc wrote: >> Sorry, PIC32 I/O pins are 18 mA/18 mA current sink/source. Where did >> I >> get 4mA? I don't know. Still, 18 mA at 3 V means approx 100 Ohm >> output impedance. What's the point of placing 33 Ohm resistor in >> series with >> it? You need SPI clock signal edge as sharp as possible for said 100 >> Ohm output impedance. > > Your advice seems contrary to the general understanding of what's > required. Sharp edges and fast rise times will exacerbate the > problem. I have to agree with Russell here. Russell has already done a good job of showing one way of looking at this, so I'll present a totally different one. Think about it in frequency space. By the way, whenever you encounter such a problem in electronics that seems puzzling, it's a good idea to force yourself to think about the problem both in the time domain and the frequency domain. Mathematically everything can be analysed in either, but they each give different perspectives to the human brain. Sometimes what looks like a intractable mess in one falls out obviously in the other. Look at what would happen as you drive the line at different pure frequencies (sine waves). At low frequencies like a MHz or less any point on the line is going to track what you put in within your ability to measure a difference, assuming normal equipment for PIC development. The line impedence looks pretty much infinite to the driving source. As you get into the 10s of MHz range, the capacitance of the line to ground becomes significant enough that it can't just be ignored. I don't know how long this line actually is, but the capacitance is probably in the 10-20pF range. At these frequencies, this capacitor will load the source. At 10MHz a 20pF capacitor has a reactance of about 800 Ohms, so at 100MHz it's only 80 Ohms. As a result of the driving source not having 0 output impedence, at these frequencies you will start to see a phase shift between the source and the trace, and you will see some attenuation at the higher end of the range. In the 100s of MHz range a lot more interesting things happen. The series inductance of the trace starts to matter. You can no longer get away with modeling the line as a lumped system that is equivalent to a capacitor to ground. It's a L/C system, and worse, not a lumped one. This means the fact that the L and C are distributed along the whole length of the trace becomes significant, and that the resulting signal therefore varies along the trace. The Ls and Cs will conspire to resonate at some frequencies, which will make the line look like a unexpectedly high impedence at those relatively narrow frequencies. At other frequencies the reverse happens and the line looks like a unexpectedly low impedence to ground. There will be reflections from points where the impedence changes suddenly, which of course is particularly at the ends. These reflections cause standing waves. Now as you change that frequency dial in this thought experiment from a few 100MHz to a few GHz, you will see all manner of strange things. The amplitude on the line will change suddenly, so will the phase shift, and these will differ between points on the line. In short, it's a unpredictable mess. It's the mess resulting from frequencies of a few 100MHz and up that cause the problems. Why? Because the line isn't being driven by just a 75MHz sine wave. This is a digital clock at 75MHz, so has significant components at multiples thereof if it were a steady clock. Then consider that changing a frequency (like turning the clock on and off) itself causes other frequencies unrelated to the "carrier" you are changing in amplitude or frequency. The net effect is that there's lots of content in the evil region above a few 100 MHz. Even a single digital clock edge can be thought of as a short burst of a whole spectrum of sine waves, each with just the right amplitude envelope and phase to produce the digital edge you are used to seeing. If you change those amplitude profiles and phases a bit, you quickly get a mess that won't look much like the single digital edge you started with. Think of Harold's clock trace as a bunch of gremlins having great fun tweaking the amplitude and phase knobs of frequencies past a few 100 MHz. What you see back in the time domain are all these frequency components with the randomized phases and amplitudes reassembled. The result are effects you call rigning, extra clock edges, etc. So now that we understand what's really happening, how do we fix it? From the above, two solution in particular should be obvious: 1 - Reduce the frequency components of your signals to below the range where the gremlins can mess with them. This signal trace is still a "linear system" (beyond the scope of this message), which means it can't produce frequency components out of thin air. It can only mess with the ones you put in. 2 - Push up the lower frequency limit where the gremlins can start to play. Adding a series resistor followed by a capacitor to ground is strategy #1. So is slew rate limiting. These can all be thought of as reducing the high frequencies. Strategy #1 has another desirable effect, which is to reduce EM emissions the FCC would get bothered about. The tradeoff is that you still need some of the high frequencies to keep your clock edges fast enough for whatever you are trying to do. Faster clock means you need to keep higher frequencies. Adding termination at the ends of the line is one possible element of strategy #2. Note that this is tricky, since we don't really know the characteristics of the line, and what impedence it looks like accross the spectrum. Fortunately any sane guess is probably better than leaving the ends open, but don't expect it to fix everything. You can't make the gremlins go away, only push up the lowest frquency they get to play with. The best signal integrity comes from a combined approach. Use #2 to push the trouble frequency high enough so that you can apply #1 so that there is little content at that frequency and above. No dead fish need apply this time. ******************************************************************** Embed Inc, Littleton Massachusetts, http://www.embedinc.com/products (978) 742-9014. Gold level PIC consultants since 2000. -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist