Template: CM4-CSI-DSI

From Waveshare Wiki
Jump to: navigation, search

Configuration file

CSI and DSI interfaces are closed by default, they will use the I2C-10, I2C-11 and I2C-0.
Open a terminal and run the following commands:

wget https://www.waveshare.net/w/upload/7/75/CM4_dt_blob_Source.zip
  unzip -o CM4_dt_blob_Source.zip -d ./CM4_dt_blob_Source
  sudo chmod 777 -R CM4_dt_blob_Source
  cd CM4_dt_blob_Source/
  #If using two cameras and DSI0 execute
  sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts
  # if using two cameras and DSI1 execute
  sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp1-double_cam.dts
  #When using any DSI, HDMI1 has no image output, even if you do not connect the DSI screen, as long as the corresponding file is compiled, then HDMI1 will not output
  #If you need to restore, delete the corresponding dt-blob.bin: sudo rm -rf /boot/dt-blob.bin
  # After execution, turn off the power and restart the CM4

Recording test

Then connect the Camera and DSI/HDMI display:
1: Make sure the connection is in the power-off state
2: Connect Power
3: Wait a few seconds for the screen to start up
4: If it fails to start, check whether /boot/dt-blob.bin exists, and restart it if it exists.
5: The camera needs to run raspi-config, select Interfacing Options->Camera->Yes->Finish-Yes, reboot the system, open the enable camera, and then restart to save the changes.

Old version (Buster)

Test the Raspberry Pi camera
Check the first camera connected to the screen:

 sudo raspivid -t 0 -cs 0

Check the second camera connected to the screen:

 sudo raspivid -t 0 -cs 1

New version(Bullseye)

If using the latest Raspberry Pi OS (Bullseye):

libcamera-hello -t 0
or
libcamera-hello

#The new system uses dual cameras
#Remove camera_auto_detect=1 in config.txt
#camera_auto_detect=1

#Add to
dtoverlay=imx219,cam1
dtoverlay=imx219,cam0

#where imx219 is the camera sensor model, and there are other sensors
dtoverlay=ov5647,cam0
dtoverlay=imx219,cam0
dtoverlay=ov9281,cam0
dtoverlay=imx477,cam0

#then restart
reboot

#Other part of the command:
#Check if the camera is detected
libcamera-hello --list-cameras

#Open the corresponding camera
libcamera-hello --camera 1
libcamera-hello --camera 0

#Taking Pictures
libcamera-jpeg -o test.jpg
#You can add --camera to specify the camera

More instructions click me

  • Note: If using the DSI interface display will have an HDMI disabled, even if just compile the corresponding file without connecting the DSI screen.
  • Any connection of two HDMIs can output images, not limited to that HDMI, if two HDMI screens are connected, only HDMI0 has image output
  • If you want to enable both HDMI, delete the dt-blob.bin file with the following command:
 sudo rm -rf /boot/dt-blob.bin
  • Then reboot

Reference Raspberry Pi Manual