ps4000a+python+streaming mode problem

Post general discussions on using our drivers to write your own software here
Post Reply
hsun7
Newbie
Posts: 0
Joined: Fri Jun 30, 2017 2:25 am

ps4000a+python+streaming mode problem

Post by hsun7 »

Hi,
I modified the python program( see http://ctrlpascal.com/picoscope.htm) for streaming mode. But severals problems exist. One is that the autostop sometimes work, somtimes not. Another problem is that the signal collection is not strictly continuous (see the picture, source is a sine function). Attachment is the python code (python 3).
signal.jpg
Attachments
ps4000aStreaming.py
(5.8 KiB) Downloaded 558 times

Hitesh

Re: ps4000a+python+streaming mode problem

Post by Hitesh »

Hi hsun7,

Which version of the ps4000a.dll are you using?

In your code, are you copying the data from the driver buffers to a temporary application buffer in the streaming callback?

Have you tried the Python application from our GitHub repository?

Regards,

hsun7
Newbie
Posts: 0
Joined: Fri Jun 30, 2017 2:25 am

Re: ps4000a+python+streaming mode problem

Post by hsun7 »

Hitesh wrote:Hi hsun7,

Which version of the ps4000a.dll are you using?

In your code, are you copying the data from the driver buffers to a temporary application buffer in the streaming callback?

Have you tried the Python application from our GitHub repository?

Regards,
Hi Hitesh,
Thanks for your reply! I'm not sure the version of ps4000a.dll. I just installed a pico SDK. In my code, I copy the data from buffer to a list after each callback in the application level. I downloaded the Python application you suggested and I'm still working on it. It seems a little difficult for me.
Thanks,
Hongbin

Hitesh

Re: ps4000a+python+streaming mode problem

Post by Hitesh »

Hi Hongbin,

Please try the ps4000a.dll and picoipp.dll files from the latest PicoScope 6 release. These are 32-bit dlls.

Alternatively, please e-mail support@picotech.com and we can provide you with a set of 64-bit drivers if you are using a 64-bit Python environment.

Regards,

apos
Newbie
Posts: 0
Joined: Thu Jul 06, 2017 8:23 am

Re: ps4000a+python+streaming mode problem

Post by apos »

Hi,

this period I am also trying streaming mode with a PicoScope 4424 and experience troubles. I adopted the code provided by hsun7 for use on a 4424 and tried it with Python 3.5.2

I use ps4000.dll version 1.2.4.41 (dated: 8/6/2015). This is the dll that works correctly, since when using the newer version 1.5.0.6 (8/2/2017), function ps4000OpenUnit() fails when opening the device. (It returns "-1").

Anyway, I don't get the plot: after executing the callback the program jumps to the "finally" section, performs the CloseUnit() functionality and exits with a ValueError, as shown below:

Code: Select all

Traceback (most recent call last):
  File "F:\Picoscope\ctrlpascal_2\ps4000_Streaming_2.py", line 172, in 
    data1 = DoStreaming()
  File "F:\Picoscope\ctrlpascal_2\ps4000_Streaming_2.py", line 123, in DoStreaming
    status = DLL.ps4000GetStreamingLatestValues(handle, call_back, None)
ValueError: Procedure probably called with not enough arguments (20885764 bytes missing)
The callback indicates having acquired 9981 samples, but it seems that it cannot return properly.
Any ideas?

Thank you!

Hitesh

Re: ps4000a+python+streaming mode problem

Post by Hitesh »

Hi apos,

Have you tried our Python application from the GitHub repository?

Is the picoipp.dll with the ps4000.dll (presumanbly taken from the PicoScope 6 installation directory?) and have you tried the dlls from the PicoScope 6.12.9 release?

Regards,

apos
Newbie
Posts: 0
Joined: Thu Jul 06, 2017 8:23 am

Re: ps4000a+python+streaming mode problem

Post by apos »

Hi Hitesh,
I tried with the ps4000.dll from the latest picoscope version. This is v1.5.0.8 and still has the same issue: it returns -1 upon executing ps4000OpenUnit()
To ensure that I have control over the dlls used, I explicitly open them on my application:

Code: Select all

os.chdir("F:\\Picoscope\\ctrlpascal\\")
DLL = ctypes.WinDLL("ps4000_v1508.dll")
The only dll that opens the picoscope is version 1.2.4.41. Below are the details of the picoscope device, as returned when I run the C console example application

Code: Select all

Opening the device...
Handle: 16384
Device opened successfully, cycle 1

Driver Version: 1.2.4.41
USB Version: 2.0
Hardware Version: 1
Variant Info: 4424
Serial: ZMR94/293
Cal Date: 18Dec09
Kernel: 1.0
Thank you

Hitesh

Re: ps4000a+python+streaming mode problem

Post by Hitesh »

Hi apos,

We have just released a new PicoSDK version - could you please install the 32-bit/64-bit version as required and then try running the example?

It might be worth copying the ps4000 and picoipp dll files into the same folder as the exe file to ensure that they are being picked up.

Are there any other ps4000 and picoipp dlls on the PC apart from in the PicoScope and PicoSDK installation directories?

Does the PicoScope software detect the device without any issues?

Regards,

apos
Newbie
Posts: 0
Joined: Thu Jul 06, 2017 8:23 am

Re: ps4000a+python+streaming mode problem

Post by apos »

Hi Hitesh,

as I was a little bit behind schedule I resorted to C which worked without any problem. Therefore I will use C and perform some data post-processing in a seperate python application, which may be a better approach for my application after all.

Anyway, as I found some time to experiment, I tried once again with python and the latest SDK (32bit). However the dll files (ps4000, picoipp) included therein are the same to the ones that come with the latest version of the picoscope application that I had already installed. So no luck with these as well.

The code I used is in pastebin, https://pastebin.com/evJHiGXC
It still crashes upon exiting the callback.

Thanks & regards

jbentham
Newbie
Posts: 0
Joined: Thu Sep 21, 2017 9:30 pm

Re: ps4000a+python+streaming mode problem

Post by jbentham »

It is possible to do 1 megasample/sec streaming in pure Python, see https://github.com/jbentham/picostream

Jeremy Bentham

Post Reply