cancel
Showing results for 
Search instead for 
Did you mean: 

Strange SPI Clock Form

YDOVG.11
Associate II

Hi all

I have a question regarding the clock output from STM32F446VCT6 MCU.

Can anyone tell me whether the clock signal looks good for you?

Because for me it looks awful.

The signals are measured directly on MCU pin (trace is 2 cm and is not connected to anything).

The oscilloscope probe with ground spring is used.

I expected to see a square signal - but this looks somehow strange.

I run 180 MHz MCU clock and 22.5 SPI clock.

Similar signals is measured on clocks for SPI1 (PA5) and SPI4(PE12) - different pins, different traces.

I tried to use different settings for pin speed - low, medium and very high.

All other periphery is disabled (not used). Only SPI is running.

The code is generated by STM32CubeIDE.

14 REPLIES 14

I don't have hardware to run this on, sorry.

JW

JMeye.2
Associate II

"The signals are measured directly on MCU pin (trace is 2 cm and is not connected to anything)."

Can you connect the trace to some device? Unconnected trace sounds like line reflection.

S.Ma
Principal

Looks like cross talk. If the SCK slave is disconnected, what do you see? Usually SPI data lines toggle around the clock edges, in the middle of the clock level duration more looks like sw slave data sampling. Weird.

No cross talk - I have a PCB where only MCU is mounted, nothing else. Slave is not connected.

The "hat" moves closer to the edge when I decrease frequency.

Danish1
Lead II

@YDOVG.1​ :

I have a PCB where only MCU is mounted, nothing else.

What power-supply decoupling do you have?

Have you wired up all Vdd and Vss lines? With a 0.1 uF decoupling capacitor within 5 mm of each pair of pins?

The "hat" moves closer to the edge when I decrease frequency.

By that, do you mean as a proportion of the period? In other words, is the "hat" a fixed time-duration from the signal edge?

In that case what you are seeing looks much like the effects of signal reflection from an incorrectly-terminated transmission-line.

I know you don't intentionally regard your SPI or other signal traces as transmission-lines. But at high-enough frequencies, everything is.

Now the "hat" occurs at about half a division of your 'scope screen at 20 ns / division. So that's roughly 10 ns. The speed of light is 3x10^8 m/s, so we're talking of a round-trip distance of 3m, so it looks like an unterminated wire length of 1.5 m.

What might be around 1.5 m long?

It could be the length of your 'scope probe lead (in which case maybe the hat isn't present when the 'scope probe isn't).

Or (if you don't have power-supply-decoupling capacitors within a few mm of the stm32) it could be the wires supplying power to your pcb from your good-quality bench power-supply.

Have you tried setting the GPIO pin speed slower (so the rise is less sharp); if so does the "hat" reduce in height?

Hope this helps you identify the source of this strange waveform,

Danish