Hi,
We just got PiCar-X. Everything works fine, except the camera.
It seems that the camera can be detected by “libcamera”. but python program can not operate it.
We have the Raspberry Pi 4B. We tested the following:
$ Libcamera-hello
Made X/EGL preview window
[0:02:20.528840535] [1925] INFO Camera camera_manager.cpp:297 libcamera v0.0.5+83-bde9b04f
[0:02:20.593701574] [1926] INFO RPI vc4.cpp:437 Registered camera /base/soc/i2c0mux/i2c@1/ov5647@36 to Unicam device /dev/media1 and ISP device /dev/media0
[0:02:20.593934633] [1926] INFO RPI pipeline_base.cpp:1101 Using configuration file ‘/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml’
[0:02:20.596297208] [1925] INFO Camera camera.cpp:1033 configuring streams: (0) 1296x972-YUV420
[0:02:20.597644266] [1926] INFO RPI vc4.cpp:565 Sensor: /base/soc/i2c0mux/i2c@1/ov5647@36 - Selected sensor format: 1296x972-SGBRG10_1X10 - Selected unicam format: 1296x972-pGAA
$ libcamera-hello --list-cameras
Available cameras
0 : ov5647 [2592x1944] (/base/soc/i2c0mux/i2c@1/ov5647@36)
Modes: ‘SGBRG10_CSI2P’ : 640x480 [58.92 fps - (16, 0)/2560x1920 crop]
1296x972 [43.25 fps - (0, 0)/2592x1944 crop]
1920x1080 [30.62 fps - (348, 434)/1928x1080 crop]
2592x1944 [15.63 fps - (0, 0)/2592x1944 crop]
$ sudo python3 display.py
Launching villib 0.0.6 …
imshow start …
press Ctrl+C to exit
mmal: mmal_vc_component_create: failed to create component ‘vc.ril.camera’ (1:ENOMEM)
mmal: mmal_component_create_core: could not create component ‘vc.ril.camera’ (1)
Exception in thread camera_satrt:
Traceback (most recent call last):
File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 456, in _init_camera
self._camera = mo.MMALCamera()
File “/usr/lib/python3/dist-packages/picamera/mmalobj.py”, line 2279, in init
super(MMALCamera, self).init()
File “/usr/lib/python3/dist-packages/picamera/mmalobj.py”, line 631, in init
mmal_check(
File “/usr/lib/python3/dist-packages/picamera/exc.py”, line 184, in mmal_check
raise PiCameraMMALError(status, prefix)
picamera.exc.PiCameraMMALError: Failed to create MMAL component b’vc.ril.camera’: Out of memory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File “/usr/lib/python3.9/threading.py”, line 954, in _bootstrap_inner
self.run()
File “/usr/lib/python3.9/threading.py”, line 892, in run
self._target(*self._args, **self._kwargs)
File “/usr/local/lib/python3.9/dist-packages/vilib-0.0.6-py3.9.egg/vilib/vilib.py”, line 564, in camera_clone
Vilib.camera()
File “/usr/local/lib/python3.9/dist-packages/vilib-0.0.6-py3.9.egg/vilib/vilib.py”, line 570, in camera
camera = PiCamera()
File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 431, in init
self._init_camera(camera_num, stereo_mode, stereo_decimate)
File “/usr/lib/python3/dist-packages/picamera/camera.py”, line 459, in _init_camera
raise PiCameraError(
picamera.exc.PiCameraError: Camera is not enabled. Try running ‘sudo raspi-config’ and ensure that the camera has been enabled.
Part of config.txt file
Automatically load overlays for detected cameras
camera_auto_detect=1
Automatically load overlays for detected DSI displays
display_auto_detect=1
Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d
max_framebuffers=2
Disable compensation for displays with overscan
disable_overscan=1
[cm4]
Enable host mode on the 2711 built-in XHCI USB controller.
This line should be removed if the legacy DWC2 controller is required
(e.g. for USB device mode) or if USB support is not required.
otg_mode=1
[all]
[pi4]
Run as fast as firmware / board allows
arm_boost=1
[all]
dtoverlay=hifiberry-dac
dtoverlay=i2s-mmap
gpu_mem=128
Can anyone please help me resolve this issue? Thanks very much in advance.