2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post any questions you may have about our current range of oscilloscopes
Post Reply
nellisa
Newbie
Posts: 0
Joined: Tue Dec 18, 2018 1:33 pm

2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by nellisa »

Hi,

today i got my new PicoSope 2204A and wanted to use it with Python. I followed the installation introduction at https://github.com/picotech/picosdk-python-wrappers and tried the first example for the 2000a series: https://github.com/picotech/picosdk-pyt ... Example.py

I get this Error:

Code: Select all

  File "", line 1, in 
    runfile('C:/Users/nellisa/Documents/PythonProgramme/Schallkeulenmessplatz-Steuerung/test.py', wdir='C:/Users/nellisa/Documents/PythonProgramme/Schallkeulenmessplatz-Steuerung')

  File "C:\ProgramData\Anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 668, in runfile
    execfile(filename, namespace)

  File "C:\ProgramData\Anaconda3\Lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 108, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)

  File "C:/Users/nellisa/Documents/PythonProgramme/Schallkeulenmessplatz-Steuerung/test.py", line 21, in 
    assert_pico_ok(status["openunit"])

  File "C:\ProgramData\Anaconda3\Lib\site-packages\picosdk\functions.py", line 150, in assert_pico_ok
    raise PicoSDKCtypesError("PicoSDK returned '{}'".format(PICO_STATUS_LOOKUP[status]))

PicoSDKCtypesError: PicoSDK returned 'PICO_NOT_FOUND'
When i use the PicoScope 6 Sofware its working fine.
Also when i use the SDK.discover:

Code: Select all

from picosdk.discover import find_all_units

scopes = find_all_units()

for scope in scopes:
    print(scope.info)
    scope.close()
I get an answer: UnitInfo(driver=, variant=b'2204A', serial=b'GO029/706')

Shoudn´t be the driver ps2000a.ps2000alib? Or is this right?

So obviously the system can find it?! Why not in the example code?

Thanks for Help!

Andi

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

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by Martyn »

The 2204a needs the 2000 libraries not the 2000a ones.

Although confusing it is because the 2204a is just a 2204 in the smaller 2000a series case, so still needs older drivers and libraries.
Martyn
Technical Support Manager

nellisa
Newbie
Posts: 0
Joined: Tue Dec 18, 2018 1:33 pm

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by nellisa »

Ok, i also tried the example for the 2000 series(did you mean this with, older driver?):
https://github.com/picotech/picosdk-pyt ... Example.py, but this one is also not working.
Its rising the Error :

Code: Select all

  File "C:/Users/nellisa/Documents/PythonProgramme/Schallkeulenmessplatz-Steuerung/test.py", line 76, in 
    assert_pico2000_ok(status["getTimebase"])

  File "C:\ProgramData\Anaconda3\Lib\site-packages\picosdk\functions.py", line 151, in assert_pico2000_ok
    raise PicoSDKCtypesError("Unsuccessful API call")

PicoSDKCtypesError: Unsuccessful API call
For timebase i tried different numbers, but still the same error.

Do i need to install an older python libary or SDK version?

What im doing wrong?!

Andi

nellisa
Newbie
Posts: 0
Joined: Tue Dec 18, 2018 1:33 pm

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by nellisa »

hi again,

nobody an idea?

Andi

NeilH
PICO STAFF
PICO STAFF
Posts: 266
Joined: Tue Jul 18, 2017 8:28 am

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by NeilH »

Hi Andi

Can I check whether you are using the example code from the picoscope-python-wrappers repo when you got this error appear? If not would you be able to post the code you were using here or email it into support@picotech.com

Neil
Neil
Technical Support Engineer

nellisa
Newbie
Posts: 0
Joined: Tue Dec 18, 2018 1:33 pm

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by nellisa »

Hi Neil,

I just downloaded the ps2000BlockExample.py script from git: https://github.com/picotech/picosdk-pyt ... Example.py

and started it. I didn´t change the code. I also tried an other PC, but still the same error.

Is picoscope-python-wrappers repo something different to my github-link?

To be sure the code from the script i especially used is here:

Code: Select all

#
# Copyright (C) 2018 Pico Technology Ltd. See LICENSE file for terms.
#
# PS2000 BLOCK MODE EXAMPLE
# This example opens a 2000 driver device, sets up two channels and a trigger then collects a block of data.
# This data is then plotted as mV against time in ns.

import ctypes
import numpy as np
from picosdk.ps2000 import ps2000 as ps
import matplotlib.pyplot as plt
from picosdk.functions import adc2mV, assert_pico2000_ok

# Create status ready for use
status = {}

# Open 2000 series PicoScope
# Returns handle to chandle for use in future API functions
status["openUnit"] = ps.ps2000_open_unit()
assert_pico2000_ok(status["openUnit"])

# Create chandle for use
chandle = ctypes.c_int16(status["openUnit"])

# Set up channel A
# handle = chandle
# channel = PS2000_CHANNEL_A = 0
# enabled = 1
# coupling type = PS2000_DC = 1
# range = PS2000_2V = 7
# analogue offset = 0 V
chARange = 7
status["setChA"] = ps.ps2000_set_channel(chandle, 0, 1, 1, chARange)
assert_pico2000_ok(status["setChA"])

# Set up channel B
# handle = chandle
# channel = PS2000_CHANNEL_B = 1
# enabled = 1
# coupling type = PS2000_DC = 1
# range = PS2000_2V = 7
# analogue offset = 0 V
chBRange = 7
status["setChB"] = ps.ps2000_set_channel(chandle, 1, 1, 1, chBRange)
assert_pico2000_ok(status["setChB"])

# Set up single trigger
# handle = chandle
# source = PS2000_CHANNEL_A = 0
# threshold = 1024 ADC counts
# direction = PS2000_RISING = 2
# delay = 0 s
# auto Trigger = 1000 ms
status["trigger"] = ps.ps2000_set_trigger(chandle, 0, 64, 2, 0, 1000)
assert_pico2000_ok(status["trigger"])

# Set number of pre and post trigger samples to be collected
preTriggerSamples = 2500
postTriggerSamples = 2500
maxSamples = preTriggerSamples + postTriggerSamples

# Get timebase information
# handle = chandle
# timebase = 8 = timebase
# no_of_samples = maxSamples
# pointer to time_interval = ctypes.byref(timeInterval)
# pointer to time_units = ctypes.byref(timeUnits)
# oversample = 1 = oversample
# pointer to max_samples = ctypes.byref(maxSamplesReturn)
timebase = 8
timeInterval = ctypes.c_int32()
timeUnits = ctypes.c_int32()
oversample = ctypes.c_int16(1)
maxSamplesReturn = ctypes.c_int32()
status["getTimebase"] = ps.ps2000_get_timebase(chandle, timebase, maxSamples, ctypes.byref(timeInterval), ctypes.byref(timeUnits), oversample, ctypes.byref(maxSamplesReturn))
assert_pico2000_ok(status["getTimebase"])

# Run block capture
# handle = chandle
# no_of_samples = maxSamples
# timebase = timebase
# oversample = oversample
# pointer to time_indisposed_ms = ctypes.byref(timeIndisposedms)
timeIndisposedms = ctypes.c_int32()
status["runBlock"] = ps.ps2000_run_block(chandle, maxSamples, timebase, oversample, ctypes.byref(timeIndisposedms))
assert_pico2000_ok(status["runBlock"])

# Check for data collection to finish using ps5000aIsReady
ready = ctypes.c_int16(0)
check = ctypes.c_int16(0)
while ready.value == check.value:
    status["isReady"] = ps.ps2000_ready(chandle)
    ready = ctypes.c_int16(status["isReady"])

# Create buffers ready for data
bufferA = (ctypes.c_int16 * maxSamples)()
bufferB = (ctypes.c_int16 * maxSamples)()

# Get data from scope
# handle = chandle
# pointer to buffer_a = ctypes.byref(bufferA)
# pointer to buffer_b = ctypes.byref(bufferB)
# poiner to overflow = ctypes.byref(oversample)
# no_of_values = cmaxSamples
cmaxSamples = ctypes.c_int32(maxSamples)
status["getValues"] = ps.ps2000_get_values(chandle, ctypes.byref(bufferA), ctypes.byref(bufferB), None, None, ctypes.byref(oversample), cmaxSamples)
assert_pico2000_ok(status["getValues"])

# find maximum ADC count value
maxADC = ctypes.c_int16(32767)

# convert ADC counts data to mV
adc2mVChA =  adc2mV(bufferA, chARange, maxADC)
adc2mVChB =  adc2mV(bufferB, chBRange, maxADC)

# Create time data
time = np.linspace(0, (cmaxSamples.value) * timeInterval.value, cmaxSamples.value)

# plot data from channel A and B
plt.plot(time, adc2mVChA[:])
plt.plot(time, adc2mVChB[:])
plt.xlabel('Time (ns)')
plt.ylabel('Voltage (mV)')
plt.show()

# Stop the scope
# handle = chandle
status["stop"] = ps.ps2000_stop(chandle)
assert_pico2000_ok(status["stop"])

# Close unitDisconnect the scope
# handle = chandle
status["close"] = ps.ps2000_close_unit(chandle)
assert_pico2000_ok(status["close"])

# display status returns
print(status)
Thanks!

Andi

NeilH
PICO STAFF
PICO STAFF
Posts: 266
Joined: Tue Jul 18, 2017 8:28 am

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by NeilH »

Hi Andi

Did you download the entire repository or just that script?
Neil
Technical Support Engineer

nellisa
Newbie
Posts: 0
Joined: Tue Dec 18, 2018 1:33 pm

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by nellisa »

Hi,

i downloaded the entire repository and followed the readme for installation.
Additional Information:
Comand conda list in Anaconda Prompt shows
packages in environment at C:\ProgramData\Anaconda3:
# Name Version Build Channel
...
pickleshare 0.7.4 py37_0
PicoSDK 1.0
pillow 5.2.0 py37h08bbbbd_0
...

antoine_riaud
Newbie
Posts: 0
Joined: Mon Apr 29, 2019 1:24 am

Re: 2204A Python Spyder PicoSDK returned 'PICO_NOT_FOUND'

Post by antoine_riaud »

Hi,

I have exactly the same problem. Everything goes fine on the (unmodified) ps2000.py script until we try to get the timebase (line 75). I used anaconda (python 3.7) on windows 64bit and the development picosdk for the pico5000 (picosdk 106.13.58).

However, setting:
maxSamples = 3968 #preTriggerSamples + postTriggerSamples
or to a lower value works. It seems the scope does not have enough memory (max 8 kS for this model, so if the two channels are recording we are getting quite close)

hope this helps

Post Reply