Logic sniffer shield

Further to some discussions on another thread re sniffing data on an SPI line I got the brilliant idea to use SPI serial RAM chips to do the actual data collection.

As many (all?) these chips have a "sequential" mode whereby bytes are sequentially written to consecutive locations the idea is to let them do the work then read and upload the results using the host Arduino.

Now for $30 you can buy a Bus Pirate so I'm not sure it's worth the effort, OTOH this could also be a 20MHz logic analyser as well and the number of threads I see here with issues that would be solved in 2 minutes if the data could be seen is huge.

Block diagram below.

Any thoughts from the collective?


Rob

Untitled-1.png

Need chip selects.
Control concept needs more detail - how differentiate between

register address, read/write, data,
and
start address, read/write, data
or
start address, more address, read/write, data, data, data, data?

Can be made to look like a FIFO. FIFO on the other hand, just catch all writes, read them all back, let the software determine if what went out is what was intended.

Or is that what you were thinking? Just capture everything as bytes, no interpration, and read it back? (Sorry Rob, it's kinda late here)
In which case, just need the chip selects.

I just gave the data sheet for the 23A256 a quick look over.

It seems that you can send a control byte or two to set the address etc. and put it into sequential mode. Thereafter every 8 clock pulses stores a byte until you stop.

You're right about the FIFO though, it's probably a better choice. At 50MHz you don't need all that shift reg stuff in the design on the other thread I would think, just use it as a 9-ch analyser.

I just had a look at the price for an IDT7208, $30-40, yikes! Still you only need one. The 23A256 is $2 and for the same bit width you need 9 of them, OTOH 4 bits is probably enough.


Rob

With the FIFO you will have to start reading at the same rate as writing once the chip is full if you want to have a "stop on trigger" mode.


Rob

Yeah, the big ones are kinda pricey. I only ordered four 4Kx9 (as 28 pin DIPs, wirewrap to start). Build up a bidirectional 4K x 16 to start, see how it goes.

Hadn't thought about how to tell it to start/stop yet. Was only thinking capture whatever came out to start.

Like all these logic analyser style projects when you start adding real useful stuff like triggers, start on trigger, stop on trigger, trigger in center of data etc it gets much harder.

One problem with SPI is getting synced with the data, one bit out and it's all garbage.


Rob

For syncing, I would think that as long as you use the SS to clear things & only clock on SCK after SS goes valid, it would go pretty smooth.
Unless you get a clock glitch somewhere, then garbage after that for sure.

Adding a data compare to capture after a specific value could be handy, or maybe a double like that (for say a 16 bit address). Or something external to allow trigging to start, like your Pulse code.

He he, check this out

http://dangerousprototypes.com/docs/Logic_Shrimp_design_overview

I guess I'll go back to what I was doing :slight_smile:

Although it's not an Arduino shield and I can see room for some extra features.


Rob

Interesting concept. Bear in mind SS can go low for quite a while, so syncing might still be a problem.

One of the selling points of the Saleae (bah, I always have to check how that is spelt) is that it can handle massive sample sizes because it uploads them via "bulk USB" protocol (I don't remember it exactly), I think with some sort of data compression. That is, most times the samples are going to be the same, especially at high sample speeds.

Now consider that even using 23A256 chips (256 K bit, that is 32 K bytes) sampling at 20 MHz, you are going to fill up the chip in 1.6 mS, assuming you are sampling 8 channels. Data compression would help a lot (that is, don't record consecutive bytes that are the same) but that requires extra logic, some sort of "smarts" like a CPU can give you.

For that matter, the "SPI sniffer" code I gave in the other thread would run out of RAM really quickly (after all, the Atmega328 only has 2Kb).

For sniffing something highly specific, where you have a nice trigger you can rely on, this could work really well - or even just the Arduino capturing a short burst a 4 MHz.

For more generic debugging, you probably want one of the established logic analyzers.

One other idea is to use a CPLD - something like this:

http://majolsurf.net/wordpress/?page_id=1302

That is fairly cheap, and you could use that to capture SPI and dump to an SRAM chip.

I always have to check how that is spelt

Me too, I usually launch the program and look at the title bar :slight_smile:

you are going to fill up the chip in 1.6 mS

Yes, I did the maths also, that's not a very long time. OTOH using an external clock for SPI it's a huge amount of data.

can handle massive sample sizes because it uploads them via "bulk USB"

True, and many is the time I have a high-speed burst of data separated by a long period.

That CPLD board looks interesting. I was an early adopter of PLDs back on the 80s but have got well out of touch. In those days I had to spend a few days down in Sydney working on the Altera CAD system in their offices. Now you can do it at home for $20. Unbelievable.

I guess you could add run length encoding, but that would probably double the hardware needed. Maybe I should look at that CPLD board again.

I know it's been done before and as I just pointed out in almost exactly the same way, but it's such a fun project maybe it's worth doing anyway.


Rob

Nick,
I have a counter that creates a Write pulse to the FIFO every 8 SPI clocks to keep in sync.

Sure seems like plenty of hardware options are available, many with the corresponding PC software.

I think creating a modern-looking GUI that's easy to distribute might actually be the hard part.


Rob

Yes, and that is certainly not my forte!
I'm thinking to start just capture the data, review manually, or write a script to compare to what I expect to see.

I've done a lot of app/GUI programming in VB6 and some in VB.NET so I could probably knock up a reasonable UI. .NET apps used to be a real pain to distribute but I think that's all changed. Trouble is all that is Windows only.

Probably a simple dumb terminal prog might be the easiest way to start off.


Rob

Guess I better get a board layed out & start wirewrapping then.
Just got back from more taping & painting. I am sore! Going back in a few hours for 2nd coats.
The kids can have fun tomorrow peeling the tape off the floor!

My idea has growed a bit so I started another thread, similar idea but much more than a logic sniffer.

http://arduino.cc/forum/index.php/topic,71610.new.html#new


Rob