Re: GPIB interface hangs

"marcello.carla via Linux-gpib-general" <[email protected]> Wed, 13 Aug 2025 09:13:39 +0200
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <[email protected]>
Dear Chris,

the following informations would be of help, to make clear if the 
problem is in the gpib_bitbang module or in the python wrapper:

1) What GPIB shield has been used.

2) The command used to load the gpib_bitbang module.

3) The value of the pin_map and sn7516x_used parameters (obtainable with 
"sudo cat /sys/module/gpib_bitbang/parameters/pin_map" and "sudo cat 
/sys/module/gpib_bitbang/parameters/sn7516x_used"

4) Any message from the debug system (obtainable from a dedicated window 
with "journalctl -f", to be activated before starting all other operations).

5) The result of a test of the device with the ibtest utility.

Thanks

Marcello



On 8/13/25 06:57, quips_roofing.0t--- via Linux-gpib-general wrote:
> Hi, hoping I could get some help. I’m using a pi with a GPIB shield.
>
> I can query for devices on the GPIB bus, but only once. After that a 
> reboot of the pi is required to get the bus to respond again.
>
>
>
> import gpib
>
> def select_device_with_identity(devices,desired_identity):
>     for address, identity in devices:
>         if desired_identity in identity:
>             return address, identity
>
>     return None, None  # No matching device found
>
> def query_hpib_devices():
>     # List to store device identities
>     device_identities = []
>
>     # Assuming GPIB board index 0, adjust if your board index differs
>     board_index = 0
>
>     # Loop through GPIB device addresses 0 to 30
>     for device_address in range(0, 31):
>         try:
>             # Open the device at the given address
>             device = gpib.dev(board_index, device_address)
>
>             # Set the timeout for operations (e.g., T10s for 10 seconds)
> gpib.timeout(device, gpib.T10s)
>
>             # Clear the device
> gpib.clear(device)
>
>             # Send the identification query
> gpib.write(device, "*IDN?")
>
>             # Read the response
>             response = gpib.read(device, 1024)
>
>             # If we get a response, add it to our list
>             if response:
> device_identities.append((device_address, response.strip()))
>
>             # Close the device
> gpib.close(device)
>
>         except gpib.GpibError as e:
>             # An error usually means no device at this address or a 
> communication error
>             print(f"No response from address {device_address} or an 
> error occurred: {e}")
>
>     return device_identities
>
> # Get the list of connected HPIB devices
> devices = query_hpib_devices()
>
> # Print out the list of devices
> for address, identity in devices:
>     print(f"Device at address {address}: {identity}”)
>
>
>
>
> The first run of the code finds the device on the bus as expected 
> (device 7) and returns its correct identity. The second run of the 
> code receives an error when it finds the device -
>
> No response from address 0 or an error occurred: write() error: No 
> such device (errno: 19) No response from address 1 or an error 
> occurred: write() error: No such device (errno: 19) No response from 
> address 2 or an error occurred: write() error: No such device (errno: 
> 19) No response from address 3 or an error occurred: write() error: No 
> such device (errno: 19) No response from address 4 or an error 
> occurred: write() error: No such device (errno: 19) No response from 
> address 5 or an error occurred: write() error: No such device (errno: 
> 19) No response from address 6 or an error occurred: write() error: No 
> such device (errno: 19) No response from address 7 or an error 
> occurred: read() failed: A read or write of data bytes has been 
> aborted, possibly due to a timeout or reception of a device clear 
> command. No response from address 8 or an error occurred: write() 
> error: No such device (errno: 19) No response from address 9 or an 
> error occurred: write() error: No such device (errno: 19) No response 
> from address 10 or an error occurred: write() error: No such device 
> (errno: 19) No response from address 11 or an error occurred: write() 
> error: No such device (errno: 19) No response from address 12 or an 
> error occurred: write() error: No such device (errno: 19) …..
> This will then persist until the pi is rebooted. Powercycling the GPIB 
> device has no effect.
> Glib.conf looks like -
> interface {
>         minor = 0                       /* board index, minor = 0 uses 
> /dev/gpib0, minor = 1 uses /dev/gpib1, etc. */
>         board_type = "gpib_bitbang"     /* name of the driver */
>         name = "raspi_gpio_interface"   /* optional name, allows you 
> to get a board descriptor using ibfind() */
>         pad = 0                         /* primary address of 
> interface             */
>         sad = 0                         /* secondary address of 
> interface           */
>         eos = 0x0a      /* EOS Byte, 0xa is newline and 0xd is 
> carriage return */
>         set-reos = yes  /* Terminate read if EOS */
>         set-bin = no    /* Compare EOS 8-bit */
>         set-xeos = no   /* Assert EOI whenever EOS byte is sent */
>         set-eot = yes   /* Assert EOI with last byte on writes */
>         timeout = T30s
> /* 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 */
> }
> Advice appreciated,
> Thanks,
> Chris
>
>
> _______________________________________________
> Linux-gpib-general mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/linux-gpib-general



_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general