Corrupted image contains part of previous frame(marked as (1)). Using ArduCam_flush doesn’t really help to prevent that. Do you think images buffers are handled correctly after ArduCam_endCaptureImage?
Sometimes before that happen, ArduCam_captureImage returns USB_CAMERA_DATA_LEN_ERROR followed by multiple USB_CAMERA_FRAME_INDEX_ERROR.
Can you help me to understand reason those errors appear?
a) USB_CAMERA_DATA_LEN_ERROR (is that transfer error? what does it mean?)
b) USB_CAMERA_FRAME_INDEX_ERROR (it appears at leas once at each start, sometimes after USB_CAMERA_DATA_LEN_ERROR multiple times)
The dmesg log from your hardware?
None
Troubleshooting attempts you’ve made?
Power cycle, check camera buffers flushing methods and try to clean pending images manually.
What help do you need?
Solve a bug (imho in SDK or board FW) or find reasonable workaround
There are indeed some design vulnerabilities in the SDK,
My suggestion is not to stop the capture thread. The capture thread is actually the thread that obtains data from the USB. If it does not process the USB data in time, it will cause problems with the data on the device.
Thanks for answer, are you planning to address design vulnerabilities in the SDK in near future?
Going back to my 2nd question. Can you help me to understand reason those errors appear?
a) USB_CAMERA_DATA_LEN_ERROR (is that transfer error? what does it mean?)
b) USB_CAMERA_FRAME_INDEX_ERROR (it appears at leas once at each start, sometimes after USB_CAMERA_DATA_LEN_ERROR multiple times)
Unfortunately, there is no clear plan, in fact it needs to be refactored as a whole.
Yes, this is a transmission error.
The data may be lost due to the failure to process the data output by the device in time.
This error means that the image frames are not continuous, and each image frame has a frame number. If it is not continuous, it will prompt this error, but you can ignore it.
The current design exposes too many things to users, and it is not easy to handle these combinations correctly.
From my point of view more extensive documentation combined with some examples are usually enough to handle such SDK. On the other hand I understand it could be more user friendly.