In my recent electronics projects, I encountered two cases where a chip supporting the SPI protocol behaved in a weird or inconsistent way when communicating with the computer controlling it. I had an ADS 8320 Analog-Digital-converter (which should measure some voltage 100k times per second in 16bit resolution), which reported data like this when given a monotoneously rising, then falling voltage:
Weird data received from an AD converter via SPI (axes are x: t/samples, y: voltage/LSB) |
And recently, I had an ADF 4350 (a RF frequency synthesizer), which randomly sometimes reacted to my commands sent via SPI, and sometimes did not.
The problem turned out to be the same in both cases: the cable from the SPI controller to the chip was too long, apparently, and the signal got corrupted a bit — not much, but obviously enough for it to stop working (altough the signal looked perfectly clean on an oscilloscope!). Soldering 100pF condensators from the SPI lines to GND close to the chip instantly made both chips work reliably; the data from the ADC is nice and clean, and the ADF 4350 executes all commands as it should.
Same test as above, but with 100pF condensators on the SPI lines 🙂 |
So, if you’re using SPI with a controller which is not very close to your chip (like, when using the raspberry pi and a breadboard), make sure to add some noise reduction circuitry!
- SMD soldering with a pre-heater and self-etched boards
- Raspberry Pi i2c and repeated start condition and MAG3110 magnetometer
Categories: Everything