I'm writing a graphical application for picoscope 2204 so that it can be used on Linux. At the moment I'm using fast streaming with the callback function where you get access to the overviewBuffers datastructure. I want to display the samples from the overviewBuffers "live" graphically in my application.
According to the following code example that was given in another post in the forum, there are 2 buffers for every channel, max and min.
Maybe I'm missing something that is obvious but I'm wondering why there are 2 buffers for each channel?
Also how should I display the samples from these two buffers (as coming from one channel) in my application? In what order are the samples collected in the two buffers and in what order should I read from them?
In fast streaming mode, the PicoScope 2000 driver can use a method called aggregation to reduce the amount of data your application needs to process. This means that for every block of consecutive samples, it stores only the minimum and maximum values. You can set the number of samples in each block, called the aggregation parameter, when you call ps2000_run_streaming_ns() for real-time capture, and when you call ps2000_get_streaming_values() to obtain post-processed data.
You can take the average of the values at each location in the two buffers for use in your application.
After a little experimentation with different parameters I managed to get a reliable and steady data stream and display it in my application. However I'm only able to get a correct and steady stream of samples at very specific settings (with very large buffers).
I get a reliable stream of samples using the following parameters to the ps2000_run_streaming_ns function:
If I change these settings the sample stream becomes unreliable.
Correct me if I'm wrong but It seems that the fast streaming feature in the Linux driver is not of the same quality than in the Windows version? Using the Windows software its possible to do fast streaming with all kinds of sampling rates with reliable results. Will the fast streaming functionality in the Linux driver be improved upon in the near future and do you have any plans of making the driver open source?
Best regards, Emil
I should note that I'm using the overview_buffer callback function.
Here is how I'm reading from the overview_buffers (Channel A) and adding it to the buffer in my application:
for (i = 0; i < n_values; i++) {
max = *(overview_buffers[0]+(i*sizeof(short)));
min = *(overview_buffers[1]+(i*sizeof(short)));
average = (max + min) / 2.0;
enqueue_channel_a(average);
}
For example when I change the sample_interval to 100 us and keep the other settings as in my previous post I get frequent sample values of -32768 (Min value of a short).
5.00
5.00
-32768.00
0.00
0.00
5.00
I guess this means that the buffers have overrun, but increasing the overview_buffer_size does not help as I'm already using very large buffers. When changing the sample_interval to 1 us I get unreliable sample values as shown below (after letting it run for a couple of seconds).
Would it be possible for you to provide your code so that I can look at this in more detail ?
You can post it on here here (please use the code button to format the text so that it appears in a code box) or email it to me at support@picotech.com