• sales

    +86-0755-88291180

Raspberry Pi CM4-NANO-C User Guide

Overview

CM4-NANO-C (Raspberry Pi CM4 Ultra Mini Expansion Board Type B) is a baseboard that can be used with Raspberry Pi Compute Module 4. Although it is tiny, it can bring out the interface of Raspberry Pi Compute Module 4 with an onboard camera.

Precautions

1. DO NOT hot-plug any devices except the USB and HDMI. In particular, it is forbidden to install or remove the camera with electricity.
2. As the module does not have any protection, please do not short-circuit the power supply.
3. The USB Type-C interface can be used as a power supply or as a USB SLAVE interface to program the image.
4. In order to ensure the normal power supply of the CM4, please do not connect other devices when using the USB Type-C interface to program the image.
5. Providing 5V 2A for CM4 to ensure that it is in normal use. Otherwise, there may be problems such as automatic shutdown, frequency reduction, and so on.
6. The USB2.0, CSI, and DSI interfaces are disabled by default and need to be enabled by the user.
7. The user key is connected to GPIO21 and pulled up to GPIO_VREF by R16 (10K). When the key is not pressed, GPIO21 is pulled high by default; when the key is pressed, the level of GPIO21 will be pulled down.

Dimensions

CM4-NANO-C

Compute_Module 4


Onboard Resources

LabelNameDescription
1CM4 socketsuitable for all variants of Compute Module 4
2Micro SD card interfaceFor inserting a Micro SD card with the system, only for Lite version
340PIN GPIO interfaceEasy access to various HAT modules
4Power supply/programming interface5V/2A power supply, can also be used as eMMC programming interface
5User buttonUser can program key function, connect to GPIO21
6USB 2.0 interfacefor connecting to all kinds of USB devices
7CAM interfaceconnect with IMX219-D160
8DSIMIPI DSI display interface, connect with CM4 DSI1 interface
9DC buck circuitDC buck circuit to power 3.3V for DSI, CSI and GPIO
10MINI HDMIHDMI interface, support 4K 30fps output
11BOOTON: Switch the USB to type C interface, and enter the download mode when powered on (configured as a large-capacity disk through rpi boot)

OFF: Switch the USB to TYPE A interface, it will not enter the download when powered on (start from eMMC or SD card)

Usage Introduction

Writing Image

USB2.0

USB enable configuration

  • The USB port is disabled by default on the CM4 to save power.
  • It is recommended to directly open the config.txt file in the boot drive letter after the programming is completed, and add the following content:
dtoverlay=dwc2,dr_mode=host
  • After saving the file, start the machine according to the normal process

USB-OTG Mode

  • If you use the latest Raspberry Pi OS (image after October 30, 2021) and USB2.0 is in OTG mode by default, CM4 will report an error.
config failed, hub doesn't have any ports! (err -19)
  • However, USB can still be used. If you want to remove this error, remove otg_mode=1 in [cm4] of config.txt, and add dtoverlay=dwc2, dr_mode=host (USB cannot be recognized without adding it).


CSI and DSI

Configuration

  • Due to CSI and DSI are disabled by default, we need to load the device tree to enable, and I2C-10, I2C-11, and I2C-0, will be occupied when using the CSI camera and DSI screen.
  • Enter the following command:
sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/4/41/CM4_dt_blob.7z
7z x CM4_dt_blob.7z -O./CM4_dt_blob
sudo chmod 777 -R CM4_dt_blob
cd CM4_dt_blob/
# 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.

Enable CSI Camera

  • Make sure to connect the CSI camera and DSI screen in a power-off state, otherwise the equipment may be damaged.
  • In addition to modifying the device tree, the CSI camera also needs to be set to enable the camera function.

Old version (buster)
1. Execute the following command to enter the Raspberry Pi configuration.

sudo raspi-config

2. Choose Interfacing Options and enter.

3. Choose Camera

4.Choose to open the camera interface.

5.The system prompts as follows:

6.Back to the main interface, select Finish.

7.Reboot the system

  • Test the camera function:
 raspistill -o image.jpg
  • Test the recording function:
  raspivid -o video.h264 -t 10000
    • Where -t 10000 means recording for 10 seconds, users can adjust according to their own needs.
    • Please refer to CSI.

New version (bullseye)
1. Execute the following command to enter the Raspberry Pi configuration.

sudo raspi-config

2. Block or delete the automatic camera detection sentence.

3. Add the driver of the camera you use, here I take IMX219 as an example, and connect it to CAM0, and attach the adapter.

ModelCAM0 Set SentenceCAM1 Set Sentence
OV9281dtoverlay=ov9281,cam0dtoverlay=ov9281,cam1
IMX290/IMX327dtoverlay=imx290,clock-frequency=37125000,cam0dtoverlay=imx290,clock-frequency=37125000,cam1
IMX378dtoverlay=imx378,cam0dtoverlay=imx378,cam1
IMX219dtoverlay=imx219,cam0dtoverlay=imx219,cam1
IMX477dtoverlay=imx477,cam0dtoverlay=imx477,cam1
  • CM4-NANO- only uses CAM0, so just add a sentence "dtoverlay=imx219,cam0".

4. Ctrl+o to save the file and press Enter

5. Ctrl+x to exit the editor.
6. Reboot the Raspberry Pi.

sudo reboot

7. Enter the camera detection command, you can see that the camera has been checked by now.

libcamera-hello --list-cameras


8. Display the camera screen on the desktop.

libcamera-hello -t

7. Taking photos.

libcamera-jpeg -o test.jpg

8. Record a video of 10s.

libcamera-vid -t 10000 -o test.h264