2
\$\begingroup\$

I have two PCBs connected via ~20 cm ribbon cables to a Raspberry Pi (with a custom breakout board at the pi). The PCBs each have some port expanders (MCP23S08) and DACs on them, all of which I'm controlling using a shared SPI line. When I look at the SPI signals on the Oscilloscope, there is some very minor overshoot and ringing, but it doesn't look too bad and since I'm operating at 10kHz to 100kHz, I don't think this is an issue.

Now I experience the strange issue that one of the port expanders on PCB A only seem to be working when PCB B is not connected and stops working as soon as I plug in PCB B (they share the SPI CLK, MISO and MOSI, but have completely separate CS lines).

The problem is that as soon as I connect the oscilloscope probe to the MOSI line, it also starts working (even with PCB B plugged in), and the SPI signals look exactly as expected (this seems to be a classic Heisenbug). I suspected that the 1 MOhm impedance of the Scope acted as a pull-down resistor on the MOSI line, but when I add a 1 MOhm resistor from MOSI to ground it does not have the same effect.

So my question is:

  1. What is it about the scope that could change the physical behavior of the MOSI signal, if not the 1MOhm resistance? Is it the capacitance? Something else that I'm not thinking about?
  2. What could be an explanation for the problems in the first place? All my lines are not terribly long (20 cm), I'm at relatively low clock frequencies (but different frequencies seem to make no difference) and I don't have any line termination or pull-ups /-downs (except for the CS lines, of course). Could these be some kind of reflections at the chips on PCB B which disappear when I disconnect it and which are somehow absorbed by the Oscilloscope as soon as I connect it?
  3. Do you have any suggestions how I would go on with exploring the problem further? As it essentially goes away as soon as I connect the scope, I have no clue what else I could be trying...
\$\endgroup\$

3 Answers 3

3
\$\begingroup\$

First of all, you seem to have some misconception about ringing. If the ringing happens at high frequency and large enough amplitude, it does not matter if the clock speed is 1 Hz, if the ringing happens at 1 MHz, the devices on bus might interpret that as multiple 1 MHz clock edges.

  1. Yes, usually when things are just on the edge of working or not, things start working due to added capacitance and resistance of the scope probe, including the fact that the scope is a pull-down to ground.

  2. Low clock frequencies are irrelevant. It is the fast rise and fall rates of a clock edge that is the problem. If no terminations are present, sure expect problems. The fast edges may not be able to travel via cable and so the edges might already ring when transmitted to cable, and fast edges will reflect from the unterminated cable ends back to transmitter and then they reflect back to cable.

  3. Slow down the edges, drive them via source termination resistance to cable, and provide termination at the end of cable if problem still persists.

If you had posted schematics it might have been easier to see what the problem is.

\$\endgroup\$
2
\$\begingroup\$

Many problems are caused by cross-talk, especially when you're using a flat cable. If you are using a flat cable there should be a 0V between each signal to eliminate the cross-talk.

It is the edge rate not the frequency that causes the problems.

Possible solutions might be to put 20-30pF caps on SCLK, 33R series resistor on SCLK and MOSI.

Ideally you'd want 0V between each signal and some buffering at the PI end with series resistors to slow the edge rate a little.

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

Check that you're using the correct SPI mode. You should be sampling the data when it's stable, away from edges. If you sample at the edge instead, sometimes it works, and sometimes it doesn't.

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