Buffer overruns in fast streaming mode

Post your C and C++ discussions here
Post Reply
maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Buffer overruns in fast streaming mode

Post by maximus-ms »

I use BCB 6, PicoScope 2205.
In my work I need 1MS/s sample ratio. So I use fast streaming mode.
I use next code:

ps2000_run_streaming_ns(handle_ps, 1, PS2000_US, 1000000 , 0, 1, 100000); // start of sampling
while (run)
{
ps2000_get_streaming_last_values(handle_ps, ps2000FastStreamingReady);
Sleep(32); // 32ms dellay
}
My callback function runs in different thread. The callback functions gets close to 32000-samples bufer from driver every time. It just check every sample if it less -32767(Indicates a buffer overrun in fast streaming mode) and copy driver's bufer. It takes less then 1ms. When PicosCope run it takes until 50% of CPU time.

In result about some 10's of thousands samples is less then -32767 (losted samples) for 10 seconds.

How to fix the problem?

Hitesh

Re: Buffer overruns in fast streaming mode

Post by Hitesh »

Hi maximus-ms,

Have you tried reducing the sleep time?

Try calling the ps2000_overview_buffer_status() function after every call to ps2000_get_streaming_last_values() and see if it returns a non-zero value - this will indicate a buffer overrun.

What version of the ps2000.dll are you using?

Regards,

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

Re: Buffer overruns in fast streaming mode

Post by jkahrs »

maximus-ms wrote: When PicosCope run it takes until 50% of CPU time.
The high CPU usage of the PS2000 driver seems to be the real reason why it is so hard to acquire data continuously with a PS2000 scope.
maximus-ms wrote: In result about some 10's of thousands samples is less then -32767 (losted samples) for 10 seconds.

How to fix the problem?
Having done much testing with a PS2005, I use a delay of 1 millisecond between calls to the driver (not 32 as you do). This seems to be important. This way I can acquire data continuously with a sample rate of 5 MHz.

maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Re: Buffer overruns in fast streaming mode

Post by maximus-ms »

Thanks everybody.
Have you tried reducing the sleep time?
Of course. Firstly I used 1-10 ms delay, but later I saw size of bufer which I get from DLL is 32512 samples, so it are some empty calls before buffer reach 32512 size. So I desided use 32-33ms delay.
Try calling the ps2000_overview_buffer_status() function after every call to ps2000_get_streaming_last_values() and see if it returns a non-zero value - this will indicate a buffer overrun.
I tried. The function doesn't work correct or I cann't use it.

Code: Select all

short previous_buffer_overrun = 0; 
ps2000_overview_buffer_status ( handle_ps, &previous_buffer_overrun);
The function doesn't change variable "previous_buffer_overrun".
What version of the ps2000.dll are you using?
DLL version 2.0.8.105
maximus-ms wrote:
When PicosCope run it takes until 50% of CPU time.

The high CPU usage of the PS2000 driver seems to be the real reason why it is so hard to acquire data continuously with a PS2000 scope.
The PicoScope6 (software) uses 35-40% of CPU time... hm...

Does it metter: I use Windows 7x64 ?

Hitesh

Re: Buffer overruns in fast streaming mode

Post by Hitesh »

Hi maximus-ms,

Our dlls are 32-bit but will work on 64-bit operating systems providing the application has been compiled as a 32-bit application.

Was your device supplied with a blue or white USB cable?

Regards,

maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Re: Buffer overruns in fast streaming mode

Post by maximus-ms »

Hitesh wrote: Was your device supplied with a blue or white USB cable?
The device supplied with a blue USB cable. What does it mean?

Hitesh

Re: Buffer overruns in fast streaming mode

Post by Hitesh »

Pico Products used to be shipped with a white USB cable but the blue ones are more suited for the current draw required.

I thought perhaps if it was a white cable, it might impact on data transfer.

I did a quick test yesterday and found some data was missing but not to the extent of your application.

Please download SDK R10.4.3.1 from our website (http://www.picotech.com/software.html) and try the dll that is in there.

Thanks,

maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Re: Buffer overruns in fast streaming mode

Post by maximus-ms »

Thank you very much.
I will try the SDK on Monday.

maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Re: Buffer overruns in fast streaming mode

Post by maximus-ms »

Hitesh wrote: Please download SDK R10.4.3.1 from our website (http://www.picotech.com/software.html) and try the dll that is in there.
So... it is no reason!! I have same results.

maximus-ms
Newbie
Posts: 0
Joined: Fri Dec 07, 2012 9:09 am

Re: Buffer overruns in fast streaming mode

Post by maximus-ms »

Dear, Hitesh.
Send me the working project in Buildr C++, please!

Hitesh

Re: Buffer overruns in fast streaming mode

Post by Hitesh »

Hi,

I have a Visual Studio 2008 Express example in C if that will help.

Regards,

Post Reply