fast streaming mode in PS2000 with 5MS/s

Post your Linux discussions here
jkahrs
Newbie
Posts: 0
Joined: Fri Dec 31, 2010 2:04 pm

fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

Hello,

did anyone ever use PS2205 in fast streaming to acquire 5 MS/s continuously ? To me it looks like the Linux drivers have a speed limitation.

I did some more testing and the same problem occurs on Windows XP. Is it possible that my slow CPU (Intel Atom 330, dual core 1.6 GHz) prevents me from using the highest sample rates ?

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Chris »

At that sort of rate you'd be better using block mode to do your captures, but then there would be a gap between captures, which may take upto 50ms.

If you do need a continuous data stream, then you should limit your capture rate to 1MS/s

-Chris.

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

Re: fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

Block mode is not an option for me. I want to implement an SDR (software defined radio), that's why I need a continuous stream.

1 MS/s is indeed the maximum rate that I found by trial&error to work continuously. After these experiments I am considering to buy a new PC with at least 3 GHz clock rate.

In spite of these disappointments I have to say that the PS2205 is a remarkably good product. With the PicoScope application it was fun to explore the data that I received on my antenna.

For the future I would like to make the following suggestions:
- USB 3 is coming; you can't avoid the need for higher continuous data rates
- the bottleneck currently seems to be the CPU, not the bus; so re-write your drivers to use multithreading and exploit multi-core CPUs
- use OpenCL or CUDA; amazing new applications become possible this way

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

Re: fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

I have completed the first version of my AM radio receiver now. Here is an example of what I received last night:

http://www.vr-web.de/~Juergen.Kahrs/sam ... 00Hz_1.mp3

The signal quality is so poor because I sample the antenna at 1 MHz, which is way too low for serious work. When I look at CPU load, I see that the PS2205 USB driver eats up one CPU core completely and sometime crashes because of the heavy load. On the other CPU core, my radio receiver application absorbs only a fraction of the CPU core. I wonder what's going on in the USB driver. Notice: I am doing signal processing on each and every sample that I get and my CPU load is lower than the USB driver, although the USB driver should do nothing more than hand over the samples.

Apart from the heavy CPU load, I have observed that the USB driver of the PS2205 often crashes under heavy load. Even it it doesn't crash, closing the device after heavy load leads to an access violation inside the USB driver. Please fix that.

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Chris »

Can you replicate this problem using an equivalent sampling rate in PicoScope 6?

-Chris

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

Re: fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

Hello Chris, yes I can reproduce the problem on Windows XP with PicoScope 6. At a comparable sample rate PicoScope absorbs almost as much CPU cycles as my application.

Notice that I never use the function ps200_stop(), except for the termination of my application. When I began writing my application, I used the PS2000con.c application as a starting point. Since the moment I removed ps2000_stop() from the main acquisition loop; the application absorbed much more CPU than previously.

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Chris »

The driver will pull the data from the Scope as fast as it can, so the CPU may show heavy usage.

This level of CPU usage would be reduced if you were able to use block mode, but you have previously mentioned that's not an option.

ps2000_stop() is used after streaming has stopped.

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

Re: fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

I just re-read your USB streaming guide and there was something I overlooked when I first read the PDF file. I understood that 30 MB/s is the maximum reliable data rate over a USB connector. Is it true that the PS4000 series delivers data at that rate, giving me about 15 MS/s continuously ?

Chris
Site Admin
Site Admin
Posts: 169
Joined: Tue Aug 17, 2010 9:00 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Chris »

You will only get about 10MS/s, with 1 channel enabled, and that is provided the PC is not doing much else.

cajordan
Newbie
Posts: 0
Joined: Wed Mar 20, 2013 1:22 pm

Re: fast streaming mode in PS2000 with 5MS/s

Post by cajordan »

I am trying see how fast I can stream data from a 2203.
The previous post suggests that I should be able to get around 10MS/s with a single channel active, but I find that if I make the sample time shorter than 150ns, ps2000_run_streaming_ns returns a 0 - FAIL.

My code snippet is (leaving out the error checking code on each call)

Code: Select all

 
  //select channel ranges and AC/DC coupling
  // channel 0 active, AC coupled, +/- 1V 
  istat =  ps2000_set_channel ( ch, PS2000_CHANNEL_A, 
                                TRUE, FALSE, PS2000_1V);
  istat =  ps2000_set_channel ( ch, PS2000_CHANNEL_B, 
                                FALSE, FALSE, PS2000_1V);
  // set trigger - none  
  istat = ps2000_set_trigger(ch, PS2000_NONE,0,PS2000_RISING,
                             0,0);
  istat = ps2000_run_streaming_ns( ch,150,PS2000_NS,500000,0,1,1000000);
  
  if (istat == 0) {
    fprintf(stderr,"%d error setting fast streaming\n",istat);
    exit(99);
  }

  while (TRUE) {
    ps2000_get_streaming_last_values (ch, (GetOverviewBuffersMaxMin)ps2000FastStreamingReady);
    if (nPreviousValues != totalSamples)      {
        printf ("Values collected: %ld\n", totalSamples - nPreviousValues);
        nPreviousValues = 	totalSamples;
      }
    Sleep (20);
  }

With values of >= 150 my code runs.
Anything less, fails at the ps2000_run_streaming_ns call.

Any ideas what's wrong? Should I be using different function(s)?

I've left the complete code of a small test program at https://www.dropbox.com/s/orelv7ec18c1fi2/testPS.c

TIA
Chris

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

Re: fast streaming mode in PS2000 with 5MS/s

Post by jkahrs »

If I remember correctly, this (150 ns to be the shortest possible time between samples, as allowed by the API) is exactly what I found when I worked with the PS2205 some years ago. I usually worked with 5 MS/s (200 ns between samples) because this was the best stable solution. Any sample rate above 5MS/s was unstable because of the busy-waiting behaviour implemented in the driver and its API.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Martyn »

The 10MS/s was referencing a 4000 device.

150ns or 6.66MS/s is the maximum streaming rate for the older 2000 series devices.
Martyn
Technical Support Manager

cajordan
Newbie
Posts: 0
Joined: Wed Mar 20, 2013 1:22 pm

Re: fast streaming mode in PS2000 with 5MS/s

Post by cajordan »

Thanks,
If the 4000 series will do 10MS/s (single channel) I'll think about looking at those.
Meanwhile, I'll try testing block mode and see what the stop/start overheads are.

Chris

ps looking through the specs it seems that the 2206A will do 9.6 streaming... which will be enough (I need > 8 for the work I'm doing)

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: fast streaming mode in PS2000 with 5MS/s

Post by Martyn »

If you have a particular requirement in mind then please contact support@picotech.com and we can discuss suitable products. We have devices that can stream much faster than 10MS/s using the SDK.
Martyn
Technical Support Manager

cajordan
Newbie
Posts: 0
Joined: Wed Mar 20, 2013 1:22 pm

Re: fast streaming mode in PS2000 with 5MS/s

Post by cajordan »

We have now bought a 2206A but unforunately it seems unsupported for linux although the download page supplies the same SDK package for the 2206A as for our 2203, and I have downloaded the libps2000a drivers as described in the instructions.

It is not recognised by the PS2000con program supplied in the SDK (when built against the ps2000.lib) - this works fine wth the 2203
...and it will not build against lib2000a

errors are;
undefined reference to `ps2000_open_unit' (and all other ps2000 functions)

so I tried editing the call to ps2000a_open_unit etc
and got undefined reference to `ps2000a_open_unit
(the library is found but does not seem to contain these routines)

The documentation seems to only go up to the 2205 models, which is worrying, have I made an expense mistake in buying this device?

Your assistance urgently required.

Chris Jordan

Post Reply