Hey,
I'm fairly new to the electronics scene and was wondering what the minimum specs for an oscilloscope would be if i needed to look at raspberry pi spi transactions?
thanks.
Hey,
I'm fairly new to the electronics scene and was wondering what the minimum specs for an oscilloscope would be if i needed to look at raspberry pi spi transactions?
thanks.
As SPI is only upto about 125MBits on the PI but typically way slower, then a 100Mhz scope should work, but if your coding it then you can select a slower SPI speed and therefor use a lower bandwidth scope. It depends what your trying to look at, if it is the actual waveforms then you will need 100Mhz min. If it is actually to protocol decode it and verify the operation then a logic analyzer may be more effective. the reason I say this is because at 100Mhz, if your trying to look at the waveform you will need probably nearer a 500Mhz scope in order to see the rising and falling edge speeds more accuratly, a 100Mhz scope looking at a 100Mhz square wave will show an attenuated sine wave due to being at the limits of the scopes bandwidth and the edges of a 100Mhz square wave is way faster than 100Mhz, even a 500Mhz scope will show some rounding of the edges
Do you know the speed of the SPI but in your instance ??
another option if it is a SPI bus your looking at is a Logic Analyzer like a Saleae or similar like a bus pirate
It depends on how fast you will crank the SPI clock - I'm not an RPi expert but a quick web search suggests it can do at least 32MHz clock but a lot of the time you wouldn't go this fast.
To see logic states on the SPI you need a scope with 4x the clock bandwidth and to do signal integrity at least 10x the bandwidth an at least 20x the sample rate.
But a basic scope isn't a lot of help with spi - what you really need is a logic analyzer - which you could buy stand alone (cheapish) or as part of a mixed signal scope - lots more money.
Some of the nicer scopes offer SPI decoding (usually as a paid for extra) and with a 4 channel scope this can be pretty good.
You can also get SPI only analyzers and this can be very cheap (compared with scopes) but is much more limited.
I can't advise anything specific without knowing your budget and a bit more about what your need to do - mostly people expect a scope to do lots of things so if you can define some of the other things you would like it to do that would help.
MK
I would suggest that since in this instance you are looking to track digital signals you may want to look at something like the Saleae logic 8/16 port Analysers which you can get clones of for a few pounds. I have several and they work very well they should be good for a few megs therefore OK for most SPI traffic if not at the ultimate speed. (Yes you can always get faster ones). Scope wise you could do much worse than the RIGOL1054Z which can also do serial logic decode at around 280 ish £
Yeah the problem is that been new he doesn't know what he needs and no doubt will get conflicting advice. I suggested the cheap logic analysers since they are far from perfect they do represent good effective value and not a money to kick out doing most things OK. That way he can learn exactly what he wants and still have plenty of toy budget for the next thing
Thanks guys!
I will be looking a logic analyzers now. Seems like a super useful piece of equipment. the raspberry pi spi speeds seem to be somewhat ambiguous and looking at the source code of what I'm trying to analyze, the spi speed is set to the max allowed by the driver which is 125Mhz, but from what I've read, it never actually reaches that speed, so we'll see.
Thanks again. super helpful
There is a difference between Data Rate and Bit Rate, you can crank the bit rate upto the 125Mhz and it probably does exit the PI at that speed but only for that byte of data, the time it takes the code to loop around and grab the next piece of data will slow down the overall rate considerably resulting in considerable degration in overall datarate resulting in the figures arround 10 or 20Mhz, this actual result may depend on the activity the pi is doing during the transfer
I did not notice an answer that suggested a storage scope. Often a SPI message stream does not repeat and you want to trigger and capture the one occurrence. The logic analyzer is great if you do not need to correlate the SPI timing with some other event. An oscilloscope does provide a tool that has many signal analysis uses besides SPI. A storage scope will be digital and should have a sample rate over 250 Megasamples/sec to monitor SPI and other computer related signals. As others have said here, you need several times the sampling rate of the signal being analyzed.
It is great to have nice tools if you can afford it. Electronics and computers keep getting more powerful and cheaper as time goes on. So does powerful electronic test equipment. My LeCroy 4ch, 4 Gigasample, multi-color scope was built in 1992 for about $10,000. I bought it on eBay for $1,500.00. It even does FFT spectrum analysis (nice).
Those Saleae clones will sample up to 24MHz. This means that if you set the SPI clock above 12MHz, you'll miss data.
If the bit rate is 125MHz, you need something that can sample at at least 250MHz.
Note: The 125MHz number sounds fishy: IO pins on the 'pi are not usually capable of speeds beyond about 50MHz. You'd have to take "extra care" in routing the signals, differential pairs etc etc. This is not the case for the SPI signals routed to the GPIO connector.
On another note: If you set the bit rate at 125MHz, the raspberry pi will be able to sustain that for a while. The raspberry pi is able to feed the SPI module with DMA, and doing 15Mbyte per second is easily achieved by the DMA module.
If you're having trouble with some SPI things, I'd first reduce the clock rate below 125MHz. See if that helps.
Question is who has the SPI bus wound up that fast?
Most parts will only do a few megs and therefore the cheap Saeleae stuff will be more than good enough.
Also I would say that choosing a clock divider on the SPI that was fast enough but not too fast would make a more reliable solution in terms of ease of design and signal integrity.
The RPF documentation on SPI is quite useful as well
https://www.raspberrypi.org/documentation/hardware/raspberrypi/spi/README.md
The RIGOL 1084Z was a storage scope!
As the chap in question is brand new to the game I thought I would avoid references to posh kit as these are special purchases and ideally you need to know what you want before you buy and you certainly don't want to pay the new price !! I too have a 10K scope but damned if I would pay 10K for it ... It's like recommending a Porsche to a learner driver when a mini might be more appropriate.