10
\$\begingroup\$

I am learning how to analyze SPI bus clock and data using an entry-level digital storage oscilloscope. I'm using a BK Precision 2542B to measure the output of the clock and MOSI lines from a Netduino that utilizes an ARM microcontroller.

Oscilloscope Image

In this image, I have the clock on channel 1 (yellow), and the MOSI on channel 2 (blue). The trigger is set to use channel 1, using a rising edge trigger of 1.44V. The clock square wave amplitude is about 3.3V.

The trigger indicator is at the center of the display horizontally, yet I have a pulse to its left. I was expecting the first pulse of the clock to start at the trigger location. I know that a digital storage oscilloscope allows you to see pre- and post-trigger events, but I'm confused why the first pulse isn't where I thought it would be.

Is my understanding of triggering incorrect, or am I just using a weird scope?

Edit: The pulse train is 300μs wide, repeats at 2ms intervals, and I have a trigger hold off value of 500μs. Adjusting the hold off has not changed the fact that one pulse precedes the trigger.

Edit 2:

After more analysis of the signal, including using the analog oscilloscope, I think I've determined that sometimes the pulse duration is about 350μs instead of 300μs. This may be a glitch in the code generating frames.

I discovered that a hold off time of 352μs will produce the expected result, but every now and then an extra pulse precedes the trigger.

Hold-off value

I recorded some frames to show the pulse both absent and present:

Leading pulse absent Leading pulse present

If I set the horizontal time base long enough to see the pulses' duration, there always appears to be at least 1.7ms between them:

Data pulses at 1ms per div

So while I think the leading pulse is a result of a "glitch" from the source, I'm still not sure how a trigger hold-off >360μs still produces the unexpected leading pulse.

\$\endgroup\$
  • 2
    \$\begingroup\$ Check your trigger menu - you might be triggering on the pulse being low for => a certain time and this will match the screen shot you have shown. Try edge triggering instead. \$\endgroup\$ – Andy aka Jul 13 '13 at 10:35
  • \$\begingroup\$ I also have a "entry-level" scope, Owon SDS7102, and it too will sometimes miss the first trigger. The behavior seems to depend on timebase/sample rate/memory settings and frequency of the signal. Maybe your too could be affected by timebase/sample rate settings? \$\endgroup\$ – AndrejaKo Jul 13 '13 at 11:36
  • 1
    \$\begingroup\$ I've seen $18,000 scopes be unable to turn around and retrigger in under 5 ms. Pretty sad, really. With a 2s interval at least that shouldn't be your problem. \$\endgroup\$ – darron Jul 13 '13 at 15:14
  • 1
    \$\begingroup\$ @darron As it happens the 2s was a typo - the pulses are at 2ms intervals. I think the scope is re-arming the trigger fast enough, but other factors are at play as I have mentioned in the update to the question. \$\endgroup\$ – JYelton Jul 15 '13 at 5:49
3
\$\begingroup\$

You probably have some sort of trigger filtering or delay turned on. Otherwise, a regular rising edge trigger should have caught the first pulse, not waited until the second. Look carefully thru the trigger menu and turn off anything called a "filter", "delay", "holdoff", and the like.

\$\endgroup\$
  • \$\begingroup\$ I edited the question. The data stream repeats every 2ms, not 2s. I've ensured no filtering is enabled, and that trigger hold off is slightly longer than the pulse train. My analog (BK 2190B) scope triggers just fine on the first clock pulse. The digital one, however, always misses it. I'm not sure what else to do except return the digital scope, it doesn't seem very capable. \$\endgroup\$ – JYelton Jul 15 '13 at 4:46
3
\$\begingroup\$

This same signal triggers just fine using a Tektronix TDS3014, with trigger hold off values ranging from 350μs to 1.5ms or more.

Tek TDS3014 Result

I think the answer, therefore, is to cross-check signals with more than one scope when something doesn't look right.

I was never able to get the BK 2542B to properly show the clock without either missing the first pulse, or showing random "glitching" or "garbage" making the clock pulses uncountable.

\$\endgroup\$
0
\$\begingroup\$

Dude, the SPI bus is synchronized on the fall of the clock line, not the rise, that is why everything looks misplaced !

Regards, Max

\$\endgroup\$
  • \$\begingroup\$ I bet the scope doesn't care about how SPI is synchronized, all it sees is signal A and signal B. \$\endgroup\$ – Dmitry Grigoryev Jan 15 '16 at 11:32
0
\$\begingroup\$

Well, technically your scope did nothing wrong: you wanted to sync on rising clock edge, and all your screenshots are. Nobody told you it will be the first pulse. If the scope starts recording sufficiently early, the trigger should hit the very first pulse, if not - tough luck, you get image #2.

What I can't quite understand is why you want your trigger on CLK, and not on SS signal. Falling edge on SS guarantees that you're at the start of the transaction, rising CLK edge does not.

EDIT: considering that you seem to always miss exactly one pulse, it looks like a bug in the scope after all. Still, see if triggering on SS helps.

\$\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.