Well, sorry for necroposting, but I think this one is bit important.
I got HP/Agilent 4142B mainframe which sports HP-IB interface and since this thing does not have any controls on it's FP, only way to use it talk via GPIB.
Oki-doki I thought, no problems, my RPI+linux-gpib is ready.
But bleeeep... Failed at first attempt. ibtest was working well and nice, instrument was accepting commands and reading feedback, just like it should be.
First I ran ibtest program to check if Raspberry Pi with linux-gpib package can talk with the instrument and read data back.
enter a string to send to your device: *IDN?
sending string: *IDN?
trying to read 40 bytes from device...
received string: 'HEWLETT PACKARD,4142B,0,4.30'
But attempt of using same thing in the usual Python binding thru linux-gpib rendered no good results, 4142B just entering TALK mode and does not feedback or execute any commands.
My python test app:
cat ./test.py
# xDevs.com Python test GPIB app
# http://xdevs.com/fix/a4142b/
import sys
import Gpib
inst = Gpib.Gpib(0,14) # 4142B GPIB Address = 27
inst.clear()
inst.write("*RST")
inst.write("*TST? 2")
str = inst.read(40)
print str
This should reset the instrument and issue command to perform self-test on module in slot 2. Nop, nothing, just TLK LED lit up and nothing happening. App give timeout error on inst.read command afterwards.
How I fixed it? Just add \n in write strings, and it works well now!
...
inst.write("*IDN?\n")
str = inst.read(40)
print str
root@pi2:/repo/3458# python ./test.py
HEWLETT PACKARD,4142B,0,4.30
Hope this helps someone.