8MP USB Camera Corrupted Image on Arm Linux SBCs

  1. Where did you get the camera module(s)?
    uctronics.com

  2. Model number of the product(s)?
    B0196

  3. What hardware/platform were you working on?
    Three identical camera modules have been tested (all same behavior).
    Five test systems exist

  • Laptop running Ubuntu Jammy 22.04 (amd64)
  • Desktop running Ubuntu Focal 20.04 VM (amd64)
  • Jetson Nano 4GB running L4T Ubuntu 18.04 (arm64)
  • Raspberry Pi 3A+ running Rasperry Pi OS Bullseye (arm64)
  • Orange Pi 4 LTS running Armbain bullseye (arm64)
  1. Instructions you have followed. (link/manual/etc.)
    The camera is plugged in by USB cable. Various tools are then used to view the camera (cheese, ffplay, vlc, gstreamer pipeline, etc)

  2. Problems you were having?
    When used with any of the arm systems (jetson, raspberry pi, orange pi) the image appears “corrupted” (see attached images).

  3. The dmesg log from your hardware?
    Log from jetson nano (other hardware similar output, including systems where camera works)

[ 1949.577388] usb 1-2.4: new high-speed USB device number 8 using tegra-xusb
[ 1949.700457] usb 1-2.4: New USB device found, idVendor=0c45, idProduct=6366
[ 1949.700461] usb 1-2.4: New USB device strings: Mfr=2, Product=1, SerialNumber=3
[ 1949.700464] usb 1-2.4: Product: USB 2.0 Camera
[ 1949.700467] usb 1-2.4: Manufacturer: Arducam Technology Co., Ltd.
[ 1949.700469] usb 1-2.4: SerialNumber: SN0001
[ 1949.702229] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (0c45:6366)
[ 1949.717708] uvcvideo 1-2.4:1.0: Entity type for entity Extension 4 was not initialized!
[ 1949.727155] uvcvideo 1-2.4:1.0: Entity type for entity Extension 3 was not initialized!
[ 1949.736592] uvcvideo 1-2.4:1.0: Entity type for entity Processing 2 was not initialized!
[ 1949.746145] uvcvideo 1-2.4:1.0: Entity type for entity Camera 1 was not initialized!
[ 1949.755673] input: USB 2.0 Camera as /devices/70090000.xusb/usb1/1-2/1-2.4/1-2.4:1.0/input/input5
[ 1949.792056] usb 1-2.4: 3:1: cannot get freq at ep 0x84
[ 1952.041349] usb 1-2.4: usb_suspend_both: status 0
  1. Troubleshooting attempts you’ve made?
    Attempt changing all available settings using v4l2-ctrl, test multiple camera modules and multiple SBCs.

  2. What help do you need?
    Diagnosing and fixing the image corruption.

  3. Additional context / info

  • “Corruption” means there appear to be “lines” or “dots” around objects and the colors seem off (almost like a lower color depth). See attached images.
  • When the camera is connected by USB to the VM or laptop (x86) the image appears as expected (not corrupted). This works on USB3 and USB2 ports.
  • When the camera is connected by USB to any tested SBC (jetson, rpi, opi) the image appears corrupted. This happens on USB3 and USB2 ports as well as when connected to an externally powered USB hub.
  • Image capture has been tested using many tools (cheese, vlc, guvcview, ffplay, gstreamer pipeline)
  • Multiple input formats (YUY2, MJPEG) and resolutions (640x480, 800x600, and 1920x1080) have been tested. The behavior does not change with these parameters.
  • Minimal testing (plug in and use camera app) has occurred on windows systems too. These work as expected.
  • The camera firmware was updated as recommended here
  • Lower light reduces the “lines” around edges of objects, but the color still seems off.

Attached images in next posts b/c it won’t let me put them here.

Corrupted Image
corrupted

Normal Image
normal

@Androprise

I’m sorry, the colleagues who developed this camera are on leave this week due to family matters.
I will sort out these questions in a unified way and give a reply next week.
Hope to get your understanding.

No worries. I appreciate the response.

In the meantime, I have done a little more testing. Added here in case it is useful information.

  • Arm64 VM (qemu) on a laptop where the camera works natively: No issues.
  • Custom cable to power camera from laptop (camera works on this laptop) but connect data lines to jetson nano: Image still corrupted

From this I do not believe the issue has anything to do with arm (since it works in an arm VM) and it doesn’t seem to be related to power (since the camera is still broken on the jetson even when the camera is powered from a computer where the camera is known to work).

Note that the VM was running Armbian Jammy (generic / uefi aarch64 image).

@Androprise

I also tested this camera on jetson nano

Seems to be no problem.
Can you try it with python?

import cv2 as cv
import time

start1 = time.time()
cap = cv.VideoCapture(0, cv.CAP_V4L2)  
print("Video Capture Started")
cap.set(cv.CAP_PROP_FRAME_WIDTH, 640) #Set Frame width
cap.set(cv.CAP_PROP_FRAME_HEIGHT, 480) #Set Frame hight
print("FPS: "+str(cap.get(cv.CAP_PROP_FPS)))
print("width " +str(cap.get(cv.CAP_PROP_FRAME_WIDTH))+"\n"+"Height "+str(cap.get(cv.CAP_PROP_FRAME_HEIGHT)))
end1 = time.time()
print("time to turn it on "+str("%.2f"%(end1-start1))+" seconds")

while(True):
    ret, frame = cap.read()
    cv.imwrite('frame.jpg', frame)
cap.release()

Interesting. Using the exact same program, I still have the issue.

The only significant difference I see in the output is the framerate (yours is 10, mine is 30). This is a little confusing as v4l2-ctl does not list 10 FPS for either mode at 640x480

➜  ~ % v4l2-ctl --device /dev/video0 --list-formats-ext
ioctl: VIDIOC_ENUM_FMT
	Type: Video Capture

	[0]: 'MJPG' (Motion-JPEG, compressed)
		Size: Discrete 3264x2448
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 2592x1944
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 2048x1536
			Interval: Discrete 0.067s (15.000 fps)
		Size: Discrete 1920x1080
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1600x1200
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 1280x960
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 800x600
			Interval: Discrete 0.033s (30.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
	[1]: 'YUYV' (YUYV 4:2:2)
		Size: Discrete 3264x2448
			Interval: Discrete 0.500s (2.000 fps)
		Size: Discrete 2592x1944
			Interval: Discrete 0.500s (2.000 fps)
		Size: Discrete 2048x1536
			Interval: Discrete 0.500s (2.000 fps)
		Size: Discrete 1920x1080
			Interval: Discrete 0.200s (5.000 fps)
		Size: Discrete 1600x1200
			Interval: Discrete 0.200s (5.000 fps)
		Size: Discrete 1280x960
			Interval: Discrete 0.200s (5.000 fps)
		Size: Discrete 800x600
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.050s (20.000 fps)
		Size: Discrete 640x480
			Interval: Discrete 0.033s (30.000 fps)
			Interval: Discrete 0.050s (20.000 fps)

Edit: I also need to correct where these were bought from (they were bought by a student organizatoin, not by me so they used a different link than the one I gave them on uctronics.com). They purchased the cameras from Amazon (sold by uctronics) https://www.amazon.com/Arducam-Autofocus-Microphone-Computer-Raspberry/dp/B08RHTG845

@Androprise

You can use the firmware read out by my camera and burn it in for a try.

If the result is still the same, you can contact me by email ([email protected]).
I can help you with further diagnosis remotely.

Before I flash, I’d like to double check sensor model numbers.

My cameras use the IMX219 sensor (according to the product page and the label on the camera sensor itself).

The firmware you uploaded seemingly is for an IMX179 sensor (based on the file name)?

As such, I’d like to double check before I flash a seemingly mismatched firmware to ensure that no harm should come to the device as a result of this.

@Androprise

Don’t worry about the name, the new firmware is now imx219, this firmware version is a bit old.

I’ll try again now with the new firmware.

The older firmware you provided does not have the corruption issue on my jetson.

Not sure how is best to proceed from here. I can run the old firmware for now (or indefinitely if that’s the best option available). However, presumably there are more features / fixes in the newer firmware?

@Androprise

Try again with the latest firmware.

There is no difference in function, the latest firmware optimizes some details (such as viewing angle)

This firmware works as well. Thanks for all your help.

@Androprise

Glad to hear that.