Device often not found - Segmentation fault

Discussion forum for the new Picoscope Mac software
Post Reply
Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Device often not found - Segmentation fault

Post by Anna » Fri Sep 16, 2016 12:12 pm

Hi,

I started to work with a PicoScope 6404B and to write my own DAQ for a photomultiplier.
I use the python API from here https://github.com/colinoflynn/pico-python.

I noticed for both, the standard Mac GUI and the API, that the picoscope is found at start only every ~10th trial.
In addition, if I do not unplug the USB within trials, I get an segmentation fault.

I work on a Mac 10.9.5 and
DriverVersion : PS6000 MacOSX Driver, 1.4.6.13
USBVersion : 2.0
HardwareVersion : 1 1
VariantInfo : 6404B
BatchAndSerial : AU668/014
CalDate : 20Nov12
KernelVersion : 0.0
DigitalHardwareVersion : 1
AnalogueHardwareVersion : 1
PicoFirmwareVersion1 : 1.1.5.0
PicoFirmwareVersion2 : 1.1.30.0

Do you have any idea, why this is caused?

Best,

Anna

Hitesh
PICO STAFF
PICO STAFF
Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Device often not found - Segmentation fault

Post by Hitesh » Mon Sep 19, 2016 11:39 am

Hi Anna,

Which version of the PicoScope 6 for Mac software are you using (click Help -> About PicoScope 6 Beta...)?

On the next occasion where the device is not recognised, please close down the software, then locate the trace.xml file and post it here or e-mail it to support@picotech.com

Does your Mac have USB 2.0 ports or USB 3.0 ports.

Regards,
Hitesh

Software Dev. Engineer

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Fri Oct 21, 2016 1:44 pm

Hi,

The Version is "PicoScope® 6 - PC Oscilloscope software version: 6.11.13.2"
USB Version: 20,0
Hardware Version: 1 1
Driver Version: PS6000 MacOSX Driver, 1.4.6.13
Firmware Version: 1.1.5.0 / 1.1.30.0

The Computer is a MacBook Pro 13'' Mid 2012 with USB 3.0.

The trace is attached. I copied after the last segmentation fault. However, the last-changed-time of this file is from an slightly earlier attempt:


Trace opened 21.10.2016.
Running on Mono - True
Mono Display Name - 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45 Wed Jul 27 16:20:13 EDT 2016)
Host Operating System - MacOSX
64Bit Operating System - False
64Bit Process - False
Logical Processors - 4
Application 'PicoScope 6 Beta' (version 6.11.13.2) starting.
93B885ADFE0DA089CDF634904FD59F71
User is not Guest
No Administrator Privileges
Failed to detect access rights
OS Version - ProductName: Mac OS X ProductVersion: 10.9.5 BuildVersion: 13F1603
.net Version - 4.0.30319.42000
Current Directory - /Applications/PicoScope6.app/Contents/Resources/lib
Command Line - /Applications/PicoScope6.app/Contents/Resources/lib/PicoScope.GTK.exe
Settings file version - 11.2.0
Preferences file version - 2.0.0
Probes file version - 1.0.0
Data file binary header version - 1
Using default culture: English (United States).
Begin
Begin
Complete
Attempting to load ps6000.dll
Finished loading ps6000.dll
Opening device using DLL ps6000.dll
Opening device successful. Error NoError.
Device opened AU668/014: PS6000 PS6404B PS6000
Attempting to load ps6000.dll
Finished loading ps6000.dll
Opening device using DLL ps6000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps6000.dll
Finished loading ps6000.dll
Opening device using DLL ps6000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps5000a.dll
Finished loading ps5000a.dll
Opening device using DLL ps5000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps5000.dll
Finished loading ps5000.dll
Opening device using DLL ps5000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps4000a.dll
Finished loading ps4000a.dll
Opening device using DLL ps4000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps4000a.dll
Finished loading ps4000a.dll
Opening device using DLL ps4000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps4000.dll
Finished loading ps4000.dll
Opening device using DLL ps4000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps3000a.dll
Finished loading ps3000a.dll
Opening device using DLL ps3000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps3000a.dll
Finished loading ps3000a.dll
Opening device using DLL ps3000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps3000a.dll
Finished loading ps3000a.dll
Opening device using DLL ps3000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps3000a.dll
Finished loading ps3000a.dll
Opening device using DLL ps3000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps3000.dll
Finished loading ps3000.dll
Opening device using DLL ps3000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps2000a.dll
Finished loading ps2000a.dll
Opening device using DLL ps2000a.dll
Opening PS2000a.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load ps2000.dll
Finished loading ps2000.dll
Opening device using DLL ps2000.dll
Opening device unsuccessful. Error UnitNotFound
Attempting to load usbdrdaq.dll
Finished loading usbdrdaq.dll
Opening device using DLL usbdrdaq.dll
usbdrdaq.dll OpenUnit returned 3
Opening device unsuccessful. Error UnitNotFound
Attempting to load pl1000.dll
Finished loading pl1000.dll
Opening device using DLL pl1000.dll
Opening device unsuccessful. Error UnitNotFound
No of Devices Found: 1
Device selected: PS6404B, AU668/014
Driver: ps6000.dll Version: PS6000 MacOSX Driver, 1.4.6.13
Kernel driver: picopp.sys Version: PS6000 MacOSX Driver, 1.4.6.13
Complete
Trigger set to : NonAdvancedEdge
Source/Channel Index Changed to 0
Trigger Direction set to Rising
Probe light manager changed light state to True
Trigger set to : NonAdvancedEdge
Trace Closing
closed.

Hitesh
PICO STAFF
PICO STAFF
Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Device often not found - Segmentation fault

Post by Hitesh » Mon Oct 24, 2016 4:26 pm

Hi Anna,

This might be due to the Mono installation.

Try using Mono version 4.0.4.

Where does the segmentation fault appear - in a terminal window?

Regards,
Hitesh

Software Dev. Engineer

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Tue Oct 25, 2016 8:07 am

Hi,

in appears in both, Terminal and when I start your GUI.

Regards,

Anna

Hitesh
PICO STAFF
PICO STAFF
Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Device often not found - Segmentation fault

Post by Hitesh » Tue Oct 25, 2016 8:36 am

Hi Anna,

Could you post a screenshot of the error message in both cases?

Thanks,
Hitesh

Software Dev. Engineer

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Tue Oct 25, 2016 12:23 pm

Hi,

I changed to Mono 4.0.4. I still have to open the GUI or my own application several times until they find the device. In addition I still get segmentation faults. However, both is reduced in number.

I will post the screenshot as soon as I do the next measurement.

Best regards,

Anna

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Wed Nov 02, 2016 3:41 pm

Hi,

here are the Screenshots from the Segm. Fault I get from my terminal application and from your Application.

BTW: I tested the software and my terminal application on Linux Debian and Windows 7.
I get the same problems there (a few starts without recognizing the Picoscope).

Best,

Anna
Attachments
Bildschirmfoto 2016-11-02 um 16.36.44.png
Picoscope
Bildschirmfoto 2016-11-02 um 16.36.28.png
Picoscope 6
Bildschirmfoto 2016-11-02 um 16.36.05.png
Terminal

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Wed Nov 09, 2016 7:20 am

Hi,

it gets better (still not perfect) on Mac when I turn off power for the picoscope, deconnect the USB and execute
$ pkill -9 python
Then I connect everything again and wait for 5 seconds.

Best,

Anna

Hitesh
PICO STAFF
PICO STAFF
Posts: 2855
Joined: Tue May 31, 2011 3:43 pm
Location: St. Neots, Cambridgeshire

Re: Device often not found - Segmentation fault

Post by Hitesh » Wed Nov 09, 2016 10:55 am

Hi Anna,

Does the issue occur on the Windows 7 PC with the PicoScope 6 software is run and before any Python code is executed, or does it only occur with the PicoScope 6 software after a Python session has been run?

If it only occurs when a Python session has been run, the application could have a lock on the driver. It might be useful to see your code - please post it here or e-mail support@picotech.com

Regards,
Hitesh

Software Dev. Engineer

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Mon Nov 14, 2016 9:03 am

Hi,

I answered this to support, but it might be interesting for others too:
The issue doesn’t occur on Windows and I rarely tested on Linux.
Thus, it seems to be a Mac (or python implementation on Mac) problem, since I’m using the exact same program on all computers.
The problem is reduced when I unplug and plug the power of the scope and then do pkill -9 python.
However I still need about 5 attempts to start the scope.

The code to start the scope is the following:

def _lowLevelOpenUnit(self, sn):
c_handle = c_int16()
if sn is not None:
serialNullTermStr = create_string_buffer(sn)
else:
serialNullTermStr = None
# Passing None is the same as passing NULL
trials=5; i=0; m=1
while int(m)!=0: # this loop is necessary since the device is often not found on mac.
m = self.lib.ps6000OpenUnit(byref(c_handle), serialNullTermStr) # at this point the program crashes regularly with segmentation fault
i+=1
if i>=trials: break
if m!=0:
print(i,"No picoscope found. Unplug and plug the power of scope and the usb connector at the computer. Then do pkill -9 python.")
self.checkResult(m)
self.handle = c_handle.value

Before that I initialize dependent on the platform:

def __init__(self, serialNumber=None, connect=True):
""" Load DLLs. """
if platform.system() == 'Linux':
from ctypes import cdll
self.lib = cdll.LoadLibrary("lib" + self.LIBNAME + ".so.2")
elif platform.system()=="Darwin": # obi
from ctypes import cdll
import os
print("If the following fails do:\n$ export DYLD_FALLBACK_LIBRARY_PATH=/Applications/PicoScope6.app/Contents/Resources/lib/\n")
self.lib = cdll.LoadLibrary("lib" + self.LIBNAME + ".dylib")
else:
from ctypes import windll
self.lib = windll.LoadLibrary(self.LIBNAME + ".dll")

super(PS6000, self).__init__(serialNumber, connect)

where super is initialized with

def __init__(self, serialNumber=None, connect=True):
""" Create a picoscope class, and by default also connect to the scope. """
self.CHRange = [5.0] * self.NUM_CHANNELS
self.CHOffset = [0.0] * self.NUM_CHANNELS
self.ProbeAttenuation = [1.0] * self.NUM_CHANNELS
self.handle = None
if connect is True:
self.open(serialNumber) # -> executes _lowLevelOpenUnit

Best,

Anna

Anna
Newbie
Posts: 0
Joined: Fri Sep 16, 2016 8:44 am

Re: Device often not found - Segmentation fault

Post by Anna » Fri Nov 25, 2016 9:20 am

Hi,

I finally upgraded my OS to 10.12 (Sierra) and switched to work with Python3.
This solved the issue of not finding the device and getting a segmentation fault instead.

Thanks for all the help.

Best,

Anna

Post Reply