Incorrect parameter type for ps2000aRunBlock segmentIndex

Post your Linux discussions here
Post Reply
element
Newbie
Posts: 0
Joined: Sat Jan 31, 2015 9:13 pm

Incorrect parameter type for ps2000aRunBlock segmentIndex

Post by element » Tue Aug 22, 2017 12:49 am

I think I may have discovered an issue with the ps2000aRunBlock() API function and the segmentIndex parameter. I've been utilizing the pico-python project which provides a Python interface to the PicoScope C API. The wrapper function which calls ps2000aRunBlock was failing with PICO_SEGMENT_OUT_OF_RANGE. Changes I made to the Python code was inexplicably causing things to work. After doing some debugging and comparing working cases to non-working cases I found that the segmentIndex is the 7th function parameter and therefore is on the stack and padded to 64 bits. For the non-working cases, bits 17-31 would have uninitialized data in them, which seems to be utilized by this function for the segmentIndex, although it is documented as being an unsigned short in the programmers guide. I think either the documentation needs to be changed or the function definition changed.

More details on this issue can be found here:
https://github.com/colinoflynn/pico-python/issues/85

Hitesh
Site Admin
Site Admin
Posts: 2845
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Incorrect parameter type for ps2000aRunBlock segmentInde

Post by Hitesh » Tue Aug 22, 2017 7:30 am

Hi element,

Thank you for this.

The Programmer's Guide, although updated, has yet to be published to our website, so I have made our Technical Publications team aware of this. Please use the function definitions from the header file e.g. for ps2000aRunBlock():

Code: Select all

PREF0 PREF1 PICO_STATUS PREF2 PREF3 (ps2000aRunBlock)
	(
		int16_t									handle,
		int32_t									noOfPreTriggerSamples,
		int32_t									noOfPostTriggerSamples,
		uint32_t					timebase,
		int16_t									oversample,
		int32_t								* timeIndisposedMs,
		uint32_t				segmentIndex,
		ps2000aBlockReady			lpReady,
		void								* pParameter
	);
Regards,
Hitesh

Technical Support Engineer

Post Reply