I try to use Adalm 1000 with simple python command under Linux ubuntu 18.04
I follow python tutorial:
I try to found the required files :
pysmu.py and libpysmu.so :no more available, not found in :
I follow libsmu installation and building in previous link. No error.
I start simple example found here:
session = Session(ignore_dataflow=True, queue_size=10000)
NameError: name 'Session' is not definedlsusb and dmesg show adalm1000 module
I miss something in libsmu installation. Link? Path? usr??
Thanks for help
I'm not a Linux user. It sounds like you are following the right steps. Maybe one of the libsmu support people who work on the linux side can help.
Everything works fine on Windows (using the libsmu Windows installer) for me.
Did you build and install the libsmu library as documented in the libsmu readme? https://github.com/analogdevicesinc/libsmu/blob/master/README.md
May be my 21 oct answer is not in the right place here. Do you think we can work with this board under Python3 ?
Hi,You need to rebuild libsmu in order to build/link it against Python3.Also, we need to force CMake to check Python3 instead of Python2. The instructions are the following (Please modify them to use your exact paths to the Python3 version you have installed. This example uses 3.6)
sudo apt-get install python3-setuptools python3-pipsudo pip3 install cythoncd libsmumkdir build_py3 && cd build_py3
sudo apt-get install python3-setuptools python3-pip
sudo pip3 install cython
mkdir build_py3 && cd build_py3
cmake -DPYTHON_EXECUTABLE=/usr/bin/python3 -DPYTHON_INCLUDE_DIR=/usr/include/python3.6m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.6m.so ..
makesudo make install
sudo make install
I follow your commands : compilation is ok , no error message. I try on two differents PC with linux : same result , same error message : NameError: name 'Session' is not defined . even with smu -l confirming the adalm1000 board.
Hi,Can you send us a simple example script that you run and get this error, so we can test it?-Alexandra
smu -lADALM1000: serial 2031205051485435313330303530323 : fw 2.16 : hw F
python3 blink_led.pyTraceback (most recent call last): File "blink_led.py", line 41, in <module> session = Session(ignore_dataflow=True, queue_size=10000)NameError: name 'Session' is not defined
Here is the code :
#!/usr/bin/python#For Python version > = 2.7.8from tkinter import *import atexitfrom collections import defaultdictfrom operator import addimport timefrom pysmu import *
# define button actionsdef Digital_out(): global PIO_0, PIO_1, PIO_2, PIO_3 while (True): # Main loop if (RUNstatus.get() == 1): devx.ctrl_transfer(0x40, 0x50, PIO_0, 0, 0, 0, 100) # set to 0 devx.ctrl_transfer(0x40, 0x50, PIO_1, 0, 0, 0, 100) devx.ctrl_transfer(0x40, 0x50, PIO_2, 0, 0, 0, 100) devx.ctrl_transfer(0x40, 0x50, PIO_3, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x51, PIO_0, 0, 0, 0, 100) # set to 1 time.sleep(0.1) devx.ctrl_transfer(0x40, 0x51, PIO_1, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x51, PIO_2, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x51, PIO_3, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x50, PIO_0, 0, 0, 0, 100) # set to 0 time.sleep(0.1) devx.ctrl_transfer(0x40, 0x50, PIO_1, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x50, PIO_2, 0, 0, 0, 100) time.sleep(0.1) devx.ctrl_transfer(0x40, 0x50, PIO_3, 0, 0, 0, 100) # Update tasks and screens by TKinter root.update_idletasks() root.update()
# Setup ADAML1000session = Session(ignore_dataflow=True, queue_size=10000)if not session.devices: print ('no device found') root.destroy() exit()#devx = session.devices# assign digital pinsPIO_0 = 28PIO_1 = 29PIO_2 = 47PIO_3 = 3# setup main window root = Tk()
label = Label(root)label.grid(row=1, columnspan=1, sticky=W)label.config(text = "Blink LEDs")RUNstatus = IntVar(0)rb1 = Radiobutton(root, text="Stop", variable=RUNstatus, value=0 )rb1.grid(row=2, column=0, sticky=W)rb2 = Radiobutton(root, text="Run", variable=RUNstatus, value=1 )rb2.grid(row=2, column=1, sticky=W)
# start main looproot.update()# Start samplingDigital_out()# root.mainloop()
To get that version of the program to run with Python 3.7 two lines need to be edited:
from tkinter import *
Module name changed from 2.7 to 3.7
print('no device found')
Need to add () for print statement
Once these are changed it runs as expected in Python 3.7 ( Windows 10, libsmu master )
I have no idea why your built version of libsmu does not recognize Session function. Are you absolutely sure you have removed any old previous versions of libsmu you might have compiled in the past and cloned the very latest from GitHub?
No i'm not absolutely sure... thus , could you confirm the command to remove all libsmu versions?
I will try a new compilation under 3.7 with last github https://github.com/analogdevicesinc/libsmu/blob/master/README.md
I'm not a Linux user, but that suggestion seemed to fix a similar problem for another Linux user in another thread. My guess is you need to do a search for anything named libsmu or it's parts and delete them. It might be that there is an old version somewhere ahead of the correct version in your search path for executables and libraries or whatever they are called in Linux.
An actual Linux expert needs to respond.