by jokkebk » Tue May 15, 2012 5:58 pm
Hello,
I am still very much confused how the ps2000_get_streaming_last_values(), the user-provided callback, overview buffers and fast streaming interact. This would definitely need a more thorough treatment in the programmers manual.
For example, let's say I want to stream 1 gigabyte of data at 2MS/s. I can stop the data collection myself so I allocate a 1 GB buffer and use the following to start streaming:
ps2000_run_streaming_ns(handle, 500, PS2000_NS, 1000000, 0, 1, 50000);
(in your PicoScopeUSBStreaming.pdf it is stated that maximum record the driver itself can store is 2 MS, which I assume limits max_samples to 2000000 at most, also, I have assumed aggregation value of 1 means "no aggregation", although this is not explicitly stated at all in the documentation, only that the value should be 1 or more)
Then I loop and repeatedly call ps2000_get_streaming_last_values(), saving recently captured data in the callback function to my 1 GB buffer until it is full, at which point I end the capture process. Everything works nicely. However:
1) You state that "once you have stopped collecting data, you then retrieve the values into specified buffers in your code" - how is that possible if I have ran the capture process for 1 GS, and the driver has supposedly only allocated 1 MS for its own buffer?
2) Shouldn't I be storing the data in the callback instead? I'm currently doing this and it works great.
3) I noticed that the example program ps2000con.c does not do anything to the overview buffers in the callback - is this because the total capture length is actually max_samples, not more (so the driver buffer is enough for all captured data)?
4) What kind of value do you recommend for the overview buffer for maximum throughput? I have noticed that faster than 280 ns capture rates are not possible, but this 3.6 MS/s is somewhat less than 6.6 MS/s maximum rate suggested by PicoScopeUSBStreaming.pdf for the 2-channel 2000 series - do the overview buffer sizes have a role in this, or is it just PC/hardware specific?
Overall, the documentation should have a general explanation how the fast streaming mode works in the driver, this would eliminate a lot of guessing on the user part. For example, it is unclear if the driver is doing the capture in a separate thread, and if overview buffers are just pointers to the big capture buffer of max_samples (or if max_samples is just a counter totally separate from buffer sizes), or if the driver somehow calculates the aggregates into separate overview buffers.
-Joonas
PS. Amazing product! The C API docs just leave some question marks...