Open rrrossi opened 1 year ago
Thanks for the report. Could you also attach the wireshark capture of ./tests/arv-acquisition-test ? Preferably with the console output obtained with ARV_DEBUG=all.
I also have an update: Acquisition consistently does not work also on Windows. However, results of arv-test-0.8 are slightly different: After each stream-thread> Start async USB3Vision stream thread on Linux I get stream> Failed to enable stream (USB3Vision write_memory error (si-registers-inconsistent)) on Windows I do not get the message, but all the tests fail anyway.
The problem lies in the payload_size computation, which is not aligned currently.
504 13.381753 4.6.1 host U3V 80 < WRITEMEM_ACK U3V_STATUS_SI_PAYLOAD_SIZE_NOT_ALIGNED[SI_Payload_Transfer_Size]
The relevant code is here: https://github.com/AravisProject/aravis/blob/ea0316d070929f19629a722e84a9153591b75490/src/arvuvstream.c#L811C3-L830C24
I will try to have a look soon, but meanwhile you may want to fix the issue :)
A source of inspiration is the usb3vision code from NI here: https://github.com/ni/usb3vision/blob/a09d2150cb824d7a2f6085b00819e815b910a9c8/u3v_stream.c#L331-L450
One step forward, but help needed. According to my interpretation of the links you provided, I came out with this patch. arvuvstream.c.diff.gz
diff --git a/src/arvuvstream.c b/src/arvuvstream.c
index d8f3b4b3..d2cfecb2 100644
--- a/src/arvuvstream.c
+++ b/src/arvuvstream.c
@@ -824,10 +824,13 @@ arv_uv_stream_start_thread (ArvStream *stream)
si_trailer_size = align (si_req_trailer_size, alignment);
}
- si_payload_size = MIN(si_req_payload_size , aligned_maximum_transfer_size);
- si_payload_count= si_req_payload_size / si_payload_size;
- si_transfer1_size = align(si_req_payload_size % si_payload_size, alignment);
- si_transfer2_size = 0;
+ guint64 image_bytes_left = si_req_payload_size;
+ si_payload_size = MIN(si_req_payload_size , aligned_maximum_transfer_size) / alignment * alignment;
+ si_payload_count = si_req_payload_size / si_payload_size;
+ image_bytes_left -= si_payload_count * si_payload_size;
+ si_transfer1_size = align(image_bytes_left, alignment);
+ image_bytes_left -= si_transfer1_size;
+ si_transfer2_size = align(image_bytes_left, alignment);
arv_device_write_memory (device, priv->sirm_address + ARV_SIRM_MAX_LEADER_SIZE,
sizeof (si_leader_size), &si_leader_size, NULL);
The idea under the patch is:
si_req_payload_size should be the image data, that can be very big. si_payload_size should be the payload supported by each USB transfer, and have to be a multiple of alignment, and can't be bigger than aligned_maximum_transfer_size. si_payload_count is the number of full packets transferred on the USB remaining bytes are transferred with si_transfer1_size and si_transfer2_size.
Now
arv-test-0.8 -d all
pass successfully the acquisition tests, and stop with an error while checking chunks (but this is a different - probably similar - problem.
./tests/arv-acquisition-test
succeed too.
./tests/arv-viewer-0.8 -d viewer:4
display only few frames. Most of the received frames are discarded. The messages are:
[12:47:27.757] 🅳 viewer> pop buffer (-1,1)
[12:47:27.757] 🅳 viewer> push discarded buffer: status=0
(status is the status of the new buffer)
removing the condition
n_input_buffers + n_output_buffers > 0) {
at line 439 of arvviewer.c, frames seems to be correctly shown, but this is clearly not the solution of the problem!
bug description: The program arv-viewer-0.8 recognize the Allied Vision ALVIUM 1800 U-052m camera, and can open it, however no frame is acquired. The program arv-test-0.8 with the option -d all shows the following error:
stream> Failed to enable stream (USB3Vision write_memory error (si-registers-inconsistent))
Steps to reproduce the behavior:
Connect the camera to the USB, start the arv-viewer-0.8, select the camera, start video acquisition.
or
arv-camera-test-0.8 -d all
Expected behavior: No error in arv-camera-test-0.8 Video acquisition in arv-viewer-0.8
Camera description:
Platform description:
After short discussion in the Forum, made a wireshark dump of the traffic on the USB bus when performing acquisition with a simple demo program. The demo program simply enumerates the cameras, open the first (and only) one, and then start acquisition. Frame rate was set very low, so that only 3 frames are acquired.
Attached is the USB dump
AV-1800U-052m-dump.pcapng.gz