Author Topic: SPI help  (Read 7079 times)

0 Members and 1 Guest are viewing this topic.

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #100 on: November 13, 2024, 07:52:34 am »
If you have a requirement for interference from your device, then you will have to install resistors on all lines. If you are only concerned about reliability, then installing additional resistors will not affect anything. The fact is that ringing occurs only on the signal fronts, it will have time to fade before the time of strobing.

This is actually quite correct. IF the clock configuration is right, then the whole point is that data is sampled in the middle of valid period. What drives sampling is the clock signal; so it's most important to "clean that up". Then the data signal ringing is a smaller problem because it has time to decay before sampling. But only if the clock configuration is correct.

Excessive ringing in other signals can still couple elsewhere and in extreme cases still cause functional issues for your own device. Not passing EMC is more probable issue.
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2457
  • Country: br
    • CADT Homepage
Re: SPI help
« Reply #101 on: November 13, 2024, 08:24:28 am »
In his first post the OP mentioned scoping the SPI lines but nothing of ringing. This is strange. He did not show a single measurement until now so the whole "ringing" is a bit fishy. Of course we all know how to make something that rings. By the way, usually there is parallel termination of digital signal by limiting diodes at the receiver end of digital lines.
Neither it was demonstrated that the digital design is correct and that the problem has been solved.

Regards, Dieter
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #102 on: November 13, 2024, 02:24:18 pm »
... That would be easier to verify if you posted a screen capture or photograph of the logic analyzer screen. ...
Northy, take a screenshot of the ringing; if you screenshot something that is already clear, then no improvement will occur in heads.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #103 on: November 13, 2024, 02:35:15 pm »
... That would be easier to verify if you posted a screen capture or photograph of the logic analyzer screen. ...
Northy, take a screenshot of the ringing; if you screenshot something that is already clear, then no improvement will occur in heads.

Well, quite obviously the best idea is a scope capture of both SCK and MOSI. It will show both signal integrity issues such as ringing, and clock relationship to data in a single capture.
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #104 on: November 13, 2024, 02:42:09 pm »
Well, quite obviously the best idea is a scope capture of both SCK and MOSI. It will show both signal integrity issues such as ringing, and clock relationship to data in a single capture.
Yes, I already asked about it. Because my picture, posted earlier, is not very informative. And a real screenshot would be useful. And useful, as we see, for many people.
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2457
  • Country: br
    • CADT Homepage
Re: SPI help
« Reply #105 on: November 13, 2024, 03:27:08 pm »
OP busy making the clock signal ring like mad.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #106 on: November 13, 2024, 03:41:35 pm »
OP busy making the clock signal ring like mad.

 :-DD
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #107 on: November 13, 2024, 04:16:46 pm »
OP busy making the clock signal ring like mad.
He doesn't want to say that he used a series resistor to see the ringing, so as not to offend you.

Because it will show that not only do you not know SPI, but you also don't know how to use an oscilloscope.
« Last Edit: November 13, 2024, 04:39:36 pm by Postal2 »
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #108 on: November 13, 2024, 04:54:09 pm »
You realize that this long ground lead with some ~50-100nH of extra inductance (and a loop which picks up any magnetic field) causes much more measurement errors than <10pF of input capacitance of a typical oscilloscope + 1:10 probe you are trying to reduce with an extra series resistor?

I mean, while at it, give more complete probing advice.

If only 1:1 probe is available then I wholeheartedly agree an extra series resistor is pretty important.
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #109 on: November 13, 2024, 05:03:16 pm »
This is a 1:10 probe, and it does not switch. Of course, you will not see everything in its pure form as in the picture. However, there is always a point nearby with which you can compare. And the assessment is made precisely by comparison.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #110 on: November 13, 2024, 07:26:28 pm »
Oh yes, you can probe the signal and then probe the ground plane next to the signal and take the difference of the two traces to remove the contribution of your ground lead antenna.

The rest of us will use the tool intended for the job, the springy thing that came with the probe which reduces the ground lead length from 10cm to 5 millimeters or so.
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #111 on: November 13, 2024, 07:30:33 pm »
Oh yes, you can probe the signal and then probe the ground plane next to the signal and take the difference.....
I already understood from your previous statements that it turns out that some people might have such a thought.
« Last Edit: November 13, 2024, 07:40:27 pm by Postal2 »
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2457
  • Country: br
    • CADT Homepage
Re: SPI help
« Reply #112 on: November 15, 2024, 09:24:02 am »
This is all futile in the case of SPI. We have a GHz scope and i have done work at 50 psec time scales. That was no SPI. Look at the numbers.
The ADUC is known to produce a weak SPI clock signal at 20 MHz, so the rise time will be about 3 to 5 nsec. At that time scale a short ground lead or any other 10 or 20 cm wire will slightly affect the signal, but not disturb a well designed digital transmission. I mentioned that above. Ringing isn't the problem.
I'm no moderator but here i see the continuous attempt to establish a false narrative. It started with the first post of the OP. Pretending to seek help but instead of documenting the problem, already proposing that resistor nonsense. Inserting resistors into on-board SPI signals is unnecessary and may in fact result in a transmission sensitive to crosstalk and EMI.
One exception i know of is driving high resolution ADCs with SPI interface, but then it's not about the digital signals but about protecting the analog signals. The resistors sit next to the ADCs SPI pins.
Another exception i know of is off PCB SPI transmission. Then you want to use slow clock, twisted pairs and the like to get reliable transmission. That's a different game, more like USB or Ethernet.

Regards, Dieter
 
The following users thanked this post: Someone

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #113 on: November 15, 2024, 11:39:07 am »
...  We have a GHz scope and i have done work at 50 psec time scales. .....
If you give a monkey glasses, it will put them on its butt.
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #114 on: November 15, 2024, 12:10:30 pm »
Inserting resistors into on-board SPI signals is unnecessary and may in fact result in a transmission sensitive to crosstalk and EMI.

Well, series-terminating a unidirectional single-ended point-to-point line driven by CMOS output stage is never wrong and can't hurt. For slow edge slew rates or short lines, it doesn't matter. For longer lines or higher edge slew rates it does.

Then again if OP has a shared SPI bus for those two slaves (instead of two separate buses), then it's not point to point and series termination will not work optimally.

Of course excessive resistor value would introduce extra RC filtering and increase the driving impedance enough for the line to become more susceptible to interference but that would not happen with usual values of 33R-47R.

Note that OP does not simply have SPI-on-board, they have SPI over two boards and cable with total length of 367mm. I would most definitely design in series termination on a board like this.

Adding inductor in series as suggested by our dear Postal2 is a colossally bad idea, I think, though. And of course, so is spending a lot of time into refinement of SI when the SI probably isn't the issue.
« Last Edit: November 15, 2024, 12:23:38 pm by Siwastaja »
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #115 on: November 15, 2024, 12:25:57 pm »
... Adding inductor in series as suggested by our dear Postal2 is a colossally bad idea, I think, though. ...
The inductor would dampen the resonance without reducing the amplitude. But it doesn't make much difference, a resistor would work too, if that's what you're used to. I would put a resistor too, if it were 50 cm closer on the table.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3997
  • Country: us
Re: SPI help
« Reply #116 on: November 15, 2024, 05:01:58 pm »
Oh yes, you can probe the signal and then probe the ground plane next to the signal and take the difference of the two traces to remove the contribution of your ground lead antenna.

I know you realize this is not the best approach but for anyone else reading: this is a method of last resort, do not use it until you have fixed everything else you can.  Doing a differential measurement like this will cancel pickup by the ground lead antenna, but it won't solve the biggest problem with passive proves which is ringing of the probe capacitance with the ground indictance.  That ringing is specificifically caused by transitions on the signal pin exciting the LC resonance.  If your prove the ground, there won't be any transitions to excite the resonance and you won't much.

If you see ringing on a prove and have lost the ground pin attachment for your probe or are too lazy to use it, this is what you should do: take a measurement with the ground clip attached.  Then, fold it up as close to the prove body as you can get, aiming for a 5:1 reduction in loop area.  If the ringing you observe changes significantly, then basically don't trust your measurement until you get a low indictance ground pin. 

I do measurements all the time with a typical 6" alligator clip ground lead.  But I just know how to recognize probe ringing and ignore it when that's not what I am looking for.  And when I care about that sort of thing I do install the low indictance ground pin.
 
The following users thanked this post: Siwastaja

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #117 on: November 15, 2024, 05:25:28 pm »
Oh yes, you can probe the signal and then probe the ground plane next to the signal and take the difference of the two traces to remove the contribution of your ground lead antenna.

I know you realize this is not the best approach but for anyone else reading: this is a method of last resort, ....
This kind of probe work is possible (ground checking), but only if you synchronize the oscilloscope with the signal you are searching for.

..... or are too lazy to use it, .....
Definitely.

... I do measurements all the time with a typical 6" alligator clip ground lead.  But I just know how to recognize probe ringing and ignore it when that's not what I am looking for.  And when I care about that sort of thing I do install the low indictance ground pin.
I completely agree.
 

Online ejeffrey

  • Super Contributor
  • ***
  • Posts: 3997
  • Country: us
Re: SPI help
« Reply #118 on: November 15, 2024, 05:33:32 pm »
... Adding inductor in series as suggested by our dear Postal2 is a colossally bad idea, I think, though. ...
The inductor would dampen the resonance without reducing the amplitude. But it doesn't make much difference, a resistor would work too, if that's what you're used to. I would put a resistor too, if it were 50 cm closer on the table.

Please nobody else listen to this, this is terrible advice.

Inductors don't dampen resonances except by accident: they *store* energy and are more likely to make your problem worse rather than better.  They do push the resonant frequency down, which might or might not help, but saying it is damping is completely wrong.
 
The following users thanked this post: Someone, Siwastaja

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #119 on: November 15, 2024, 05:50:19 pm »
... Adding inductor in series as suggested by our dear Postal2 is a colossally bad idea, I think, though. ...
The inductor would dampen the resonance without reducing the amplitude. But it doesn't make much difference, a resistor would work too, if that's what you're used to. I would put a resistor too, if it were 50 cm closer on the table.

Please nobody else listen to this, this is terrible advice.

Inductors don't dampen resonances except by accident: they *store* energy and are more likely to make your problem worse rather than better.  They do push the resonant frequency down, which might or might not help, but saying it is damping is completely wrong.
I don't understand why I have to explain obvious things.
First, try replacing the inductor through that powers the motor with a resistor.
Second, I recommended smd 0402, but it already has resistance and low quality factor.
Third, the output pin is involved in resonance, when we put the inductor closer to it, we break this circuit. The resonance will not change, it will simply stop.
If something is unclear, clarify what exactly, and do not try to criticize right away, so as not to look like a fool later.

Industrial engineering does not know about your recommendations (photo).
« Last Edit: November 15, 2024, 06:28:54 pm by Postal2 »
 

Offline peter-h

  • Super Contributor
  • ***
  • Posts: 4285
  • Country: gb
  • Doing electronics since the 1960s...
Re: SPI help
« Reply #120 on: November 15, 2024, 06:36:56 pm »
Quote
Please nobody else listen to this, this is terrible advice.
Inductors don't dampen resonances except by accident: they *store* energy and are more likely to make your problem worse rather than better.  They do push the resonant frequency down, which might or might not help, but saying it is damping is completely wrong.

Agree 100%. Postal2's postings have been previously discussed in various threads...
Z80 Z180 Z280 Z8 S8 8031 8051 H8/300 H8/500 80x86 90S1200 32F417
 

Offline Postal2

  • Frequent Contributor
  • **
  • !
  • Posts: 791
  • Country: ru
Re: SPI help
« Reply #121 on: November 15, 2024, 06:52:48 pm »
Quote
Please nobody else listen to this, this is terrible advice.
Inductors don't dampen resonances except by accident: they *store* energy and are more likely to make your problem worse rather than better.  They do push the resonant frequency down, which might or might not help, but saying it is damping is completely wrong.

Agree 100%. Postal2's postings have been previously discussed in various threads...

peter-h, your knowledge of the issue is not worth discussing.
Quote
Your frequency is 5 MHz. Up to 10 MHz you only need to worry about ringing on the CLK line

Nonsense; ringing is related to the edge properties, not the clock frequency.
... At 5MHz do I not need any filtering ....
.... The fact is that ringing occurs only on the signal fronts, it will have time to fade before the time of strobing. ...
 

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #122 on: November 15, 2024, 08:04:59 pm »
If you see ringing on a prove and have lost the ground pin attachment for your probe or are too lazy to use it, this is what you should do: take a measurement with the ground clip attached.  Then, fold it up as close to the prove body as you can get, aiming for a 5:1 reduction in loop area.  If the ringing you observe changes significantly, then basically don't trust your measurement until you get a low indictance ground pin. 

I do measurements all the time with a typical 6" alligator clip ground lead.  But I just know how to recognize probe ringing and ignore it when that's not what I am looking for.  And when I care about that sort of thing I do install the low indictance ground pin.

Yeah, I do agree that the best practice in a pinch without proper tools is to squeeze the ground lead closer to the probe while watching the screen. If you see the ringing reduce you can mentally imagine it reducing even more by eliminating the loop.

But really, you can use pliers to make a new springy thing for the probe tip from any (long enough) component lead; you may need to sacrifice one THT resistor just for the leg. It won't be as... springy as the real thing (which is made out of spring steel or something), but will work fine for a few measurements.
 

Offline dietert1

  • Super Contributor
  • ***
  • Posts: 2457
  • Country: br
    • CADT Homepage
Re: SPI help
« Reply #123 on: November 16, 2024, 10:09:29 am »
Another method is using an active probe. We have some Lecroy AP022 probes with 2.5 GHz bandwidth, 100 KOhm and 0.6 pF input. Often the active probe won't ring when the 10:1 passive probe rings visibly, i mean both with ground lead of similar length. The active probes came with those spring contacts, in order to capture analog signals up to some GHz. Wavelength at 2 GHz is 15 cm, so the ground lead of more than 5 cm will be a problem.
All this may be useful when you try to capture 1 nsec or faster signal edges, yet unnecessary with a typical SPI bus. If you do a measurement of a SPI bus with a 4 channel scope and all four ground leads attached, there will be very little ringing.

Regards, Dieter
« Last Edit: November 16, 2024, 10:19:51 am by dietert1 »
 
The following users thanked this post: Someone

Offline Siwastaja

  • Super Contributor
  • ***
  • Posts: 9198
  • Country: fi
Re: SPI help
« Reply #124 on: November 16, 2024, 12:31:16 pm »
Inductors don't dampen resonances

Yeah, but this is how Postal2's brain operates; in reality inductors cause resonances which then possibly need damping. If you reduce this to two keywords, "inductors" and "damping", you easily come to opposite (wrong) conclusion.

When inductance is added, you add damping e.g. in form of explicit parallel resistor, or by choosing a lossy inductor (lossy core material). Ferrite beads as shown in Postal2's photograph are a typical example of the latter.

But I would consider adding ferrite beads to SPI bus as a last resort option and that is if it's failing EMC testing (radiated or conducted emissions for example). I'm very doubtful they ever turn a non-functional SPI bus into functional one.
« Last Edit: November 16, 2024, 12:33:09 pm by Siwastaja »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf