Electronics > Metrology

Raspberry Pi2/3 logging platform for Voltnuts

<< < (85/88) > >>

JoeMeta:
Hi everyone,

This thread and the install script were very helpful.  However, out of the clipboard it didn't quite work for me.  I'm using a Raspberry pi CM4 on the reference I/O expander board.    Running Raspbian Bullseye in late May of 2023.

Here are the changes / extra steps I did to get it working for my Agilent 82357A GPIB to USB adapter:

Add "arm_64bit=0" to ./boot/config.txt
Added "/home/pi/.local/bin" to my path variable to resolve some warnings. The command is:
export PATH=$PATH:/home/pi/.local/bin
added make clean between the make and make install steps
in step 2 ran the risky kernel upgrade: "sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel"
measat_releaseX1.8.hex doesn't work, put 82357a_fw.hex where measat was going in step 4.2, in my case"/usr/local/share/usb/agilent_82357a"
ignored system.map errors when installing the kernel driver
reboot between steps - if something doesn't work reboot and try again, then if still not working run "sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade" and reboot again and try again.
step 6.1 was needed

In 4.2 the gpib.conf file, board type = agilent_82357a

Also in step 4 if people copy and paste the wget command with the HTML url tags then it will fail to download.
I also manually edited the file gpib.conf in step 4 since I wasn't sure if the script would work as intended. Replacing: board_type = "NI HS whatever" with board_type = "agilent_82357a"

Also keep in mind 6.2 is still using the measat firmware so it needs to be adjusted before attempting to use it with a Agilent 82357A.


--- Code: ---
Install GPIB on Linux with Agilent USB-GPIB adapter (tested with Raspberry Pi OS Lite 32bit 2022-04-04 Bullseye (5.15.32-v7+) and linux gpib 4.3.4 (r2025) on pi3):
Joe Meta's tweaks:
Add "arm_64bit=0" to ./boot/config.txt
//my path = /home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
export PATH=$PATH:/home/pi/.local/bin
echo $PATH
added make clean between the make and make install steps
in step 2 ran the risky kernel upgrade: "sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel"
measat_releaseX1.8.hex doesn't work, put 82357a_fw.hex where measat was going in step 4.2, in my case"/usr/local/share/usb/agilent_82357a"
ignore system.map errors
reboot between steps - if something doesn't work reboot and try again, then if still not working run "sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade" and reboot again and try again.
step 6.1 was needed


Sources:
[url]https://xdevs.com/guide/agilent_gpib_rpi/[/url]
[url]https://www.eevblog.com/forum/metrology/raspberry-pi23-logging-platform-for-voltnuts/msg1301773/#msg1301773[/url]
[url]https://www.eevblog.com/forum/reviews/using-a-raspberry-pi-with-linux-gpib-and-a-beiming-or-agilent-usb-gpib-adapter/?all[/url]
[url]https://sourceforge.net/p/linux-gpib/code/HEAD/tree/trunk/[/url] -> History

1. Preparation
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && echo 'Rebooting...' && sudo reboot

2. Install Kernel-Headers
sudo apt-get install raspberrypi-kernel-headers && [ -d /usr/src/linux-headers-$(uname -r) ] && echo 'kernel-headers installed' || echo 'ERROR: wrong or no kernel-headers installed: '$(ls /usr/src/)', should be '$(uname -r  | cut -d+ -f1)

//If newer headers are installed, updating kernel could be an option (at your own risk)
sudo apt-get update && sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel

//If older headers are installed, we are stuck and have to wait until the newer headers are released

3. Install GPIB

3.1 Install build-tools
sudo apt-get install build-essential texinfo texi2html libcwidget-dev tcl8.6-dev tk8.6-dev libncurses5-dev libx11-dev binutils-dev bison flex libusb-1.0-0 libusb-dev libmpfr-dev libexpat1-dev tofrodos subversion autoconf automake libtool libpython3-dev


3.2 Build & install GPIB kernel module  //was getting stuck here
sudo svn checkout svn://svn.code.sf.net/p/linux-gpib/code/trunk /usr/local/src/linux-gpib-code
cd /usr/local/src/linux-gpib-code/linux-gpib-kernel/ && sudo make
sudo make clean
sudo make install

3.3 Build & install GPIB user module
cd /usr/local/src/linux-gpib-code/linux-gpib-user/
sudo ./bootstrap
sudo ./configure
sudo make
sudo make clean
sudo make install

4. Install Agilent 82357a

4.1 Get Firmware
cd /usr/local/src/linux-gpib-code/ && sudo apt-get install fxload
&&
sudo wget [url]https://linux-gpib.sourceforge.io/firmware/gpib_firmware-2008-08-10.tar.gz[/url]
 &&
sudo tar xvzf gpib_firmware-2008-08-10.tar.gz
&&
cd /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/

4.2 Config
//adapter
sudo nano $(sudo find / -name 'gpib.conf' | grep etc) //new location since r1757 (changed from /etc/gpib.conf to $(sysconfdir)/gpib.conf)
-> board_type = "agilent_82357a"

//auto download firmware - wrong file, correct location - should use 82357a_fw.hex
//sudo cp /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/measat_releaseX1.8.hex $(sudo find / -type d -name 'agilent_82357a' | grep usb | grep -v gpib)
//corrected version:
sudo cp /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/82357a_fw.hex $(sudo find / -type d -name 'agilent_82357a' | grep usb | grep -v gpib)

//udev rules
sudo cp /usr/local/etc/udev/rules.d/* /etc/udev/rules.d/  //seems that the udev rules are copied to incorrect location - bug in gpib or raspbian? In r1730 everything is fine, in which release does it break?

// Grant user permission
// Since r1748, group gpib has to be created manually
sudo groupadd gpib
// Add user to group - for other user replace 'pi' with name of other user
sudo adduser pi gpib

5. Finish

5.1 Reboot
sudo reboot
//after reboot, all leds should be lit on the adapter (2x green, red) and finally only one green, if not there is a problem (see 6)
//after plug-in the adapter all leds should be lit (2x green, red) and finally only one green, if not there is a problem (see 6)

5.2 Test with connected equipment (optional)
ibtest
d
//device id
w
//after here is device specific, given are examples for HP/Agilent/Keysight devices (tested with 3457A/3458A)
END ALWAYS
w
ID?
r
[enter]
//prints: HP345xA
q //quit


6 Trouble-shooting

6.1 Test gpib module
lsmod | grep gpib_common
//Should give a line back with gpib_common, if not try next step

sudo modprobe gpib_common
lsmod | grep gpib_common
//should finish without error & print gpib_common, else gpib is not installed -> try 3. and watch out for errors

6.2 Test Adapter (only needed if not all leds are lit)
//Load Firmware for testing (latest point to plugin Adapter)
cd /usr/local/src/linux-gpib-code/gpib_firmware-2008-08-10/agilent_82357a/
lsusb -d 0957:0518 //output: Bus xxx Device yyy: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface

sudo fxload -t fx2 -D /dev/bus/usb/xxx/yyy -I ./measat_releaseX1.8.hex //1st FW load

lsusb -d 0957:0518 //output: Bus xxx Device zzz: ID 0957:0518 Agilent Technologies, Inc. 82357B GPIB Interface

sudo fxload -t fx2 -D /dev/bus/usb/xxx/zzz -I ./measat_releaseX1.8.hex //2nd FW load

lsusb -d 0957:0718 //output (ID changed to 0957:0718 and all leds 2x green & red on adapter are lit) : Bus xxx Device xyz: ID 0957:0718 Agilent Technologies, Inc.

lsmod | grep agilent //output (2 lines): agilent_82357a & gpib_common

6.3 Test userspace
sudo ldconfig && sudo gpib_config
//finish without error, else the configuration is not correct -> 4.2

--- End code ---

chekhov:
Hi, thanks for your experience, but let me add a few notes:

It would be good to maybe tell which issues you had, and why each 'hack' worked out.

*
--- Quote ---Add "arm_64bit=0" to ./boot/config.txt
--- End quote ---
that seems to be related with some issues with upgrading to 64-bit kernel version instead of 32-bit if I googled it right, so that's a note for the users of this board, not necessary step for everybody, and likely not for this board either unless they are going to upgrade.
*
--- Quote ---added make clean between the make and make install steps
--- End quote ---
quite illogical step I would say, we build everything and then broke everything with a big hummer. I suppose you had built artifacts from previous attempt that's why it didn't 'make' again, so if doing it right it should be "make clean && make && sudo make install"
*
--- Quote ---ignored system.map errors when installing the kernel driver
--- End quote ---
it looks like you tried to insert driver for wrong kernel or just haven't rebooted to get it match your kernel, or there might be some hidden issue with driver itself, but that's definitely not the recommended behavior
Regarding upgrade - the issue is that by just doing "apt-get install something" you won't install kernel headers for the kernel you are running right now, it will install the latest ones (that your cached pat database knows about), that's why upgrade to newest kernel first before trying all other steps makes sense.

Regarding wget argument you are right, it's just a copy-paste, and not a script that is supposed to run copy-pasted. That could be updated.

MiDi:
Updated the guide for linux-gpib 4.3.6.

e61_phil:
Thanks to mendip-defender I was also able to update the github repo. It was tested last week with a Raspberry Pi 4

electronomicon:
Hi!

I hope this is the right place to ask for some help …

I’m trying to get the setup from MiDi running on a Raspberry Pi Zero with a Beiming S82357 adapter.
I read in the forum that the adapter should be well supported, linux-gpib also lists support, albeit only from firmware version 1.20. Is there a way to check the firmware version of the adapter?

The installation works fine, but when I try to run ibtest and connect to a device, it fails:

--- Code: ---ibtest
Do you wish to open a (d)evice or an interface (b)oard?
(you probably want to open a device): d
enter primary gpib address for device you wish to open [0-30]: 1
trying to open pad = 1 on /dev/gpib0 ...
libgpib: IBOPENDEV ioctl failed
libgpib: error in is_cic()!
ibdev error

ibsta = 0x8000  < ERR >
iberr= 0
EDVR 0: OS error

ibcntl = 22
Aborted
--- End code ---

I then followed the trouble-shooting guide, where
--- Code: ---sudo ldconfig && sudo gpib_config
--- End code ---
failed, too:

--- Code: ---failed to bring board online
failed to configure board
main: Input/output error
--- End code ---

I tried uploading the Agilent 82357A driver, despite this being noted not necessary on the linux-gpib supported hardware site, as it seemed to have helped in this case.
Afterwards, gpib_config indeed ran without errors but when I tried to communicate with any device (via ibtest) I always got another error:

--- Code: ---enter a string to send to your device: *IDN?
sending string: *IDN?

gpib status is:
ibsta = 0xc100  < ERR TIMO CMPL >
iberr= 14
EBUS 14: Bus error

ibcntl = 0

--- End code ---

My devices run on addresses 1, 2 and 3. I tested the whole setup successfully with the Agilent IO suite on windows.

I'm also using a gpib_conf that user bingo600 has noted to work on this adapter:

--- Code: ---interface {
minor = 0 /* board index, minor = 0 uses /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
board_type = "agilent_82357a" /* type of interface board being used */
name = "usb_gpib" /* optional name, allows you to get a board descriptor using ibfind() */
pad = 0 /* primary address of interface             */
sad = 0 /* secondary address of interface           */
timeout = T3s /* timeout for commands */

eos = 0xa /* EOS Byte, 0xa is newline and 0xd is carriage return */
set-reos = yes /* Terminate read if EOS */
set-bin = yes /* Compare EOS 8-bit */
set-xeos = no /* Assert EOI whenever EOS byte is sent */
set-eot = yes /* Assert EOI with last byte on writes */

/* settings for boards that lack plug-n-play capability */
  /* base = 0 */    /* Base io ADDRESS                  */
      /* irq  = 0 */    /* Interrupt request level */
      /* dma  = 0 */    /* DMA channel (zero disables)      */

      master = yes /* interface board is system controller */
}

--- End code ---

I tried to get this running the whole day yesterday  |O and would be really grateful for some help.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod