pypylon icon indicating copy to clipboard operation
pypylon copied to clipboard

Failing to attach camera when using InstantCameraArray instead of InstantCamera

Open djalusic opened this issue 4 years ago • 3 comments

Prior to this change, I had two cameras for which I used pylon.InstantCamera classes. Once I refactored so as to use pylon.InstantCameraArray, the cameras failed to attach, exception

_genicam.RuntimeException: Failed to open device '2676:ba03:4:1:2' for XML file download. Error: 'Failed to read the first register (maximum device response time). This can be caused by problems with the USB hardware used, i.e., the USB host controller and its corresponding driver  : RuntimeException thrown (file 'PylonUsbTL.cpp', line 484)

occured while calling

def _attach_devices(self):
    tl_factory = pylon.TlFactory.GetInstance()
    for i, cam in enumerate(self.cameras):
        logging.info(f"Attaching {self.device_info_list[i].GetFriendlyName()} to camera array at index {i}.")
        cam.Attach(tl_factory.CreateDevice(self.device_info_list[i]))  # here error occured
        cam.SetCameraContext(i)

After rebooting the device, the pylon.InstantCameraArray was initialized successfully. Since rebooting the device is not something I would want to do when this error happens, and also I don't know whether it will happen again and when, are there any alternative solutions?

System information:

OS: Mendel GNU/Linux 5 (Eagle) aarch64
Host: Freescale i.MX8MQ Phanbell
Kernel: 4.14.98-imx
Memory: 483MiB / 985MiB

lsusb result:

Bus 002 Device 002: ID 2676:ba03 Basler AG
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 002: ID 2676:ba03 Basler AG
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

This worked fine on the same system, but different USB input:

Bus 002 Device 004: ID 2676:ba03 Basler AG
Bus 002 Device 003: ID 2676:ba03 Basler AG
Bus 002 Device 002: ID 05e3:0626 Genesys Logic, Inc.
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 05e3:0610 Genesys Logic, Inc. 4-port hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

EDIT: device_info_list is a list of pylon.DeviceInfo objects

djalusic avatar Jan 18 '22 16:01 djalusic

Would you post the serial numbers of the cameras, please?

SMA2016a avatar Jan 20 '22 16:01 SMA2016a

The serial numbers are: 2823671257, 2823671269, 2823670490, 2823671265.

djalusic avatar Jan 20 '22 16:01 djalusic

it sounds power is unstable because of multiple camera setup or cable length. It is wort different USB cables.

you can also try to restart the camera with following tool

sudo usb_modeswitch -v 0x2676 -p 0xba02 --reset-usb

Let me know if after restarting the camera if it can be opened successfully.

SMA2016a avatar Jan 22 '22 09:01 SMA2016a