2
\$\begingroup\$

I have a cheap and nasty commercial SPI-based audio player which I'm playing with, for practice. It's based around a blob microcontroller and an 8-pin 25F SPI flash chip. I've removed the chip from the board so I can dump it, and have soldered extension wires onto the board so that I can get it working again without having to solder the chip back on. Now, of course, it doesn't work.

The SPI clock runs at 8MHz and my wires are about 4-5cm long. Looking at the result with a scope shows that the waveforms look noticeably grottier than they did before I removed it. Screenshot below; lines are, from top down, CS, MISO, MOSI, SCLK.

So, what could be wrong? I've checked the obvious things like making sure of the pinout, continuity, correct power, that the flash chip does actually work, etc.

  • capacitance: is that really an issue for a 5cm wire? Can I just rule this out because the wires are too short --- at what point does it become an issue? 8MHz is faster than I expected, TBH.

  • crosstalk/noise: likewise, 5cm? The traces on the board itself are maybe 2cm long and are much closer together than my extension wires. The wire resistance itself should be negligible too, right?

There seems to be a lot of noise coming from somewhere...

enter image description here

Edit: Apparently I'm not going to be able to get away without posting a picture of my monstrosity, so here it is. Enjoy. The flash chip is in the ZIF socket on the left. The wires are solid core.

enter image description here

\$\endgroup\$
10
  • \$\begingroup\$ Is there a GND wire as well? How does it look like? \$\endgroup\$
    – Eugene Sh.
    Commented Nov 12, 2021 at 14:44
  • 6
    \$\begingroup\$ Do you have a decoupling capacitor on your power wire close to the chip? Some parts really suffer if it isn't there. \$\endgroup\$
    – Arsenal
    Commented Nov 12, 2021 at 14:59
  • 1
    \$\begingroup\$ A picture of your construction would help us. Sounds like you "sky-wired" the device. You never asked about inductance in the wires which is probably the cause of the issue you are running into. \$\endgroup\$
    – mike65535
    Commented Nov 12, 2021 at 15:00
  • \$\begingroup\$ Picture posted --- it's very bodgy. I haven't come across the 'sky-wired' phrase before but it's apt. \$\endgroup\$ Commented Nov 12, 2021 at 15:32
  • 3
    \$\begingroup\$ Lack of a decoupling capacitor very close to the IC is asking for trouble. \$\endgroup\$
    – TonyM
    Commented Nov 12, 2021 at 15:45

2 Answers 2

5
\$\begingroup\$

The problem is not the frequency of the SPI clock itself being too fast.

Even if you could change the SPI clock frequency to 1 Hz, the edges of each of the SPI bus signals would still ring, because the edges are too fast.

So it's about the slew rate of the edges of the signals.

And the problem may not be wire resistance, or wire capacitance. Wires also have inductance, which complicates things in conjunction with the capacitive load of the chip IO pins.

Fast edges means chip IO pin capacitance must be charged and discharged rapidly with fast and large current spikes. As the extra wiring has inductance, it resists the fast change of currents, and of course inductance and capacitance forms an LC resonator which can ring.

And since all charge and discharge currents flow through one single ground wire, it affects all the signals. This is one form of ground bounce.

Another matter is if the SPI flash has bypass capacitor at the flash chip end of the wire.

To slow down the signal edges, usually series resistors are put on right at the chip outputs before the fast edges reach the wires.

\$\endgroup\$
1
  • \$\begingroup\$ I actually learned what those resistors are for! Thanks! I've seen them so many times (I fix laptops, so I see a lot of professional schematics and boards), but didn't exactly understand why they were necessary. Thx! \$\endgroup\$
    – Ilya
    Commented Nov 12, 2021 at 15:53
1
\$\begingroup\$

No way to tell for sure, and I'm definitely not a noise expert, so I'll just post my opinion. Maybe something will help.

This doesn't look like capacitance issue. There is high frequency noise there, and it makes the same "jumps" on all your lines at the same time.

First, make sure clock line doesn't go too close to other lines. Given your SPI frequency, you can have a length mismatch or half your room, it won't matter.

Maybe you can try to put 100R resistors on the SPI lines. Check ground connection. Make sure the flash chip is decoupled properly. This actually looks like your return currents on ground path from multiple signals get mixed.

!!!!! I don't know how your construction looks, but if your SPI Flash IC has just a ground wire, it could be the culprit - that's where return currents mix together and couple into one another. Also, wires like picking up all sorts of noises. Which, due to mutual coupling via GND wire, if ther eis one, are shared between all lines. If that's the case, you'll need good decoupling and maybe thicker gnd wire, although I'm not sure whether it will help much. My word on this topic is based on general intuition, I don't have too much experience troubleshooting things like this. Take my words with a grain of salt and a little sugar.

It would really help if you posted a pair of pics of your makeshift monstrosity.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.