Problem with streaming data on Picoscope 2206B

Post discussions on applications you are writing
Post Reply
Brynog
Newbie
Posts: 0
Joined: Tue Nov 30, 2021 7:57 am

Problem with streaming data on Picoscope 2206B

Post by Brynog »

Hey

I wrote a streaming application for an application using the Picoscope 2206B. Its based off of the code from ps2000aStreamingExample.py.

But I have a behavior that is a bit troubling and am curious if others have encountered it and/or have come up with ways to get around it.

So following the example streaming code, I created 10 buffers of 500 that feed into a large buffer of 5000.

My expectation was that the system would use my defined callback (again similar to the one in "ps200aStreamingExample.py" code), and that it would periodically call the callback with a 500-element buffer ready to be loaded into the large buffer.

And that is what happens, at first. The system works as expected, 10 calls of the callback delivers 5000 elements to the large buffer. So far so good.

But, running continuously, after approximately 10 iterations of the big buffer being loaded and processed (~50000 samples) the behavior changes. Suddenly the callback begins returning with smaller number of samples. It takes 20 callbacks to get 5000 samples. Also, these callbacks seem to be split into sets of two, notice in the prints below that every two passes through the callback add up to 500 samples.

I put a print in the callback to show how many samples were being handled, and got this back for filling up a single 5000 element buffer. Notice how every 2 callbacks add up to 500:
Num Samples 140
Num Samples 360
Num Samples 139
Num Samples 361
Num Samples 138
Num Samples 362
Num Samples 137
Num Samples 363
Num Samples 136
Num Samples 364
Num Samples 135
Num Samples 365
Num Samples 134
Num Samples 366
Num Samples 133
Num Samples 367
Num Samples 132
Num Samples 368
Num Samples 131
Num Samples 369

Is there a way to keep this from happening? Is my external module code calling GetStreamingLatestValues too quickly/too slowly? Can I monitor this somehow? How can I optimize the callback so I'm doing ~10 calls instead of ~20 calls to fill up the buffer?

Post Reply