Author Topic: Using a Raspberry PI with linux-gpib - and a Beiming or Agilent USB-GPIB adapter  (Read 77902 times)

0 Members and 1 Guest are viewing this topic.

Offline ttb

  • Newbie
  • Posts: 4
@Bingo 600

1. if i go trough the logfile, i see some remarks "nothing to do for all"
but i supposed this was normal??

2. i got the latest headers

3. yes, no remarks when i did that..

Thanks for your help, hope Hari or somebody else can come up with some ideas.
The main problem as far as i know anything of it.. seems to be the modules not getting created or loaded.
And i don't know where they should be created. /lib/..  /etc/.. ??
 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
Allready having done the , as described in the first post.
1: sudo apt-get update
2: sudo apt-get install linux-image-rpi-rpfv

I just updated my kernel to
Quote
bingo@raspi3:~$ uname -a
Linux raspi3 3.10-3-rpi #1 Debian 3.10.11-1+rpi6 (2014-04-27) armv6l GNU/Linu

I did the following:

sudo apt-get update
sudo apt-get upgrade
sudo apt-get dist-upgrade.

Edited the /boot/config.txt to load the newest kernel
In boot/config.txt append this at end of file , or it will boot the default "Foundation kernel"

************* SNIP ***********************
# Set params for "raspbian debian-style kernel" boot
#kernel=vmlinuz-3.2.0-4-rpi
#initramfs initrd.img-3.2.0-4-rpi followkernel
#kernel=vmlinuz-3.6-trunk-rpi
#initramfs initrd.img-3.6-trunk-rpi followkernel
kernel=vmlinuz-3.10-3-rpi
initramfs initrd.img-3.10-3-rpi followkernel
************* SNIP ***********************

Then i did a : rpi-update   (to get the newest firmware)
The rpi-update also pulls the newest "Foundation kernel" , but i don't use it.

And did a reboot.

Now it shows:
Quote
bingo@raspi3:~$ uname -a
Linux raspi3 3.10-3-rpi #1 Debian 3.10.11-1+rpi6 (2014-04-27) armv6l GNU/Linu

Then i rebuild the module , using the above steps.
Including a new "git clone" , as the ./bootstrap needed to get new values from scratch.

All went well  :-+

/Bingo
« Last Edit: May 14, 2014, 08:06:02 pm by bingo600 »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2252
  • Country: ca
this seems a wonderful project, can you tell me if I could use it to do the following?
I have a couple of Hall sensors that I connected to measure a magnetic field along two directions. The sensors output a DC voltage between 0 and 5V.
I'd like to connect it to an analog to digital converter, to read the voltage with the Pi (I already tested it with a simpler sensor).
Now, using linux-gpib, do you think it is possible to output this data to another PC?
I need to do it because in my lab it is this PC that performs the main measurement, using Agilent VEE. Do you think that my VEE program could recognize the Pi and read the data that it outputs with linux-gpib?

thanks for any help!

alessandro

VEE should be able to accept data from any arbitrary RS232/serial device. So I would focus on using that interface into VEE. You can use software (such as com2com) to create a pair of virtual loopback COM ports. Then VEE would connect to one of them, and the other connects to a program that will route the serial port data over TCP (com2tcp, part of the com2com software). You PI only needs to open a TCP connection to the other computer and send the data. It will then magically appear on the serial port that VEE is listening to.

On the PI side, I don't think you even need GPIB. It would be "easier" to connect an I2C ADC to the PI to get your data in. There are also purpose made modules ("ADC PI" for example) for ADC.
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Hmm...according to your Python example....I just get:

Code: [Select]
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import Gpib
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named Gpib

What's missing to be able to use Python with linux-gpib?

 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Got it....

Code: [Select]
sudo apt-get install libpython2.7-dev ;-)

 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Hmm....doesn't work with screendumps...

Code: [Select]
>>> inst.write("SCDP")
>>> inst.read(25000)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/Gpib.py", line 55, in read
    self.res = gpib.read(self.id,len)
gpib.GpibError: read() failed: A read or write of data bytes has been aborted, possibly due to a timeout or reception of a device clear command.
>>>
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Apparently 25000 is too big (o;

So...just wrote my first Python script in my life *gg

Code: [Select]
#!/usr/bin/python

from Gpib import *

inst = Gpib(0,15)

f = open('dso.plt', 'w')

inst.write("SCDP")

f.write(inst.read(512))

while inst.ibcnt() == 512:
print 'Reading 512 bytes'
f.write(inst.read(512))

print 'Finished dumping...'

A little slow though with the F82357 adapter...but I guess the MC68000 is the bottleneck (o;

Code: [Select]
Finished dumping...

real 0m32.321s
user 0m0.022s
sys 0m0.047s

Then a little

Code: [Select]
hp2xx -m png -c 1234567 dso.plt
And out comes:

« Last Edit: July 28, 2014, 06:07:39 pm by davorin »
 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
@davorin  :-+

Feels good doesn't it ?

/Bingo
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Yes it does....getting there slowly but surely (o;

Before I used a Prologix clone with a simple terminal program....and just piped the output to a log file after entering "SCDP" (o;

Guess the next step is towards small C-programs....

And finally using MRTG/Cacti to time graph current consumption measured by my 4 * 6632B (o;

 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
Hmmm...what drives me nuts is now the fact I can't pipe it to hp2xx for further processing....

Code: [Select]
Traceback (most recent call last):
  File "./dump.py", line 34, in <module>
    proc = subprocess.Popen(hp2xx, stdin=subprocess.PIPE)
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

The code:

Code: [Select]
proc = subprocess.Popen(hp2xx, stdin=subprocess.PIPE)
proc.stdin.write(hpgl)

And replacing the shell command with "/bin/cat" actually does it what it should...just not with:

Code: [Select]
/usr/bin/hp2xx -m png -c 12445611 -d 100 -f lecroy.png
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
*Uff....that was a long exercise to find out why /bin/v^cat worked but hp2xx not...

The answer I finally found here:

http://stackoverflow.com/questions/23787338/python-popen-shell-false-causes-oserror-errno-2-no-such-file-or-directory


And here's the code....called with

Code: [Select]
./dump.py lecroy
Which reads the screendump and dumps it out to hp2xx, converting to a 100 DPI PNG file...all in one (o;


Code: [Select]
#!/usr/bin/python

import sys
from subprocess import Popen, PIPE
import errno
import shlex

hpgl = ""
hp2xx = "/usr/bin/hp2xx -m png -c 12445611 -d 100 -q -f "
cat = "/bin/cat"

from Gpib import *

file_name = sys.argv[1]
hp2xx += file_name
hp2xx += ".png"

p = Popen(shlex.split(hp2xx), shell=False, stdin=PIPE)

bytes = 100

inst = Gpib(0,15)

inst.write("SCDP")

p.stdin.write(inst.read(bytes))
count = 0

while inst.ibcnt() == bytes:
print 'Reading ', count, ' bytes\r'
p.stdin.write(inst.read(bytes))
count += bytes

print 'Finished dumping...'

print hp2xx

p.stdin.close()
p.wait()

Comments and improvements welcome :-))

 

Offline falcongsr

  • Newbie
  • Posts: 1
Bingo thanks for your perseverance and taking the time documenting your progress. I just got it working on my Pi. Hugely helpful!

falcongsr
 

Offline er11

  • Newbie
  • Posts: 2
Thank you very much, Bingo
Gpib is ok
But I get a trouble with SPI, in kernel 3.12-1 SPI seems not enable.
Can you give us a kernel with SPI ?
Thank you
 

Offline chahine

  • Newbie
  • Posts: 1
Merci pour les infos grâce auxquelles on a réussi une manip présentée au lien ci dessous en français pour les francophones!
gilles-micolau.toile-libre.org/Flopy-html/Flopy.html
 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
Merci pour les infos grâce auxquelles on a réussi une manip présentée au lien ci dessous en français pour les francophones!
gilles-micolau.toile-libre.org/Flopy-html/Flopy.html

Thanx  :-+
I think it says that it works  ;)

/Bingo
 

Offline AudioplatinumService

  • Contributor
  • Posts: 43
  • Country: hr
    • www.audioplatinum.net
Hi guys!

I saw this post and I get one idea, if anybody here can help me little..
I have Tektronix AM700 Audio Measurement Set with GPIB, one very nice instrument with lot of functions for audio measurement.
I am newbie in GPIB, but I am good with linux and in my workshop I have couple of Raspberry Pi.

I wish to can read display results from AM700 when I measure something or doing some tests. Tektronix have one nice document for this AM700 with all commands and programming (SCPI thru GPIN or RS232)

http://exodus.poly.edu/~kurt/manuals/manuals/Tektronix/TEK%20AM700%20Programmer.pdf

Can someone take a look on this document and tell me if this can work with linux GPIB maybe?

Best Regards,
Damir
Audioplatinum Service
www.audioplatinum.net
A clean desk is the sign of a sick mind...
 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
Hi guys!

I saw this post and I get one idea, if anybody here can help me little..
I have Tektronix AM700 Audio Measurement Set with GPIB, one very nice instrument with lot of functions for audio measurement.
I am newbie in GPIB, but I am good with linux and in my workshop I have couple of Raspberry Pi.

I wish to can read display results from AM700 when I measure something or doing some tests. Tektronix have one nice document for this AM700 with all commands and programming (SCPI thru GPIN or RS232)

http://exodus.poly.edu/~kurt/manuals/manuals/Tektronix/TEK%20AM700%20Programmer.pdf

Can someone take a look on this document and tell me if this can work with linux GPIB maybe?

Best Regards,
Damir

Sure you can , but you'd need a supported USB-GPIB adapter , HP/Beiming/NI.  I have only tried the HP/Beiming (s)

But you also need to code your own measurement scripts , in C , Python , Perl or one of the other supported linux-gpib language extensions.

So if you can't program in one of the languages , you might be out of luck , or if you're lucky you can use LabView on Windows ($$$$) if TEK made a labview driver.

Note: There is also some gpib-controllers with serial interface , that just requires a "Comport" but still the above programming skills.


/Bingo
 

Offline AudioplatinumService

  • Contributor
  • Posts: 43
  • Country: hr
    • www.audioplatinum.net
Thanks on information Bingo

    Today I try my TEK  AM700 connect thru "usb to serial" adapter to PC and listen with serial capture software, after decoding emulated data (I setup tektronix to HP print mode) and I get nice screen capture on max speed of TEK serial port 38400.

I have to buy GPIB adapter and try make some magic with GPIB.. 

TNX all of you on inspiring posts about RPi-GPIB...

Cheers,
 Damir
Audioplatinum Service
www.audioplatinum.net
A clean desk is the sign of a sick mind...
 

Offline kuadrat

  • Newbie
  • Posts: 1
Hey Bingo,
thanks a lot for documenting your porcess of getting linux-gpib to work on the Raspberry PI and for your patch. I've been unsuccsessfully trying to install it on my own for far too long now...
Sadly, even when following your instructions, I experience the same problem as user ttb. It seems pretty clear to me that we don't have the right kernel headers, and in my case the reason for that is probably that I'm unable to do a "raspbian debian-style kernel" boot.
I'm running on a raspberry 2B, so after apt-get update and apt-get upgrade I installed the package linux-image-rpi2-rpfv.
I edited the config.txt file with the respective filenames from my /boot directory:

kernel=vmlinuz-3.18-0-trunk-rpi2
initramfs initrd.img-3.18-0-trunk-rpi2 followkernel

But my RasPi wont reboot with these settings.
I've tried several variations (linux-image-rpi-rpfv package and respective filenames in config.txt etc.) but can't get it to boot with anything but the default kernel.img.

I did start from a Raspbian image, not NOOBS, maybe this makes the difference?

Or maybe I'm missing something obvious here. Anyhow, if you (or anyone) has an idea what I'm doing wrong I'd greatly appreciate any help.

My next step would be to reformat the SD card and start from scratch, following your every step exactly, but I thought I'd ask if anyone would have a better idea before going that far.

Thanks in advance,
-kuadrat
 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
@kuadrat

I'm sorry but i don't have any rpi-2's , not even a B'
I doubt if installing Noobs or Raspbian first would make any difference, but i have only tested by installing NOOBS first, and then upgrade to raspbian.

So i can't help much out here.

Unless someone sponsors a RPI-V2  ;)



Once you succeed in making the kernel boot , get linux-gpib.
I'd recommend the tar file , as the SVN is evolving and sometimes buggy
http://sourceforge.net/projects/linux-gpib/files/

Direct link
http://sourceforge.net/projects/linux-gpib/files/latest/download?source=files

Note you don't need to do any patching , Dave P did incorporate it in the latest releases.

/Bingo
« Last Edit: June 16, 2015, 06:40:46 pm by bingo600 »
 

Offline bson

  • Supporter
  • ****
  • Posts: 2265
  • Country: us
I have an Intel NUC running Ubuntu 64-bit with the Agilent usbtmc driver - the driver was a bit out of date and needed a few updates for kernel interfaces changes to compile.  The driver does work fine with the few USB-TMC (GPIB-over-USB) devices I tested it with.  I have a Tek-USB-488 adapter on its way and plan to test with this as well.  (USB-TMC to physical GPIB.)  The Agilent usbtmc driver works with python-ivi and python-tmc.

The main thing is the Linux ehci bus driver is flaky when it comes to supporting USB2 devices on a USB3 host controller.  I'd recommend putting a 2.0 hub inbetween.  For some odd reason 1.1 devices don't cause problems, but I've found 2.0 devices do very consistently drop offline due to ehci-bus resets.
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
I'll got a chance to try it on a newer RPi 2 model....think I have all versions lying around here...though I intend to use one of my Beiming adapter with a Wandboard Dual when I get linux-gpib to compile with PHP 5 version (o;

Still struggling with Beiming adapters not supporting remote select with linux-gpib...works on Windows though with Agilent I/O...

 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
Still struggling with Beiming adapters not supporting remote select with linux-gpib...works on Windows though with Agilent I/O...

@davorin

Try the latest SVN

After FM Hess rejoined the linux-gpib project, quite a few modifications/improvements have been made.

Try to read some of the commit notes for the latest svn releases.

NOTE: Remember to reboot after installing, as the new versions breaks backwards compatibility.
Meaning the old loaded gpib module is incompatible with the new agilentxxx.ko module, until reloaded.
Easiest with a reboot.

/Bingo
 

Offline davorin

  • Supporter
  • ****
  • Posts: 922
  • Country: ch
I tried a svn checkout a while ago...didn't compile through at all (o;
Running now the 4.01 beta...also no luck with remote select....

Gonna try a new SVN on Thursday as I'm away tomorrow....just don't wanna go the Windows 8.1 Visual Studio way just to support my R&S CRTU (o;

 

Offline bingo600Topic starter

  • Super Contributor
  • ***
  • Posts: 1977
  • Country: dk
I tried a svn checkout a while ago...didn't compile through at all (o;
Running now the 4.01 beta...also no luck with remote select....

Gonna try a new SVN on Thursday as I'm away tomorrow....just don't wanna go the Windows 8.1 Visual Studio way just to support my R&S CRTU (o;

I have just told Dave P , that SVN 1633 breaks on my 32-bit Debian Wheezy.
And Dave has just confirmed the bug.

He'll have a look on what is causing it , and hopefully fixing it in SVN Rev 1634

A big thank you to the linux-gpib team , and especially Dave. For accepting and implementing my RasPi patch.
But not to forget FM Hess (long time maintainer), who have recently returned to the project , and is now working with Dave   :-+

/Bingo
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf