Open crunchyluke opened 4 years ago
This sounds more like a low level issue on the RPi. Are there any messages in dmesg? Can you recover by opening/closing the camera or is the usb connection dead?
Thanks for the reply. I'll try to reproduce the issue soon then check dmesg and use Pylon Viewer to attempt to open the camera again.
@crunchyluke any luck resolving this issue? I'm having the same issue.
Just filed one here: https://github.com/basler/pypylon/issues/381
Full error message:
"PrepareGrab failed for device '2676:ba03:2:1:2'. Error: 'UX Status: Libusb error: LIBUSB_ERROR_TIMEOUT.' : RuntimeException thrown (file 'PylonUsbStream.cpp', line 260)."
Platform details:
I receive this error after several hours of normal operation on a Raspberry Pi 4 with a daA2500-14um ("Dart") camera connected via a USB 3.0 cable to one of the USB 3.0 ports. The same intermittent issue occurs with the same application on an identical RPi4 and connected daA2500-14um pair.
Pylon version: 6.1.0
What I've tried so far to resolve:
Write 1000 to the /sys/module/usbcore/parameters/usbfs_memory_mb file at startup to assign a maximum of 1000 MB to the USB stack.
Changed DeviceLinkThroughputLimitMode to 'Off': camera.GetNodeMap().GetNode('DeviceLinkThroughputLimitMode').SetValue('Off')
Set the MaxTransferSize parameter to 4 mb: camera.GetStreamGrabberNodeMap().GetNode("MaxTransferSize").SetValue(4000000) # 4 mb MTS
Set the MaxNumBuffer parameter to 20: camera.MaxNumBuffer.SetValue(20)
Possibly relevant implementation details:
I use the USB camera in two different threads within my application (one for a constant mjpeg stream, the other for uncompressed png single images). To manage the camera object resource, I use a Lock object (from the Python threading library) to ensure that the camera is not used by both threads at the same time. Both of these threads get an image from the camera by first acquiring the Lock object, using the StartGrabbing(pylon.GrabStrategy_LatestImageOnly) call to start grabbing and camera.RetrieveResult(1500) to get the grabResult, which is then checked with a grabResult.GrabSucceeded() call. The valid grab result is then encoded into a jpeg and written to a stream (for the mjpeg stream thread) or saved to disk as a png (for the single, uncompressed image thread).
Any suggestions to help solve this issue would be very much appreciated!