CM4-NVME-NAS-BOX

From Waveshare Wiki
Jump to: navigation, search
CM4-NVME-NAS-BOX
CM4-NVME-NAS-BOX.jpg

ETH, USB 3.0, HDMI, PCIE
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

Overview

CM4-NVME-NAS-BOX is an all-in-one mini-computer, mainly designed but not limited to homes, small home offices, etc. Provides a simple and easy-to-use solution, no expert knowledge of networking and storage systems is required. On-board infrared, audio, and other modules.

Notes

  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.

User Guide

Click here to see how to install a NAS system

USB2.0

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

 dtoverlay=dwc2,dr_mode=host

After restarting
If you use the latest Raspberry Pi OS (image after October 30, 2021) USB2.0 is 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).
CM4 Burn EMMC 12.png

Audio

Audio interface using USB audio, support for playback and recording, stereo codec, support for headphones with microphone, headset two-in-one.
Check the USB device: lsusb

pi@CM4-NVME-NAS-BASE:~ $ lsusb 
Bus 003 Device 002: ID 0c76:161f JMTek, LLC.

Note: If the audio is not recognized, it may be that the USB2.0 function is not enabled, you need to enable USB2.0 first and then it can be recognized.

Check the playback device: aplay -l

pi@CM4-NVME-NAS-BASE:~ $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Check the recording device: arecord -l

pi@CM4-NVME-NAS-BASE:~ $ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Recorded test: sudo arecord -f S32_LE -Dplughw:1,0 | aplay -Dplughw:1,0

pi@CM4-NVME-NAS-BASE:~ $ sudo arecord  -f S32_LE  -Dplughw:1,0 | aplay -Dplughw:1,0
xcb_connection_has_error() returned true
xcb_connection_has_error() returned true
Recording WAVE 'stdin' : Signed 32 bit Little Endian, Rate 8000 Hz, Mono
Playing WAVE 'stdin' : Signed 32 bit Little Endian, Rate 8000 Hz, Mono

Note: The recording test command is not unique, users need to modify the command according to the actual device number, where the first "-Dplughw:1,0" means to record sound card 1 device 0 (arecord -l can see the corresponding sound card and device), and the second "aplay -Dplughw:1,0" means to play sound card 1 device 0 (aplay -l can see the corresponding sound card and device). (you can see the corresponding sound card and device in aplay -l).

Adjust the volume: sudo alsamixer.
CM4-NVME-NAS-BOX09.png
F6: Select sound card
Reserved pads (no soldering)
Separately (from top to bottom):

Volume +
Volume -
Playback pause

CM4-NVME-NAS-BOX11.png

PCIE

CM4-NVME-NAS-BOX12.jpg
Check the device:

pi@CM4-NVME-NAS-BASE:~ $ lspci
00:00.0 PCI bridge: Broadcom Limited Device 2711 (rev 20)
01:00.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port
02:01.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port
02:03.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port
02:05.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port
02:07.0 PCI bridge: ASMedia Technology Inc. ASM1184e PCIe Switch Port
03:00.0 USB controller: VIA Technologies, Inc. VL805 USB 3.0 Host Controller (rev 01)
04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 15)

The above is not connected to any NVME devices, if connected to NVME devices will output more corresponding devices.

Extended Gigabit Ethernet port

Two Gigabit NICs on board with ETH0 as the native NIC and ETH1 as the expansion NIC.

  • The new version of the Raspberry Pi system kernel integrated RTL8111H driver, if you can not find the network card can try to upgrade the package.
sudo apt update
sudo apt upgrade
  • If you are using a different version of the system, please install the driver.
wget https://files.waveshare.com/upload/e/ee/CM4-DUAL-ETH-MINI-Example.zip
unzip CM4-DUAL-ETH-MINI-Example.zip -d ./CM4-DUAL-ETH-MINI-Example
cd CM4-DUAL-ETH-MINI-Example/Driver/
tar vjxf r8168-8.050.03.tar.bz2
cd r8168-8.050.03
sudo ./autorun.sh
  • (Optional) If you compile your own kernel, you can choose the following options to load the driver.
Device Drivers
 > Network device support
   > Ethernet driver support
     > Realtek devices
       > Realtek 8169/8168/8101/8125 ethernet support

RTC

RTC (PCF85063a) on i2c-10, address is 0x51 (7-bit address).

sudo nano /boot/config.txt
 #Add at the end
 dtparam=i2c_vc=on
 dtoverlay=i2c-rtc,pcf85063a,i2c_csi_dsi
 #Add # before dtparam=audio=on
 #dtparam=audio=on
 #Save and exit, restart
 sudo reboot

Hwclock

Synchronize System Clock -> Hardware Clock:

sudo hwclock -w

Synchronize hardware clock -> system clock:

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

Set the hardware clock time:

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

View hardware clock:

sudo hwclock -r

Display version information:

sudo hwclock --verbose


CSI DSI

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:

wget https://files.waveshare.com/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 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
#camera_auto_detect=1

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

#Where imx219 is the camera sensor model and other sensors are supported
dtoverlay=ov5647,cam0
dtoverlay=imx219,cam0
dtoverlay=ov9281,cam0
dtoverlay=imx477,cam0
dtoverlay=imx519,cam0

#Then reboot
reboot

#Open camera
libcamera-hello -t 0
or
libcamera-hello


#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.

IR Test

Infrared receiver tube model: LFN LF0038K

Connect the GPOI18 pin
Reference Routine

Resource

Demo

Document

Schematic Diagram

Software



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 AM GMT+8 (Monday to Friday)