From Waveshare Wiki
Jump to: navigation, search







The CM4-NAS-Double-Deck is an all-in-one mini computer designed primarily for home environments or small home offices, but not limited to these scenarios. Out of the box, no expert knowledge of networking and storage systems is required.


  1. Do not unplug any device except the USB when it is charged.
  2. The Type C port can be used as a power supply or as a USB SLAVE interface to program images.
  3. In order to ensure the normal power supply of CM4, please do not connect other devices when using the Type C interface to program the image.
  4. When CM4 is in normal use, it needs to provide a 5V 2A or higher power supply for CM4. Otherwise, problems such as automatic shutdown and frequency reduction may occur.
  5. The module does not have any protection, please do not short-circuit the power supply.
  6. USB2.0 is closed by default, if you want to open it, you need to add dtoverlay=dwc2,dr_mode=host in config.txt.

Assembly Guide

NAS Usage And Installation Guide

Enable SPI Interface

Open a terminal and run the following commands:

sudo raspi-config nonint do_spi 0

Demo Usage

  • Enter the following commands to run the demo:
sudo apt-get install unzip -y
sudo chmod 777 -R CM4-NAS-Double-Deck_Demo
cd CM4-NAS-Double-Deck_Demo/RaspberryPi/example/
  • Enter the following commands in the terminal to set self-starting.
sudo nano /etc/rc.local
#Add the following statement directly in fi and exit0, be sure to add &, if you don't add it, it won't start automatically
cd /home/pi/CM4-NAS-Double-Deck_Demo/RaspberryPi/example
sudo python &
  • Operation introduction:
*Short press in shutdown state: power on
*Short press in the power-on state: turn on/off the 2-inch screen display
*Long press in the power-on state: Forced shutdown
*Short press in the power-on state: switch to another interface (in the case of running the example, otherwise invalid)
*Long/short press in shutdown state: invalid

USB 2.0

The USB port is disabled by default on the CM4 to save power. If it needs to be enabled, you need to add the following to the config.txt file:


Then reboot it.
If you use the latest Raspberry Pi OS (image after October 30, 2021), USB2.0 is the default OTG mode, and 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 (if you don't add it, USB can not be recognized).
CM4 Burn EMMC 12.png


RTC (PCF85063a) on i2c-1, the address is 0 x 51 (7-bit address).

sudo nano /boot/config.txt
#add in the end
#Add # before dtparam=audio=on
#Save, exit, and reboot  
sudo reboot


Synchronize system clock -> hardware clock.

sudo hwclock -w

Synchronize hardware clock -> system clock.

sudo hwclock -s
  #Need to close the network or close the network time, otherwise, it will be changed back.

Set the hardware clock time:

sudo hwclock --set --date="9/8/2021 16:45:05"

View the hardware clock.

sudo hwclock -r

Show version information.

sudo hwclock --verbose


  • This is a simple demo for automatically controlling the fan, which can read the CPU temperature and support auto adjustment.
  • Download the demo:
unzip -d ./CM4-NAS-Double-Deck-Example
cd CM4-NAS-Double-Deck-Example/FAN/
  • Run:
  • (Optional) Boot and auto-start,If CM4-NAS-Double-Deck_Demo is configured, comments are required, otherwise it will conflict::
sudo nano /etc/rc.local

Add the following content before the last line of 'exit 0' (.. /Please change the path to your own file):

cd /home/pi/CM4-NAS-Double-Deck-Example/FAN
sudo python &


Configure Files

CSI and DSI are disabled by default. When using the camera and DSI, three I2C devices, I2C-10, I2C-11, and I2C-0, will be occupied.
Booting is performed as follows:

  unzip -o -d ./CM4_dt_blob_Source
  sudo chmod 777 -R CM4_dt_blob_Source
  cd CM4_dt_blob_Source/
  #If you want to use two cameras and DSI0, you can execute:
  sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts
  #If you want to use two cameras and DSI1, you can 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 are not connected to the DSI screen, as long as you compile the corresponding file, then HDMI1 will have no output
  #If you need to restore, delete the corresponding dt-blob.bin: sudo rm -rf /boot/dt-blob.bin
  #Execution is complete, turn off the power and restart CM4

Record Test

Connect to the camera and the DSI display:
1. Please make sure it is connected under powering off.
2. Connect to the power.
3. The display will be booted after waiting for a few seconds.
4. If it fails to boot, check whether /boot/dt-blob.bin exists, and reboot it if it exists.

Old Version (Buster)

The camera needs to run raspi-config, select Interfacing Options->Camera->Yes->Finish-Yes, reboot the system, open enable camera, and then restart to save the changes.
Test the Raspberry Pi camera.
Check the screen of the first connected camera:

sudo raspivid -t 0 -cs 0

Check the screen of the second connected camera:

sudo raspivid -t 0 -cs 1

New Version (Bullseye)

If you use the latest Raspberry Pi OS (Bullseye):

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

#Add to

#Where imx219 is the camera sensor model and other sensors are supported

#Then reboot

#Open camera
libcamera-hello -t 0

#Other instructions:
#Check if the camera is detected
libcamera-hello --list-cameras

#Open the corresponding camera, preview for 5 seconds
libcamera-hello --camera 1
libcamera-hello --camera 0

#Taking photos
libcamera-jpeg -o test.jpg

#Shoot video
libcamera-vid -t 10000 -o test.h264

#You can add --camera to specify the camera
#-t <duration> option allows the user to choose how long the window is displayed in milliseconds

For more commands, you can click here.

  • Note: If using a DSI interface display there will be an HDMI disabled, even if just compiling the corresponding file without connecting a DSI screen.
  • Any connection between two HDMIs can output images, not limited to that HDMI. If two HDMI screens are connected, only HDMI0 has an 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
  • And then reboot it.

Please refer to Raspberry Pi manual.

Connect to the camera again:
1: Make sure to connect in the power off state.
2: Connect the power supply.
3: Wait a few seconds for the screen to boot.
4: If it cannot be started, check whether /boot/dt-blob.bin exists and if it exists, restart it again.
5: The camera needs to run raspi-config, select Interfacing Options->Camera->Yes->Finish-Yes, reboot the system, open enable camera, and then restart to save the changes.
Test photo:

raspistill -o image.jpg

Test video:

raspivid -o video.h264 -t 10000

Among them, -t 10000 means recording for 10 seconds, and users can adjust it according to their own needs.
Please refer to CSI camera.




Schematic Diagram




The battery uses an RTC CR1220 button cell.



Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)