Javascript required
Skip to content Skip to sidebar Skip to footer

How to Read From a Ni Gpib Usb Hs

  • Intro
  • Disclaimer
  • National Instruments GPIB-USB-HS dongle
  • Raspberry Pi setup with automatic script
  • Obsolete transmission setup procedure, do non use together with automatic script
  • Configuration for linux-gpib and interfacing
  • Testing GPIB operation
  • Python-application to talk GPIB from Raspberry Pi
  • Additional interfaces, LXI via Python
  • NI USB-GPIB-HS repairs

Intro

While GPIB interface is slowly replaced past USB, LAN and other less pop modern interfaces, lot of instrumentation are still rely on GPIB as industry standard. Majority of product systems and automated measurements setups using GPIB for decades already. All these commonly crave a host GPIB controller to run programme and issue operations over the bus.

Using PC is easiest thing, specially Windows-based machines, as most of vendors already supply set up to employ libraries and packages to interface their instruments via GPIB. But if you go lilliputian aside, using Linux-based OS, things become tricky very quick, especially for engineers who are not familiar of *aught environment and way of things. Often simple plugging GPIB adapter into system and expecting things to work cause havoc and countless hours wasted, resolving dependencies, compiling pieces of code, tweaking kernels and such.

Disclaimer

Redistribution and utilize of this commodity or any images or files referenced in it, in source and binary forms, with or without modification, are permitted provided that the post-obit conditions are met:

  • Redistribution of article must retain the above copyright notice, this list of conditions, link to this page and the following disclaimer.
  • Redistribution of files in binary or source form must reproduce the above copyright find, this list of weather, link to this page, and the post-obit disclaimer in the documentation and/or other materials provided with the distribution, for instance Readme file.

All data posted here is hosted merely for pedagogy purposes only and provided Every bit IS. In no event shall the author, National Instruments, Raspberry Pi foundation, or whatsoever other 3rd party exist liable for whatsoever special, directly, indirect, or consequential damages or whatever damages whatsoever resulting from loss of utilise, data or profits, whether in an action of contract, negligence or other tortuous action, arising out of or in connection with the use or performance of information published here.

National Instruments GPIB-USB-HS dongle

First, let's have a look on hardware interface which we will exist using in this tutorial.
There are multiple versions of USB-GPIB interfaces from National Instruments, we use previous generation GPIB-USB-HS. There is already newer version available, GPIB-USB-HS+ for most same price ~600 USD new.

Features:

  • Custom ASIC provides maximum IEEE 488.two performance
  • High-performance GPIB controller
  • No GPIB cable requirement for instrument connection
  • Transfer rates upward to 1.8 MB/s (IEEE 488.1) and up to 7.9 MB/south (HS488)
  • License included for NI-488.2

While NI site lists Linux support, it's declared just for RedHat, Scientific Linux and SUSE. If we want use it with something like Raspberry Pi with it'south Debian-based Linux system we are alone in the wild.


Epitome i: NI GPIB USB adapter dongle

Very brief datasheet simply covers bones installation and specification.


Image 2,iii: NI GPIB USB adapter PCB components and closeup

Main micro-controller to interface USB side is Cypress CY7C68013A, which is EZ-USB® FX2LP™ USB Microcontroller High-Speed USB Peripheral Controller based on 8051.

GPIB side is served past own National Instruments ASIC, TNT5004-AB, which is GPIB Controller with PCI and Generic interfaces. Information technology's documentation is subject area of NDA, simply there is public datasheet for GPIB talker/listener only version TNT5002-AB, which brings light to almost ASIC'south inner structure. Cypress CY7C1399BN is but 256-Kbit (32K x viii) SRAM to store realtime data during transfers. Arrangement clock is generated past 40 MHz generator.


Image four: Adapter's processor block diagram

There are also Texas Instruments TLC7733I and Proverb MAX804CSA supervisors, and few other small logic chips. No parts are populated on PCB's bottom side.

For comparison purposes, here's photo of older GPIB-USB-B adapter, which using Cypress FX and National Instruments TNT4882C-BT GPIB Controller chipset. Documentation for controller TNT4882*C* chip is also bachelor only under NDA from NI, but talker/listener merely version, TNT4882 without C take brief datasheet here


Epitome 5: One-time USB two.0 NI GPIB-USB-B adapter PCB photograph

Few extra photos of GPIB-USB-HS. Plastic cover is metallized on inner surfaces to aid EMI and shielding.


Image 6,7: Rear view of GPIB-USB-HS PCB and shielded enclosure case

Plenty hardware, let's dig into Linux globe to set everything up and effort talking some instruments.

Raspberry Pi setup with automatic script

Updated setup process from December 2021

For piece of cake installation please use automated script installer listed below. It is designed to operate with latest Raspberry Pi Image and tested with both NI USB-GPIB-HS and Agilent dongles.

Requirements for this automatic script are:

  • Raspberry Pi 3B model (should piece of work with Pi four, but not tested even so)
  • Fresh SD card with installed 32-flake Raspberry Pi Bone Epitome (tested with buster and bullseye)
  • Attached NI USB-GPIB-HS or Agilent USB GPIB dongle
  • GPIB device connected to dongle to test the operation (optional)

For BME280 back up the thermo_installer.run file should also be copied

The following 3 files should be copied to the SD card /boot directory:

  1. install_linux_gpib.sh
  2. empty ssh file
  3. thermo_installer.run

BME280 support will need the sensor attached to the IiiC bus. Use the +iii.three 5 supply for the sensor. Linux-GPIB support will need the USB interface dongle plugged in Before the drivers are installed. The NI USB-GPIB-HS controller works best and a hot plug script is added for it as well.

Manual entry of gpib_config command should non be needed afterwards reboot. This is handled automatically now.

Installation Steps:

  1. ssh into pi@'IP address'
  2. sudo raspi-config
  3. "Interface Options" -> SSH , SPI , I2C should all be enabled (SSH is important so it will exist accessible on next boot)
  4. "Localization Options" -> Locale and time zone should be configured.
  5. Exercise not change kicking options simply yet. They will be configured later
  6. Finish and go out raspi-config. 'Yes' to reboot.
  7. cd /boot
  8. sh install_linux_gpib.sh
  9. Enter yes to update and install system software.
  10. 'Yes' to reboot once the update finishes.
  11. cd /boot
  12. sh install_linux_gpib.sh
  13. 'No' to update software
  14. 'Yes' to install linux-gpib
  15. 'Yep' or 'No' to install teckit (teckit is xDevs.com's Datalogging app for automated measurements)
  16. 'Yes' or 'No' to install samba
  17. PITFT hat back up: 'Yes' or 'No' to install Pitft lid support. If 'No' is selected, goto pace 27 Select the correct Pitft hat (ii) Select the rotation. (270 puts the HDMI port on top) 'Y' to put console output on the display. Rapsi-config has been modified to kicking to the console without car-login 'Y' to reboot. Next option will neglect unless the pi is rebooted
  18. cd /kicking
  19. sh install_linux_gpib.sh
  20. Select 'n' until you get to enabling the desktop on the brandish
  21. 'Y' to enable desktop frame buffer
  22. 'Aye' to reboot
  23. sudo raspi-config
  24. System Options -> Boot / Auto Login -> Desktop Autologin
  25. Finish and Yes to reboot
  26. The Desktop should at present be on the lcd
  27. Earlier calculation support for the BME280, it volition be of import to know its address on the I2C jitney. Run the post-obit control and annotation its hex accost: I2Cdetect -y 1. The number volition be in hex. ie 76 = 0×76 or 77 = 0×77. The datasheet just lists two possible hex addresses.
  28. cd /boot
  29. sh install_linux_gpib.sh
  30. Select 'n' until prompted to add BME280 support.
  31. Select 'y'
  32. Select 'northward' to display THP data on the lcd. Otherwise, select 'Y' for headless display. Selecting 'y' will not install the gui server
  33. Select 'y' to reboot
  34. If the THP data isn't displayed, the launcher.sh file in /habitation/pi may not have the right permissions. sudo chmod +x launcher.sh and so 'sudo reboot'.
  35. If the screen is oriented in the incorrect direction, it can exist changed in the /boot/config.txt file at the bottom. Default is 270 degrees

At present Pi should accept linux-gpib operational and GPIB communications can be tested with ibtest utility.

Obsolete transmission setup procedure, do not use together with automated script

Detailed manual procedure for Wheezy/Jessie Raspberry Pi OS images
All data below is tested on Raspberry Pi i model B rev 2 and Raspberry Pi 3 model B rev 2, using on-lath USB connectedness for GPIB dongle. Two Linux versions were tested, RASPBIAN Debian Wheezy and RASPBIAN Debian Jessie.

We already went through bones setup doing IiiC stuff on RPi earlier, in this article. If y'all need to setup system from scratch on blank SD card, suggest to reference that article outset.

Below we go step by step for whole process of getting GPIB-USB-HS working with Raspberry Pi system. Forum thread on EEVBlog.com from fellow member bingo600 was a great help, and definitely saved loads of time and efforts. While he was using Beiming S82357 and Agilent 82357B, but idea behind catamenia is exactly aforementioned. If you have 1 of those, be certain to cheque out Agilent-version of this article

  1. Before nosotros beginning installing stuff, highly recommended to update current packets. All commands below are issued under admin root rights, so if you don't usually logon under root, yous may demand utilize sudo.
apt-go update
  1. Previously we had to build old headers to use with kernel 3.8.ten, but it's possible to use latest kernel past building kernel headers post-obit rpi-source to build kernel headers for current kernel (follow the example)
wget https://raw.githubusercontent.com/notro/rpi-source/primary/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update 2016-03-07 13:25:38 (4.12 MB/s) - /usr/bin/rpi-source saved [12424/12424]

Current version of kernel I used was iv.one.17+

pi@pi2:~ $ uname -a Linux pi2.xdevs.com 4.1.17+ #838 Tue Feb nine 12:57:10 GMT 2016 armv6l GNU/Linux

rpi-source too crave bc and bison packages on the system, if it's not installed, yous would need to do then by running apt-get install bc bison.

  1. Now execute rpi-source to build headers for system'due south kernel.
root@pi2:/repo/new_hdr# rpi-source  *** gcc version check: OK  *** Using: /usr/share/doc/raspberrypi-bootloader/changelog.Debian.gz  *** Latest firmware revision: 3442862c10fab68c2e88d660d2e69c143bb1f00c  *** Linux source commit: ca312f557513e057c456598528e663fe9d009498  *** Download kernel source  *** Unpack kernel source  *** Create symlink: /root/linux  *** Create /lib/modules/<ver>/{build,source} symlinks  *** .config  *** Module.symvers  *** make modules_prepare  *** Assist: https://github.com/notro/rpi-source/wiki

This operation take nigh 5 minutes, so you lot tin get make some java/tea to spare waiting.

  1. If yous get fault virtually gcc version mismatch like:
root@pi2:/# rpi-source Fault: gcc version check: mismatch between gcc (4.9.two) and /proc/version (four.7.2) Skip this check with --skip-gcc

Install gcc 4.9 or other version, depends on what is requested on Error message above.

root@pi2:/# apt-become install -y gcc-4.9 k++-4.nine Reading parcel lists... Washed Building dependency tree Reading state information... Done The following additional packages will be installed:   cpp-4.9 libasan1 libgcc-4.ix-dev libstdc++-four.9-dev Suggested packages:   gcc-4.9-locales gcc-4.ix-doc libstdc++6-4.9-dbg libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan1-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libquadmath0-dbg   libstdc++-4.nine-doc The following NEW packages volition be installed:   cpp-four.9 k++-iv.9 gcc-four.nine libasan1 libgcc-4.9-dev libstdc++-4.nine-dev 0 upgraded, six newly installed, 0 to remove and 75 not upgraded. Need to get 21.seven MB of athenaeum. ...

If installation completed successfully, at present can setup gcc versions

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.ix 50 update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-four.9 50
$ gcc --version root@pi2:/# gcc --version gcc (Raspbian four.9.three-fourteen) 4.nine.3 Copyright (C) 2015 Free Software Foundation, Inc.

Used gcc version can be changed by running

update-alternatives --config gcc

bc packet likewise required, it can be installed by apt-become install bc. Afterward this rpi-source should execute to become kernel stuff done.

root@raspberrypi:/dwelling house/pi# rpi-source  *** gcc version check: OK  *** Using: /usr/share/physician/raspberrypi-bootloader/changelog.Debian.gz  *** Latest firmware revision: 748fb17992426bb29d99224b93cb962fefbdc833  *** Linux source commit: f1a1eec4c38d3c36b67c609f6c27805d04dab978  *** Download kernel source --2018-09-06 06:17:59--  https://github.com/raspberrypi/linux/archive/f1a1eec4c38d3c36b67c609f6c27805d04dab978.tar.gz ... Location: https://codeload.github.com/raspberrypi/linux/tar.gz/f1a1eec4c38d3c36b67c609f6c27805d04dab978 [following]

After this libraries and additional packages can exist installed:

root@pi2:/repo/new_hdr# apt-get install tk-dev build-essential texinfo texi2html libcwidget-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool mercurial Reading parcel lists... Washed Edifice dependency tree Reading land information... Done .... 0 upgraded, 19 newly installed, iv to remove and 19 not upgraded. Demand to get four,651 kB of archives. After this operation, six,192 kB of additional deejay space will be used. Do you want to go along? [Y/n] Y

Now install linux-gpib itself. Enter home directory and run next:

root@tin:/dwelling house/# mkdir linux-gpib   root@tin:/home/# cd linux-gpib root@tin can:/dwelling/linux-gpib# svn checkout svn://svn.code.sf.net/p/linux-gpib/lawmaking/trunk linux-gpib-code A    linux-gpib-code/linux-gpib A    linux-gpib-code/linux-gpib/test A    linux-gpib-code/linux-gpib/exam/runtest ... ... A    trunk/linux-gpib/examples/ibtest.c Checked out revision 1755.
  1. At this moment we have latest linux-gpib from SVN and ready to configure and install it.
root@tin:/home/linux-gpib# cd linux-gpib-code/linux-gpib-kernel/ root@tin can:/abode/linux-gpib/linux-gpib-lawmaking/linux-gpib# ./bootstrap configure.ac:25: installing './config.guess' configure.ac:25: installing './config.sub' configure.ac:vii: installing './install-sh' configure.air-conditioning:seven: installing './missing'
  1. At present run ./configure in linux-gpib-kernel directory to set it for our system environs.
root@can:/habitation/linux-gpib/linux-gpib-code/linux-gpib# ./configure checking for a BSD-uniform install... /usr/bin/install -c checking whether build environment is sane... yes checking for a thread-rubber mkdir -p... /bin/mkdir -p checking for gawk... no checking for mawk... mawk checking whether make sets $(Brand)... yes checking whether brand supports nested variables... yep checking whether to enable maintainer-specific portions of Makefiles... no checking for util/.scm_version.tmp... yes checking build system blazon... armv7l-unknown-linux-gnueabihf checking host system type... armv7l-unknown-linux-gnueabihf checking Linux kernel directory... ok checking Linux kernel compile flags... Alarm: could not open /repo/linux-gpib/linux-gpib-code/linux-gpib-kernel/util/linux_flags/fake.c: Invalid argument ok checking for depmod... /sbin/depmod checking that generated files are newer than configure... washed configure: creating ./config.condition config.status: creating Makefile config.status: creating drivers/Makefile config.status: creating config.h
  1. Compile and install linux-gpib-kernel
root@tin:/home/gpib/linux-gpib-3.2.21# make make  all-recursive ... ...

This volition have some time. After this footstep do make install

Now leave linux-gpib-kernel folder and practice same ./bootstrap, ./configure and brand & make install steps in linux-gpib-user folder. Also copy gpib.conf from examples to /etc/gpib.conf:

root@tin:/repo/linux-gpib/linux-gpib-code# cd linux-gpib-user/ root@tin:/repo/linux-gpib/linux-gpib-code/linux-gpib-user# ./bootstrap root@tin can:/repo/linux-gpib/linux-gpib-code/linux-gpib-user# ./configure root@tin:/repo/linux-gpib/linux-gpib-lawmaking/linux-gpib-user# make root@tin:/repo/linux-gpib/linux-gpib-code/linux-gpib-user# make install root@tim:/repo/linux-gpib/linux-gpib-code/linux-gpib-user# cp util/templates/gpib.conf /etc/gpib.conf

These steps must complete without errors in the finish. Also may be worth to run ldconfig to link all installed libraries

Configuration for linux-gpib and interfacing

After everything successfully installed without errors, let's connect GPIB-USB-HS adapter to Raspberry Pi and try to talk with information technology.

Brand sure your Pi powered with good short high-current USB cable and +5 VDC power supply with at least 2 Amp , as NI GPIB-USB-HS is taking some decent amount of power and with cheap USB cablevision connected to PC port it was causing unstable performance, LAN LEDs on Pi were blinking like crazy and goose egg worked, as voltage drop likewise much.

Checking interface connection is unproblematic, just run lsusb to run into which devices are nowadays on USB bus:

root@tin can:/etc# lsusb Jitney 001 Device 002: ID 0424:9514 Standard Microsystems Corp. Charabanc 001 Device 001: ID 1d6b:0002 Linux Foundation ii.0 root hub Coach 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. Passenger vehicle 001 Device 004: ID 3923:709b National Instruments Corp. GPIB-USB-HS

Different onetime GPIB-USB-B, which demand Cypress FX firmware upload every fourth dimension after connectedness, GPIB-USB-HS does non demand any firmware uploads and ready to work right from the box.

Permit's load kernel module with modprobe:

root@can:/domicile/gpib/linux-gpib-iii.2.21# modprobe ni_usb_gpib root@tin:/home/gpib/linux-gpib-3.2.21#

Should exist no fault messages here. Can cheque if module was correctly used as well by lsmod.

root@tin can:/home/gpib/linux-gpib-3.2.21# lsmod Module                  Size  Used past i2c_dev                 6970  0 i2c_bcm2708             5306  0 ni_usb_gpib            26063  0 gpib_common            31031  1 ni_usb_gpib

Now I tried using gpib_config tool to exam operation, merely got nasty error instead:

root@tin:/dwelling house/gpib/linux-gpib-iii.2.21# gpib_config failed to configure boardtype: ni_usb_gpib failed to configure board main: Invalid argument

Oops… After some amount of trial and mistake, and googling similar issues on web, answer is elementary: this is due to bodily driver called different proper name compared to kernel module. In our instance driver for NI GPIB-USB-HS need to be properly selected in interface block, then related configuration on /etc/gpib.conf should follow next example:

interface {     minor       = 0             /* lath index, minor = 0 uses /dev/gpib0, pocket-sized = i uses /dev/gpib1 */     board_type  = "ni_usb_b"    /* blazon of interface board being used */     name        = "violet"      /* optional name, allows you to become a board descriptor using ibfind() */     pad         = 0             /* primary address of interface             */     pitiful         = 0             /* secondary address of interface           */     timeout     = T30s          /* timeout for commands */     eos         = 0x0a          /* EOS Byte, 0xa is newline and 0xd is carriage return */     fix-reos    = yes           /* End read if EOS */     gear up-bin     = no            /* Compare EOS viii-chip */     set up-xeos    = no            /* Assert EOI whenever EOS byte is sent */     gear up-eot     = yes           /* Assert EOI with last byte on writes */     master      = aye           /* interface board is organisation controller */ }

You lot likewise may get error on RPI2, like shown below

root@raspberrypi ~/linux-gpib/linux-gpib-lawmaking/linux-gpib $ gpib_config:  error while loading shared libraries:

To set this, just execute command ldconfig before gpib_config.

Everything working well at present:

root@tin:/home/gpib/linux-gpib-3.2.21# gpib_config root@tin:/home/gpib/linux-gpib-3.ii.21#            

No fault letters, yay! Let's test how it works now.

You may want to add /usr/local/sbin/gpib_config into /etc/rc.local to have it executed automatically during Raspberry Pi boot, if information technology is non done automatically.

Testing GPIB operation

To exam I had NI GPIB-USB-HS connected to Fluke 5720A. Instrument is configured with GPIB Accost = ane in this case below.

root@can:/# ibtest Do you lot wish to open up a (d)evice or an interface (b)oard?         (yous probably desire to open up a device): d enter primary gpib address for device you wish to open [0-30]: ten trying to open up pad = 10 on /dev/gpib0 ... You can:         w(a)it for an event         ...         ...         (r)ead string         perform (s)erial poll (device only)         modify (t)imeout on io operations         request ser(v)ice (board only)         (westward)rite data cord : west enter a string to transport to your device: *IDN? sending string: *IDN?  gpib condition is: ibsta = 0x2100  < Stop CMPL > iberr= 0  ibcnt = 6 You tin can:         w(a)information technology for an event         ...         ...         (r)ead string         perform (s)erial poll (device only)         change (t)imeout on io operations         request ser(five)ice (board only)         (w)rite data string : r enter maximum number of bytes to read [1024]: 1024 trying to read 1024 bytes from device... received string: 'FLUKE,5720A,7543315,one.4+B+*' Number of bytes read: 28 gpib status is: ibsta = 0x2100  < END CMPL > iberr= 0  ibcnt = 28

At present we tin confirm that interface is working, and data send/received correctly.

Python-awarding to talk GPIB from Raspberry Pi

It's time to write some simple programme to talk with our instruments over GPIB.
Ane of piece of cake choices would be using Python, as this high-level linguistic communication is very piece of cake to write information-logging programs and format data, without worry much nigh depression-level coding.

To use GPIB in Python nosotros need to have python-dev library installed and working:

root@can:/# apt-get install python-dev Reading package lists... Done Edifice dependency tree Reading land information... Washed The following extra packages will exist installed:   libssl-dev libssl-doc python2.seven-dev The following NEW packages will exist installed:   libssl-dev libssl-doctor python-dev python2.seven-dev 0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded. Need to become 2,699 kB/31.4 MB of archives. Later on this performance, 41.iv MB of boosted disk space will be used. Do yous want to proceed [Y/due north]? Y .... Setting up python2.seven-dev (2.7.3-6+deb7u2) ... Setting up python-dev (2.7.3-4+deb7u1) ...

Python-dev library is needed to access GPIB module.
Now nosotros can install python egg to include Gpib module with our python system environs:

root@tin:/dwelling/linux-gpib-code/linux-gpib-user/language/python# python ./setup.py  install running install running build running build_py running build_ext running install_lib running install_egg_info Writing /usr/local/lib/python2.7/dist-packages/gpib-1.0.egg-info

Simple Python test can help to check access, for multimeter sitting on GPIB bus with address 17. Test is simple sending IDN? request and reading back 100 bytes:

root@raspberrypi:/repo/linux-gpib/linux-gpib-code/linux-gpib-user/linguistic communication/python# python Python two.7.13 (default, Nov 24 2017, 17:33:09) [GCC 6.3.0 20170516] on linux2 Type "help", "copyright", "credits" or "license" for more than data. >>> import Gpib >>> inst = Gpib.Gpib(0,1) # Device address 1 >>> inst.write("*IDN?") >>> inst.read(100) 'FLUKE,5720A,7543315,ane.four+B+*\n' >>>

Promise this article help to utilize little, but mighty Raspberry Pi with industry standard GPIB instrumentation. Size and capabilities of small microcomputer, such every bit Raspberry Pi can make something wild possible, such as integrating it into old GPIB-interfaced instruments to bring modern calculating power and interfacing, such as interactive spider web via LAN port or even having instrument on remote location, controlled thru Cyberspace. No need big bulky estimator with Windows tied to it.

# xDevs.com Python test GPIB app # http://xdevs.com/guide/ni_gpib_rpi/ import sys import Gpib inst = Gpib.Gpib(0,x) # Musical instrument GPIB Address = 10 inst.write(":DISP:WIND:TEXT:DATA 'Raspberry Pi GPIB;)'") inst.write(":DISP:WIND2:TEXT:DATA 'xdevs.com/guide/ni_gpib_rpi'") inst.write(":DISP:Current of air:TEXT:STAT ON") inst.write(":DISP:WIND2:TEXT:STAT ON")


Image 8: Keithley 2002 DMM displaying python lawmaking outcome

Here's another app example, to setup and read data from HP 3458A multimeter

# xDevs.com Python 10V test for 3458A # https://xdevs.com/guide/ni_gpib_rpi/ # https://xdevs.com/article/hp3458a_gpib/ # https://xdevs.com/fix/hp3458a/ import sys import Gpib import fourth dimension  inst = Gpib.Gpib(0,iii, timeout=sixty) # 3458A GPIB Address = 3 inst.clear()  #Setup HP 3458A inst.write("PRESET NORM") inst.write("OFORMAT ASCII") inst.write("DCV 10") inst.write("TARM HOLD") inst.write("TRIG AUTO") inst.write("NPLC 200") inst.write("AZERO ON") inst.write("LFILTER ON") inst.write("NRDGS i,Machine") inst.write("MEM OFF") inst.write("END ALWAYS") inst.write("NDIG 9")  cnt = 0 tread = 2 temp = 38.five inst.write("TEMP?") temp = float(inst.read()) reflevel = 10.0000000 ppm = 0  with open('10v_3458_nplc200_mm.csv', 'a') as o:     o.write("date;hp3458a;level;temp;ppm_level;\r\n")     o.shut()  while cnt <= 10000000:     cnt+=one     with open('10v_3458_nplc200_mm_08451_opt002.csv', 'a') as o:         tread = tread - 1         if (tread == 0):             tread = xx             inst.write("TARM SGL,one")             inst.write("TEMP?")             temp = inst.read()         inst.write("TARM SGL,1")         data = inst.read()         ppm = ((float(data) / reflevel)-ane)*1E6         inst.write("DISP OFF, \"%3.3f ppm\"" % bladder(ppm))         fourth dimension.slumber(1)         impress time.strftime("%d/%m/%Y-%H:%M:%S;") + ("[%8d]: %2.8f , dev %iv.4f ppm, T:%3.1f" % (cnt, bladder(information),bladder(ppm),float(temp) ) )         o.write (time.strftime("%d/%g/%Y-%H:%M:%South;") + ("%sixteen.8f;%xvi.8f;%iii.1f;%4.3f;\r\due north" % (float(information),float(reflevel),float(temp),float(ppm) ) ))         o.shut()

Additional interfaces, LXI via Python

One of our readers also mentioned possibility of using LXI-compatible instruments with Raspberry Pi.

To use this simple guideline can be followed. Create folder (for example /home/LXI).

mkdir /home/LXI

Enter directory and get SVN repository for python-vxi

svn checkout https://github.com/python-ivi/python-vxi11

Enter /dwelling house/LXI/python-vxi11/trunk directory

python setup.py install

At present python-vxi should be installed on your Raspberry Pi

Here's example python app to talk with VXI instrument:

import vxi11 instr =  vxi11.Musical instrument("192.168.0.8") print(instr.ask("*IDN?"))

In case of correct installation and connexion reply can be as below:

Keithley Instruments Inc., Model 2636B, 1234567, 3.2.1

More information is available on github for python-vxi11 or Alex Forencich'south site
He also had created python-usbtmc for Python USB commnication with instruments, so check it out.

NI USB-GPIB-HS repairs

Recently one of dongles I had stopped working. When attempted to utilize with linux-gpib software in Raspberry Pi environs it just returned "OS Errors". In Windows-based system dongle was properly detected at first as NI USB-GPIB-HS interface simply few seconds driver reported failure with "device cannot commencement or the driver is missing".

Some other USB-GPIB-HS dongle was operating just fine in same Linux/Windows surround. So at present that I have confirmed that it is a dongle hardware issue, time to take one apart and do some troubleshooting.

I take checked ability runway on a dongle. Both +iii.3V and +5V were OK, and electric current draw of the dongle was matching other expert dongle inside few pct. Adjacent suspect – I2C EEPROM abuse.

I was non lonely with such trouble, some users from EEVBlog forum also reported issues with EEPROM on these dongles. Forum fellow member result was even so fleck different device was detected as USB\VID_04B4&PID_8613 which are default Cypress USB ii development kit IDs and not the NI USB-GPIB-HS.

Either way Microchip 24LC256 I2C EEPROM contents was dumped from the skilful dongle, written into bad dongle, but this rendered my bad dongle non even detect properly. Instead it blinked green LED few times and so was presented as Unknown USB device.

At this point dongle was sitting on a shelf, until I got another dead dongle from Nikonoid. His dongle was evidently dead, non detecting by computer and no whatever LED activity at all. R10 and R19 0 ohm 0603 size SMT-resistors on his dongle were burned to well-baked. For comparison, Nikonoid's dongle PCB is on the right side in the next photo.

R21 is a polyfuse on primary +5V entry from USB cablevision. It was OK, no issues with power here. +3.3V rail even so is loaded downwards. It is regulated by MAXIM MAX604CSA linear regulator. Good dongle measured DC resistance +3.3V to footing around 50 kΩ while this bad dongle reported 300 Ω. When powered +3.3V rail was drawing 45mA or and then, with correct +three.3V.

I didn't want to spend too much time with these (you can buy one of the knock-off USB-GPIB-HS dongles from ePay for $100 or less USD). At that place is no assist from vendor, lack of schematics and it is iv-layer PCB. Next just things I tried to do, swapping parts betwixt my "Unknown Device" and this brain-dead dongle in timelog sequence:

  • Swap MAX604 LDO, even though I was pretty sure it was not a problem. Didn't help either dongle.
  • Bandy supervisor IC which is U9 TI TLC7733. Didn't help either dongle.
  • Swap U5 74LCX245A logic chip. Didn't help either dongle.
  • Swap U6 SRAM TSSOP28 chip. Winner, now my dongle that had issues with driver or ID at present works totally fine.

I did not immediately suspect bad SRAM bit, but it was not totally incommunicable. Mayhap rogue cosmic ray shoot thru some capacitors inside SRAM array and killed information technology :).

Dongle with loaded downward +iii.3V rail withal take problem, perhaps it is bad cracked capacitor somewhere or damaged USB microcontroller Cypress CY7C68013A or fifty-fifty worse, bad BGA NI TNT5004-AB chip. I might proceed troubleshooting for this dongle in future, but for at present its going back on shelf.

Hopefully this repair worklog can help somebody who may take broken NI USB-GPIB-HS.

Article version:

  • Update 9/6/2018 using 4.fourteen.50-v7+ kernel with rebuilded headers and linux-gpib #1755 build.
  • Update 3/7/2016 using four.ane.17+ kernel with rebuilded headers. Thanks to feargus!
  • Initial article, using 3.eight.ten kernel + downloaded headers, PDF-archived

If you have whatsoever comments and suggestions – feel gratis to join in comments!

How to Read From a Ni Gpib Usb Hs

Source: https://xdevs.com/guide/ni_gpib_rpi/