# Digital oscilloscope minimal sample rate to capture SPI data going at 500 kHz

I need to debug an SPI bus coming out from a beagle board XM rev. C. The clock of this bus is 500 kHz.

To do this, I have a SIGLENT SDS1022DL digital scope. Its sample rate is 250 MS/s and the analog bandwidth is 25 MHz.

According to Nyquist, the minimal sample rate to have a reliable digital measurement in my case should be 1 MHz but, in practice, I need at least a 4x faster sample rate, so 2 MHz should be fine. If so, my scope specifications are adequate for my purpose.

Am I right?

-

More than adequate, as I think any scope will be for sampling 500 kHz. 500 kHz is a period of 2 µs, so at 250 Msps that gives you 500 samples per period, enough for measuring time with a 0.2 % accuracy.

Note that the scope's bandwidth is enough to capture up to the 50th harmonic of a 500 kHz signal. Even with a brick wall filter, cutting of all further harmonics (which doesn't happen), as a first approximation your square wave will still look like this:

So the edges of your signal won't suffer from the bandwidth limitation.

-
 I wouldn't say any scope. There are some truly low-end ones out there, e.g. USB ones. – Brian Carlton Jul 3 '12 at 19:15

Your scope will be fine, yes.

When calculating required bandwidth, remember that a square wave will have frequency components much above it's primary frequency. The upper bandwidth of these components is solely dependent on the rise time of the signal (i.e. you could have a 1Hz square wave with a 1GHz component if it's rise time is fast enough)
Generally with a square wave you need at least the first two harmonics (3rd and 5th) for it to look much like a square wave. Since a square is composed of odd harmonics, so for your 500kHz signal you need at least a 2.5MHz bandwidth (i.e. 5th harmonic), preferably >5MHz.
This makes a big difference, as for debugging purposes you are likely to miss ringing, transients and other problems if the bandwidth isn't high enough.

-

What will matter is not the maximum sample rate for the scope, but the fastest sample rate the scope can use while capturing a long enough time window to be useful; in many cases, that will be limited by the length of the scope's data buffer. If you need to capture two consecutive SPI transactions which are separated by some amount of time, you may have to "zoom out" pretty far enough that the scope's sample rate drops to the low MHz. Depending upon the scope's buffer size and the amount of time between transactions, even that may not be enough.

Deciphering SPI data may be possible if the scope's sampling interval is no longer than the amount of time that the SPI wires are "stable" between transactions, but the data will be much easier to read if the sample rate is at least twice that, so that the lines will be stable for at least two sampling intervals. For a 500.0khz data rate, a 2MHz capture rate would probably work decently; one may occasionally end up capturing things right on the transition, yielding an "ugly" trace, but even then the data should be decipherable even if it's a little hard to read.

Note that if you're interested in trying to determine why an SPI receiver isn't getting the data that was sent, you may need to use a much faster sample rate (so you can judge whether clock-signal edges look clean, setup/hold times look decent, etc.), but in those cases you probably wouldn't need to capture data for as long, and you could thus use a faster sample rate. For that purpose, at a data rate of 500Khz, one would be hard-pressed to find any non-"toy" scope which wouldn't be adequate.

-