Streamer for digital pin sampling
 Cluso99            
            
                Posts: 18,071
Cluso99            
            
                Posts: 18,071            
            
            
                            
                                  in Propeller 2             
        
                    I would like to use the P2 streamer to sample I/O pins and am not sure where to start.
I have a separate cog that will wait for a que to log a sample of pins.
What i need to understand is how to setup the streamer to read 'n' samples of pins, where these samples will be saved, and if I can save a group of pins.
Can I sample P0-P31 (a long) each clock?
Is there any sample code to look at?
                            I have a separate cog that will wait for a que to log a sample of pins.
What i need to understand is how to setup the streamer to read 'n' samples of pins, where these samples will be saved, and if I can save a group of pins.
Can I sample P0-P31 (a long) each clock?
Is there any sample code to look at?

 
                            
Comments
Have a look at my P2 logic analyzer, it should help.
https://forums.parallax.com/discussion/163967/p123-a9-prop2-logic-analyzer
I often just want to see what is happening on a group of pins. I can easily set something to start the sample off, and let it run for 'x' samples.
Hopefully it samples on every clock. I presume this is possible?
I expected the streamer part to be way more complex to setup. Should get some time to try it today.
Thanks Chip. Similar to P1 timer setup
con ' Streams INA (32 bits) to hub. sample_length = 4000 'longs dat orgh org 0 ... setxfrq ##$8000_0000 'sysclk sample rate wrfast #0,##@samples ' %1111_xxxx_xppp_xxxx << 16 ppp=000 P00-31, =100 P32-63 ' %1111_xxxx_xppp_xxxx << 16 ' 000 P31-0 ' 001 P39-8 ' 010 P47-16 ' 011 P55-24 ' 100 P63-32 ' 101 P7-0+P63-40 ' 110 P15-0+P63-48 ' 111 P23-0+P63-56 xinit ##%1111_0000_0000_0000 << 16 | sample_length,#0 'P00-31 ' xinit ##%1111_0000_0100_0000 << 16 | sample_length,#0 'P32-63 waitxfi '******************************************************************* orgh $4000 samples long 0[sample_length] '*******************************************************************Using the streamer in writing pins to hub, if I just want to write 8 pins, I use WRBYTE.
The docs seem to imply that a byte is written to hub on every NCO rollover.
Does the hub address increment by 1 for each wrbyte?
And if I am streaming every clock, will the streamer/fifo pack the bytes up where necessary as the hub window is 8 clocks and each clock the window advances by a long address?
If I want to change the buffer during the screen display, do I need to insert an FBLOCK instruction (D[31]=0) in between one of the line displays? Will it store the new values ready for the RDFAST count expiration?
eg At the start of the visible lines, execute an FBLOCK ##blockcount,##hubaddr and halfway thru the visible lines, execute another FBLOCK ##blockcount,##hubaddr2 where blockcount= 1080 /2 /64 /2 = 135/32 ??
I want to build the 1080 screen into sections - part graphics and part text. I want the whole 512KB HUB for screen buffer, so I will need to load up cogs/luts first, then clear hub for the buffer.
This is the "FUN" that we all love
And it's testing out the P2 in different ways.
'' Sample P0-P31 using streamer to hub on every clock cycle... setxfrq ##$8000_0000 'sysclk sample rate wrfast #0,##@samples ' %1111_xxxx_xppp_xxxx << 16 ' 000 P31-0 ' 001 P39-8 ' 010 P47-16 ' 011 P55-24 ' 100 P63-32 ' 101 P7-0+P63-40 ' 110 P15-0+P63-48 ' 111 P23-0+P63-56 xinit ##%1111_0000_0000_0000 << 16 | sample_length,#0 'P00-31 ' xinit ##%1111_0000_0100_0000 << 16 | sample_length,#0 'P32-63 ' xinit ##%1110_0000_0000_0000 << 16 | sample_length,#0 'P00-15 (16 bits) ' xinit ##%1101_xxxx_xppp_pppx << 16 | sample_length,#0 'P00 (1 bit) wkg waitxfiThe following is in the document, but I am not following the explanation or get it to work for 8-bits, 4-bits or 2-bitsAnyone have it working in byte/nibble/nit modes?
Does the 'solved' above merely avoid this bug ?
Not sure, but the streamer is getting a big makeover. I'll need to recreate exactly what the problem was. It needs to be known for the current silicon.
Hope to combine my sampler with my VGA today. Wish me luck
There's another one, I believe, that has to do with WFBYTE 1/2/4-bit modes and count LSBs in D[2:0].