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!
Hi, i` have raspi and adf4350 can you give me your testing codes..
ReplyDeleteHere's a script which generates the registers:
Deletehttp://files.svenbrauch.de/adf4350.py
Don't forget to adjust the input frequency. You need to add code to send that out via SPI yourself.
Thank you very much.
DeleteOne question: 3.3 <---> 5 converter need?
DeleteIf your SPI master uses 5V, then yes, obviously, because the ADF4350 uses 3.3V
Delete