Streaming mode ps4000

Post general discussions on using our drivers to write your own software here
Post Reply
svebert

Streaming mode ps4000

Post by svebert »

Hi,

I have troubles when aquiring data in streaming mode.
The buffers I register with this code (like in the example-file)

Code: Select all

...
unsigned long sampleCount= BUFFER_SIZE * 10;
unsigned long sampleInterval = 1;
...
for (i = 0; i < unit->ChannelCount; i++) // create data buffers

	{
 	ps4000SetDataBuffers(unit->handle, i, buffers[i * 2],
		                     buffers[i * 2 + 1], sampleCount);

	}
Then i start streaming with

Code: Select all

status = ps4000RunStreaming(unit->handle, &sampleInterval, PS4000_US,0, BUFFER_SIZE,FALSE, 1,                           sampleCount);
The buffer is filled by

Code: Select all

status =ps4000GetStreamingLatestValues(
unit->handle,CallBackStreaming, NULL);
This code works fine for sampling sine-functions with frequencies up to 50kHz. Then the trouble starts. The collected data looks like the sampling frequency is too low. But i have read that the minimum sampleinterval is 75ns in streaming mode, which means i can measure 6MHz in streaming mode. I dont need 6MHz :-). 1MHz would be enough for me but i just can reach 50kHz.

I have also problems with the aggregation-thing. Now my buffer is filled with 2 values for every channel. As I understood the maximum and minimum value in the current sample interval. Is there a way to switch this aggregation off?

The second problem is this oversampling-thing. What is this for? Why do i have to put oversampling AND samplinginterval to 1 in ps4000RunStreaming to get the fastest sampling rate?

The third problem is, when I use PS4000_NS as timescale instead of PS4000_US the program crashes. Even if I put sampleInterval to 100 or even 1000.

Thanks for any advises
Sven

jkahrs
Newbie
Posts: 0
Joined: Fri Dec 31, 2010 2:04 pm

Re: Streaming mode ps4000

Post by jkahrs »

I had similar problems with PS2205 and most of the problems could be solved by studying the manuals thoroughly. In your case this should be pages 10 to 17:

http://www.picotech.com/document/pdf/ps4000pg-en-5.pdf

The time in between samples for 6 MHz should be 166 ns and not 75 as suggested by you. Apart from that, they have a 4-page guide on USB data rates that I found very interesting. Unfortunately, I can't find the URL, but the name of the document was PicoScopeUSBStreaming.pdf.

svebert

Re: Streaming mode ps4000

Post by svebert »

ok, i meant sampling a sine with 6MHz. I didnt mean the sampling frequency.
I think i have understood that if I set oversampling to 1 than I need only one buffer per channel and aggregation is off.

But for me the problem is still there, i didnt get these high sampling frequencies.
if i measure a sine with 100kHz frequency with the lowest sampling interval of 1 PS4000_US and oversampling=1 then i just got random points between + and - of the signal amplitude.

In the handbook they say i can go down to 75 PS4000_NS, but i cant :-( The program crashes if i try PS4000_NS as timescale.

Any ideas?

jkahrs
Newbie
Posts: 0
Joined: Fri Dec 31, 2010 2:04 pm

Re: Streaming mode ps4000

Post by jkahrs »

This sounds like you are ignoring the return values when setting the parameters. You seem to try to set 75 ns and ignore that the driver tells you it can't do that.

Your device is a ps4000 while mine is a ps2205 and still I can sample at a sample rate of 1 MHz with a Netbook CPU. With a faster CPU and your ps4000 much higher sample rates are possible. Follow the manual, don't use aggregation (set it to 1) and be sure to use fast streaming mode.

svebert

Re: Streaming mode ps4000

Post by svebert »

ok, i am down to 500 ns sample Interval, i have no idea what the problem was, but now i am working with matlab and in the beginning i was working with C, however.
What do you mean with FAST streaming mode?
There are only two API-functions:
ps4000RunStreamingEx
ps4000RunStreaming

How can I use FAST streaming mode?

jkahrs
Newbie
Posts: 0
Joined: Fri Dec 31, 2010 2:04 pm

Re: Streaming mode ps4000

Post by jkahrs »

Good argument. The PS4000 doc mentioned above (section 4.6) lists three sampling modes: block, rapid block and streaming. What I had in mind when I mentioned fast streaming mode is something that doesn't exist on the PS4000 devices, but only on the PS2000 device that I use. So you are right, there is no such thing as FAST streaming mode on the PS4000 devices.

Section 4.6.4 clearly says that you can decrease sample interval to 75 ns (this is also not possible on my PS2000 device). Section 4.6.4.1 goes into detail about how to implement streaming mode.

Post Reply