Shop OBEX P1 Docs P2 Docs Learn Events
SPLAT - the logic analyser you can run in an ANSI Terminal — Parallax Forums

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

Peter JakackiPeter Jakacki Posts: 10,193
edited 2015-09-06 05:07 in Propeller 1
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!)

EDIT: <link to online manual> and <binary> and latest video.
LATEST: 150906 Added ASCII decode on cursor

Comments

  • Cluso99Cluso99 Posts: 18,066
    Thanks Peter. Always dreamed of doing a prop pin logger. Made a number of attempts but never completed to my satisfaction. Perhaps this will do what I need at.times
  • 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.
  • Cluso99Cluso99 Posts: 18,066
    Pleased you finally caught up with Lachlan!
    I am back in Sydney (Wyong 100km north) after 4 1/2 weeks in S.Korea.
    We should catch up in Melbourne - maybe after we've played with the P2 for a while ;)

    Meanwhile, I have some fast sampling done using multiple cogs. Need to dig it out again. I was experimenting with output to my 4" composite monitor using shrunk special font to get more on the screen.
  • MJBMJB Posts: 1,235
    there is the PROPALYZER fast sampling code around.
    played with it long time ago.
    4 interleaved cogs
    but that is not what we usually need bit slower in one COG is fine most of the time.


  • 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.
  • Thanks Peter looking forward to trying after my current IOT project.
  • This is very cool :).

    Is splat written in forth or pasm? If pasm, I'd be interested in writing a c/c++ interface for use outside Tachyon.
  • MJBMJB Posts: 1,235
    This is very cool :).

    Is splat written in forth or pasm? If pasm, I'd be interested in writing a c/c++ interface for use outside Tachyon.

    it is writtten in Tachyon FORTH
    only the fast sampling routine is a little PASM snipped.
    I haven't seen it yet, but I think it will be a <18 instruction RUNtime MODule

    If you need a PASM module to integrate with your C code
    I'd recommend you have a look at the PROPALYZER capturing code.
  • 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...
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-02 07:27
    Tubular wrote: »
    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.

    Screenshot%20from%202015-09-02%2017%3A11%3A55.png
  • MJBMJB Posts: 1,235
    edited 2015-09-02 12:19
    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.
    pri XADR! ( xaddr -- addr )
         @WRFLG C~~
    pub XADR ( xaddr -- addr )                    --- make sure sector is loaded into SDBUF and return with physical address
        DUP 9 SHR _sector @ <>                    --- same sector - buffered already?
        IF                                    --- No
             FLUSH                                --- make sure any writes to the current buffer are flushed
            DUP 9 SHR SECTOR                     --- get sector into SDBUF if not already there
        THEN
        9BITS SDBUF +    ( 4.6us )                --- return with physical address
        ;
    
    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


  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-03 02:10
    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.

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-03 05:12
    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).
  • Cluso99Cluso99 Posts: 18,066
    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.
  • Cluso99Cluso99 Posts: 18,066
    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.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-04 14:46
    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.

    There is also an online live manual that is being constantly updated.

    When you want a timing diagram it is easy enough to do a screenshot of course but you can also just copy and paste the text itself like this:
    .:.:--TACHYON--:.:. SPLAT LOGIC ANALYZER V1.0 
        012345678901234567890123456789012345678901234567890123456789012345678901234 
     00d__________0____---______---___------______---------___---___------------___TX1
     01u__________0____---______---______---------___------___---___------------___TX2
     02d------____0_---------___---__________________---______---___------------___TX3
     03x___---____0_______---___---___---___---___---------___---_________---___---TX4
     04d----------1-___------___---______---------___------___---___---------______TX5
     05u___-------1-___------___---___------______---------___---__________________TX6       
     06u__________0____---______---_________---___---------___---___------------___TX7       
     07u---_______0____------___---______---------___------___---_________---______TX8       
     08d---______-1----------___---__________________---______---_________---___---TX9       
     09d__________0____---______---___---______---______---___---__________________TX10      
     10u__________0____---______---___---_______________---___---______---------___TX11
     11d___------_0_---------___---___---___---______------___---__________________TX12
     12u______---_0_---------___---____________---___------___---__________________TX13
     13u___-------1-___------___---___---------______------___---___---___---______TX14
     14u___-------1-___------___---___---------______------___---___---___---______TX15
     15u___------_0_---------___---___---___---______------___---_________------___TX16
     16x---_______0____---______---__________________---______---______---_________TX17
     17u__________0____---______---___---______---______---___---__________________TX18
     18d---___---_0_---------___---__________________---______---___---___------___TX19
     19u______----1-___------___---_________------___------___---__________________TX20
     20u----------1---------------------------------------------------------------- 
     21x__________0________________________________________________________________ 
     22x__________0________________________________________________________________ 
     23x__________0________________________________________________________________ 
     24x__________0________________________________________________________________ 
     25d-___----__0----___---____---____---____---____---____---____---___----___--REF
     26d__________0________________________________________________________________ 
     27u----------1---------------------------------------------------------------- 
     28u----------1----------------------------------------------------------------SCL
     29u----------1----------------------------------------------------------------SDA
                    SCALE=115,200baud x1 @0 = F818.6130                             
     ok    SPLAT - Serial Propeller Logic Analyzer Terminal  150905-0050 
    
  • Cluso99Cluso99 Posts: 18,066
    Looking better every day Peter :)
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2015-09-16 08:05
    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


  • koehlerkoehler Posts: 598
    edited 2015-09-18 07:01
    Deleted, found the MAGIC32 thread.
  • Two questions:

    Should I be using the binary in the OP or the one in DropBox?

    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?
  • ZTERM
  • Seairth wrote: »
    Two questions:

    Should I be using the binary in the OP or the one in DropBox?

    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.
  • ? gets you the help screen, I will have to hook it back up and check but this is what I have on file.
    SPLAT COMMANDS
    <num>	z	Set zoom
    <num>	w	Set width
    <num>	c	Set cursor
    <num>	s	Set scale in clocks or use 'n's 'u's 'm's 'b'aud
    <num>	>	Scroll right by 4 or num
    <num>	<	Scroll left by 4 or num
    	/	Reset scroll to starts
    	TAB	Start Capture
    	r	Continous RUN mode
    	SPACE	Stop, clear entry, and refresh screen
    	0..9	number entry
    	Enter	Exit to Tachyon command line shell
    
    
    To resume SPLAT from the command line enter "r" and hit enter.
    
    
  • MJBMJB Posts: 1,235
    edited 2016-03-23 09:01
    Seairth wrote: »
    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
    
    }
    
    
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2017-03-09 11:41
    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.
    1381 x 767 - 21K
Sign In or Register to comment.