SPLAT - the logic analyser you can run in an ANSI Terminal

In developing MAGIC32 I needed an easy way to monitor up to 32 channels of serial transmit and receive data so I wrote a quick and dirty logic analyzer which is a work in progress but working now and will eventually be cleaned up so it won't be so "dirty". Sample time at present is only 7us or higher but this is sufficient for me to test SPLAT although today I will add the fast sample and trig module to it. All updates will be on the code document link and as a binary in the dropbox folder.

I've attached the current binary which also is accessible in the Tachyon binaries dropbox folder along with the readme text for it.

An early test of 32 channels transmitting is included, just run DEMO and don't forget to read the SPLATDEM.TXT file.

Have fun now while I dread catching up on my MAGIC32 thread from late last night!
(after which I might get some time to actually do some work on it!)

Thanks Ray, I should have the faster sampling running later on and a few other features that have been added since. It is turning out to be quite useful indeed.

You know I'm still steering clear of that other thread for the moment, just haven't had time plus I just had Tubular drop in on his way to the airport, first time we've met up, so he saw my "hackerspace" We all need to meet up sometime, down Melbourne I'd say if you are in the country that is.

interesting...
Personally I have avoid such logic analysers as I couldn't thiink of an actually need.
But that all changes when one begins to explore FPGA devices with P1V. This could become very handy.

Yes really great to meet Peter and see his fantastic setup. Well worth the diversion at short notice.

Peter Splat looks really neat and I can see several uses for it. Look forward to playing very soon.

And if you guys are down this way be sure to let us know. Its a standing offer...

It was a bit sudden but at least it happened. Missed out on a beer though

Just updated the binary and added some more features including the ability to set the scale to ns/us/ms or based on baud rate. The PASM capture is installed and it also does a quick pin load test to see if the pin is pulled up/down or floating as it may appear anyway and reports that next to the channel number. I expect to add SD logging so long term captures of up to 128kB/sec (at the moment) can be saved. Then again I have another method which stores CNT along with the capture so that we only need to save transitions.

Once I am happy enough with SPLAT and my macroassembler I will dive into the MAGIC32 interactive coding and testing, all on the one Prop!

EDIT: just realized why I'm only getting 128kBytes/sec write speed because I must be doing an automatic sector read before write which I don't have to do for this application. If I fix that up and maybe even give it its own cog to speed it up a bit I should be able to keep up with logging 32 I/O with 115k baud streams.
SPLAT may also get some frequency/period measurement enhancements too.

EDIT: just realized why I'm only getting 128kBytes/sec write speed because I must be doing an automatic sector read before write which I don't have to do for this application. If I fix that up and maybe even give it its own cog to speed it up a bit I should be able to keep up with logging 32 I/O with 115k baud streams.

may be a separation of XADR and XADR! helps.
only the XADR@ needs to fetch the sector
and in the APPEND case the correct sector needs to be read before writing into it ...
open for append will do the job already

If you haven't tried SPLAT yet and have been wondering about it then here is a quick video with audio commentary.
It seems the audio is out of synch so I will have to fix that or else do another video, maybe a bit wider anyway.

I'm testing out a mode where I can load a cog with the overwriting sequence "mov $,ina" so that it will capture data at the fastest possible speed directly into a cog after which it offloads the cogdata to hub and stops. The load sequence just writes $A0BC01F2 with incrementing destination fields into the hub capture buffer, appends the instructions to offload that data into hub and then SPLAT does a cognew. There's a port change trigger sequence at the start but once it starts running it obliterates itself with data, spews it out, and dies. What a brave little cog!

20MIP sampling rate in one cog for up to 480ish samples.
( Not saying this is new, I'm just not aware of it being used before, but perhaps it has).

Yes, I did similar using 4 cogs to be iirc 1760 samples. Could do up to 12.5ns sampling using interleaving cogs. It was configurable.

What I wanted, and I worked on something similar for Phils browser project, was to do sampling at some lesser max rate using 2 alternating cogs, and filling up hub depending on available space. I was quite happy to plug an extra prop in parallel to achieve this.

I was wondering if the same technique was used on the 4 cog version. I know I could have looked at the code but I didn't want to cloud my thinking with "this is the way to do it". Never know, I might have come up with something different but good to see nonetheless that this technique is sound.

The only other thing I thought of was if I cascaded these cogs in such a wait (counting cycles perhaps) that as soon as one cog had filled its memory then the next could take over and so on. That way although we are not increasing the sample rate from 20MIPs we are increasing the depth. Four cogs should give us over 1800 samples.

Yes, I understand wanting to try without influence. Often then seeing another way later can lead to a better combo.
My 4 cogs start from the CNT plus an offset, so they can either interleaved for the fastest thru to running one after the other. Once you slow down enough it's possible to write out the cog to hub, and slower still to write directly to hub.
Once you are this slow it's possible to fill as much hub as is available.
If there is more time then extraction of the desired bits, then you can store even more.
Haven't tried writing out to SD card.

Having quite some fun with rolling my own logic analyzer where I can make improvements on the fly.

I've added a ton of new features and including an easy way to add labels and bear in mind too that even in a standard 32k EEPROM Prop system that you can save all the configuration with the normal Tachyon BACKUP command. The labels are entered from the shell command line in this manner with up to 4 characters per label:
19 LABEL TX20
25 LABEL REF
28 LABEL SCL
29 LABEL SDA

The labels will appear on the right and all you have to do to remove them is enter a blank name. You can even just keep these labels in a text file and copy and paste them into the command line. I've also tried to keep the format the same whether it is in SPLAT or on the command line so to change the width in SPLAT it is 150W or on the command line 150 W with whitespace. You can even set the number of channels from 8 to 32 so even a small screen will handle 16 channels easily.

I tried to put vertical division lines in the display but found all those ANSI escape sequences were slowing up the refresh so I have simplified the methods.
Latest update now includes simple trigger for change of state on selected channels, a faster refresh rate, ASCII decode, division markers, extended key support (cursor and function keys) and many other little things.

There's still a bit on my to-do list but If you have some ideas or requests then please feel free to comment.Dropbox binary has been updated. EDIT: Whoops, replaced binary with 115200 baud version

I tried the one in the OP, but couldn't get it working via putty. It looks like it's having trouble with the ANSI sequences. Has anyone else been able to use putty, or can suggest a better Windows terminal application that does work?

I tried the one in the OP, but couldn't get it working via putty. It looks like it's having trouble with the ANSI sequences. Has anyone else been able to use putty, or can suggest a better Windows terminal application that does work?

I use minicom on Linux or else TeraTerm on Windows as they both fully support ANSI modes. Minicom does require the -=color=on option though when launched.

Thanks, I got it up and running with TeraTerm. Next, I need to figure out how to capture a sample. I thought it was SPACE (according to TXT file), but that doesn't seem to have any affect other than refreshing the screen.

Also, did you get trigger capabilities implemented? It occurs to me that I won't be able to properly time a sampling without it.

Thanks, I got it up and running with TeraTerm. Next, I need to figure out how to capture a sample. I thought it was SPACE (according to TXT file), but that doesn't seem to have any affect other than refreshing the screen.

Also, did you get trigger capabilities implemented? It occurs to me that I won't be able to properly time a sampling without it.

I did not see the trigger implemented in the latest dropbox files
so you might try this patch

--- simple capture takes samples about every 7us - to be replaced by a fast RUNMOD function with trig function
pub CAPTURE2
$1F2 BUFFERS 512
(WAITPE) \ wait for trigger here or use line below depending on what you need
\ (WAITPNE)
scale @
IF
FOR OVER COG@ OVER ! scale @ us 2+ 2+ NEXT
ELSE
FOR OVER COG@ OVER ! 2+ 2+ NEXT
THEN
2DROP
;
REVECTOR CAPTURE CAPTURE2
{ set a mask here for Pin 12 or specify a multi pin mask directly into cog register 3
so it can be used by the wait words (WAITPE) \ or (WAITPNE)
in the modified CAPTURE above
#P12 MASK #P31 OR 3 COGREG !
\ or
$80001000 3 COGREG !
so just paste the above patch into the SPLAT image depending if you want to trigger on EQ or NEQ
and specify the mask before running the capture
P31 the RX is included so wait can be interrupted by a terminal activity and will not hang forever
}

Following on from adapting Life to run in V4 I have also adapted SPLAT which is now up and running again. But there is a limitation in the sampling rate as it buffers to hub so I was thinking since I originally did SPLAT I now also have ROMS in upper EEPROM that can be loaded into cogs. So perhaps I could write a PASM ROM that samples much faster and stores the result in the cog before transferring into a hub buffer. Then I could improve the trigger etc. Also sounds like I need to try all this on P2 as well.

Here is a screenshot of SPLAT capturing I2C EEPROM activity but as you can see my I2C routines do clock a little too fast for SPLAT and that's where the capture cog would come in handy.
P0 is outputting a 250kHz reference.