GetValuesOverlapped doesn't deliver all requested samples

Post your C and C++ discussions here
Post Reply
bloer
Newbie
Posts: 0
Joined: Thu Jul 26, 2018 8:46 pm

GetValuesOverlapped doesn't deliver all requested samples

Post by bloer » Thu Jul 26, 2018 8:56 pm

I have a picoscope 5444B, and I'm trying to read it out with the ps5000a linux API.

If in my readout loop, I do:

Code: Select all

while(keeprunning){
    ps5000aRunBlock(...);
    wait_for_callback();
    ps5000aGetValues(...);
}
Then I always get total samples equal to the requested number. However, if I try to use GetValuesOverlapped instead:

Code: Select all

ps5000aGetValuesOverlapped(...);
while(keeprunning){
    ps5000aRunBlock(...);
    wait_for_callback();
}
Then in almost all cases I get 40 fewer samples than I requested. If my sample dt is 4 or 8, or I have requested fewer than 40 samples, I get the full request back. Otherwise, regardless of the combination of timebase and number of requested pre- and post-trigger samples, I always get back 40 fewer samples than I asked for.

Am I not using this function correctly, or is there something else going on here?

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

Re: GetValuesOverlapped doesn't deliver all requested sample

Post by Martyn » Mon Jul 30, 2018 8:45 am

Please can you email your code to support@picotech.com so that we can take a look in detail at how everything is set up.
Martyn
Technical Support Manager

bloer
Newbie
Posts: 0
Joined: Thu Jul 26, 2018 8:46 pm

Re: GetValuesOverlapped doesn't deliver all requested sample

Post by bloer » Fri Aug 17, 2018 6:26 pm

My working version had too many dependencies to send easily. Attached is a minimal example demonstrating the issue. It needs c++11 to compile.

Results when I run with my 5444B:

Code: Select all

Resolution	Timebase	Dtns	Requested	Received(reg)	Received(overlapped)
0	2	4	10000	10000	10000
0	3	8	10000	10000	10000
0	4	16	10000	10000	10000
0	5	24	10000	10000	10000
0	6	32	10000	10000	10000
0	7	40	10000	10000	10000
0	8	48	10000	10000	10000
0	9	56	10000	10000	10000
0	10	64	10000	10000	10000
0	11	72	10000	10000	10000
0	12	80	10000	10000	10000
0	13	88	10000	10000	10000
0	14	96	10000	10000	10000
0	15	104	10000	10000	10000
0	16	112	10000	10000	10000
0	17	120	10000	10000	10000
0	18	128	10000	10000	10000
0	19	136	10000	10000	10000
1	3	8	10000	10000	9960
1	4	16	10000	10000	9960
1	5	32	10000	10000	9960
1	6	48	10000	10000	9960
1	7	64	10000	10000	9960
1	8	80	10000	10000	9960
1	9	96	10000	10000	9960
1	10	112	10000	10000	9960
1	11	128	10000	10000	9960
1	12	144	10000	10000	9960
1	13	160	10000	10000	9960
1	14	176	10000	10000	9960
1	15	192	10000	10000	9960
1	16	208	10000	10000	9960
1	17	224	10000	10000	9960
1	18	240	10000	10000	9960
1	19	256	10000	10000	9960
2	3	8	10000	10000	9960
2	4	16	10000	10000	9960
2	5	24	10000	10000	9960
2	6	32	10000	10000	9960
2	7	40	10000	10000	9960
2	8	48	10000	10000	9960
2	9	56	10000	10000	9960
2	10	64	10000	10000	9960
2	11	72	10000	10000	9960
2	12	80	10000	10000	9960
2	13	88	10000	10000	9960
2	14	96	10000	10000	9960
2	15	104	10000	10000	9960
2	16	112	10000	10000	9960
2	17	120	10000	10000	9960
2	18	128	10000	10000	9960
2	19	136	10000	10000	9960
It appears the problem happens when using anything other than 8 bit resolution. (In my framework, the resolution is automatically set to maximum based on the number of channels and requested dt, hence whenever I put in a dt > 8 ns with 4 channels enabled it automatically switched to higher resolution and I encountered the problem).
Attachments
basictest.C
(3.03 KiB) Downloaded 43 times

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

Re: GetValuesOverlapped doesn't deliver all requested sample

Post by Martyn » Tue Aug 21, 2018 8:01 am

I haven't had a chance to compile and run your code, but by inspection you will probably need to be calling ps5000aStop at the end of each loop.
Martyn
Technical Support Manager

Post Reply