CM4-DUAL-ETH-4G/5G-BASE

From Waveshare Wiki
Jump to: navigation, search
CM4-DUAL-ETH-4G/5G-BASE
CM4-DUAL-ETH-4G/5G-BASE
Compute Module 4


Dual Gigabit Ethernet 5G/4G Base Board Designed for Raspberry Pi Compute Module 4
{{{name2}}}

{{{name3}}}

{{{name4}}}

{{{name5}}}

{{{name6}}}

Overview

This is a dual Gigabit ethernet 5G/4G base board, which is designed for Raspberry Pi Compute Module 4. It is suitable for evaluating the Raspberry Pi CM4 or being integrated into end products.

Notices

  1. DO NOT hot-plug any devices except the USB and HDMI.
  2. Please check the FAN voltage before connecting the cooling fan. The BASE board supports a 12V cooling fan by default, if you want to use a 5V cooling fan, please change the FAN_VCC resistor.
  3. DO NOT connect other devices while writing CM4 via Type C interface for stable working.
  4. 5V/2.5A or higher power supply is recommended for proper working.

Specifications

CM4 SOCKET suitable for all variants of Compute Module 4
NETWORKING Dual Gigabit Ethernet RJ45
M.2 B KEY, for connecting 5G / 4G module
Nano-SIM card slot, supports standard Nano-SIM card for 5G/4G/3G/2G communication
USB USB 3.2 Gen1 × 2
PIN HEADER Raspberry Pi 40PIN GPIO header
DISPLAY MIPI DSI port (15pin 1.0mm FPC connector)
CAMERA MIPI CSI-2 port × 2 (15pin 1.0mm FPC connector)
VIDEO HDMI × 2, supports 4K 30fps output
RTC Real-time clock with a battery socket and the ability to wake Compute Module 4
STORAGRE MicroSD card socket for Compute Module 4 Lite (without eMMC) variants
FAN HEADER 5V/12V (12V by default), allows speed adjustment and measurement
POWER INPUT 5V/2.5A
DIMENSIONS 99.6 × 87.0mm

Dimensions

CM4-DUAL-ETH-4G-5G-BASE-details-size.jpg Compute Module 4 IO Board 5.png

Onboard Resources

CM4-DUAL-ETH-45G.01.jpg

Label Name Description
1 CM4 Connector Applies to all versions of Compute Module 4
2 40PIN GPIO Header Easy to connect various HAT modules
3 RJ45 Gigabit Ethernet Port Dual RJ45 Gigabit Ethernet port, support 10/100/1000M network access
ETHERNET 0: CM4 native network port
ETHERNET 1: USB expansion network port
4 HDMI Port Dual HDMI port, support dual 4K 30fps output
5 USB 3.2 Ports 2-way USB 3.2 Gen1 ports, support various USB devices
6 PWR & USB Interface 5V DC power supply interface or USB flashing interface
7 FAN Header Easy to connect to the cooling fan, support speed regulation and speed measurement
8 CAM Interface Dual MIPI CSI Camera Interface
9 4G/5G Module Status Indicator STA red light: module enable indicator
NET green light: module running status indicator
10 Dual LED Lamp Holder Red light: Raspberry Pi power indicator
Green light: Raspberry Pi working status indicator
11 BOOT Switch Button ON: Compute Module 4 boots to USB Type-C port
OFF: Compute Module 4 boots to eMMC or Micro SD card
12 DISP1 Interface MIPI DSI display interface
13 M.2 B KEY Communication module that supports access to 4G/5G or other USB channels
14 Nano-SIM Card Holder Can be connected to a standard Nano-SIM card for 4G/3G/2G Internet access
15 Micro SD Card Slot Used to insert a Micro SD card with the system to start the Compute Module 4 Lite
16 RTC Battery Connector Can be connected to CR2032 button battery
17 RTC Interrupt Pin Switch PI-RUN: RTC Trigger Interrupt CM4 Restart
GN-EN: RTC Trigger Interrupt CM4 Power Off
D4: RTC Trigger Interrupt D4 Pin
18 IO-VREF selection CM4 IO logic voltage switch 3.3V or 1.8V
19 FAN Power Supply Options You can choose 5V or 12V to drive the fan
20 RTC/FAN I2C bus selection SDA0/SCL0: shared by I2C-10 and CSI/DSI
GPIO3/2: shared by I2C-1 and 40PIN
21 System function switch BT_DIS: Bluetooth disabled, only for CM4 version with antenna
WiFi_DIS: WiFi disabled, only for CM4 version with antenna
WP_DIS: Boot mode switch, only For use without EMMC boot or SD boot
22 RTL8153 USB Gigabit LAN chip

Writing Image

Precautions

Do not plug or unplug any device while it is powered on.

PS: If you are using the system of the Bullseye branch, you need to change "apt-get" to "apt", the system of the Bullseye branch only supports Python3.

4G/5G

To work with 4G/5G, you need to connect a wireless module to the M.2 B KEY for featuring corresponding functions. M.2 B KEY only extends USB 3.0 interfaces, it doesn't support PCIe devices.
CMD-DUAL-ETH-4G5G-BASE-11.jpg
SIM card is required to work with the 4G/5G module.
If you want to disable the 4G/5G module, you can set the GPIO6 to High and enable it again by setting the GPIO6 to Low.
The module requires about 30s to enable/disable the 4G/5G modules.

Status

STA NET STATUS
ON OFF Shutdown or Stating
ON ON Searching network
ON Flash Working
OFF Flash/ON Shutting down

Before you configure the 4G/5G module, please make sure that the module is working normally.

Configure 5G Modules

Configure 4G Modules

  • Install minicom.
sudo apt-get install minicom
  • Run the minicom to configure moudules.
sudo minicom -D /dev/ttyUSB2
  • Configure the modules with the following command.
AT+CUSBPIDSWITCH=9011,1,1
  • Exit from the minicom and run the following command to assign IP for the usb0 (it may be different if you connect another USB adapter).
sudo dhclient -v usb0
  • If the network cannot connect properly, please run one of the following AT commands to change the frequency and test it again.
AT+CNBP=0x0002000000400183,0x000001E000000000,0x0000000000000021
AT+CNBP=0x0002000000400180,0x480000000000000000000000000000000000000000000042000001E200000095,0x0000000000000021

AT commands

If your 4G modules cannot connect to the network properly, please try to troubleshoot by minicom and the AT commands.

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
Common AT commands
Command Description Return
AT AT test OK
ATE ATE1 enable echo
ATE0 disable echo
OK
AT+CGMI Check manfacture OK
AT+CGMM Check module type OK
AT+CGSN Check SN OK
AT+CSUB Check module version OK
AT+CGMR Check firmware version OK
AT+IPREX Configure hardwara baud rate +IPREX:
OK
AT+CRESET Reset module OK
AT+CSQ Check signal quanlity +CSQ: 17,99
OK
AT+CPIN? Check SIM status +CPIN: READY
AT+COPS? CHeck the current supplier +COPS:
OK
AT+CREG? Check network status +CREG:
OK
AT+CPSI? Check UE information
AT+CNMP Configure network mode:
2:Automatic
13:GSM only
38:LTE only
48 : Any modes but LTE
... ....
OK

For more AT commands, please refer to: AT_Command_V2.00
You can also refer to:SIMCom

RTC FAN

  • Note 1: Please connect the cooling fan before you power the whole device, otherwise, the control chip will be damaged!
  • Note 2: Please check the voltage before you connect the cooling fan, it is default 12V.

Use Raspberry Pi system (2021-05-07-raspios-buster-armhf-full)
DO NOT use DSI and CSI when using RTC.
If you need to use it at the same time, switch the I2C to the I2C1 device (right).
CM4-DUAL-ETH-4G-5G-BASE-12.png
All programs or drivers need to be modified after switching.
The demo uses I2C10 by default (left).

If you need to use it simply or add it to your program, refer to the C and Python demo reference [click here] The following is to add the driver to the kernel.

RTC

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

Using Hwclock

  • Synchronize the system clock and the RTC.
sudo hwclock -w
  • Synchronize the hardware clock and the RTC.
sudo hwclock  -s

Note that it will be restored if the network is disabled.

  • Set hardware clock.
sudo hwclock --set --date="9/8/2021 16:45:05"
  • Check the hardware clock.
sudo hwclock -r
  • Check the version.
sudo hwclock --verbose

RTC Test

1. Download the test demo.

Open the terminal of the Raspberry Pi, and enter the following command:

sudo apt-get install p7zip-full
sudo wget https://files.waveshare.com/upload/4/42/PCF85063_code.7z
7z x PCF85063_code.7z -O./
cd PCF85063_code

2. Run the demo:

C

Execute the following commands to compile and execute the test demo:

cd c
sudo make clean
sudo make -j 8
sudo ./main

And then you can check the running result as below:

RTC PCF85063 c test.png

Python

Enter the python/example director:

cd python/example

And then run the Python demo, the demo can support python2/3.

# python2
sudo python main.py
# python3
sudo python3 main.py

The running result is as below:

RTC PCF85063 python test.png

FAN test

When powered on, the fan will spin for 1 second, then stop for 2 seconds, and then spin again. This is normal.
There is currently no official configuration method for fans, there is a third-party configuration method: https://github.com/neg2led/cm4io-fan
This method is released by a third party, not an official release, and we are not responsible for any problems!

mkdir -p ~/src
cd ~/src
git clone https://github.com/neg2led/cm4io-fan.git
cd cm4io-fan
sudo chmod 777 install.sh
sudo ./install.sh
#The following is a description of config.txt
#############################
Name: cm4io-fan
Info: Raspberry Pi Compute Module 4 IO Board fan controller
Load: dtoverlay=cm4io-fan,<param>[=<val>]
Params: minrpm RPM target for the fan when the SoC is below
                           mintemp (default 3500)
       maxrpm RPM target for the fan when the SoC is above
                           maxtemp (default 5500)
       midtemp Temperature (in millicelcius) at which the fan
                           begins to speed up (default 50000)
       midtemp_hyst Temperature delta (in millicelcius) below mintemp
                           at which the fan will drop to minrpm (default 2000)
       maxtemp Temperature (in millicelcius) at which the fan
                           will be held at maxrpm (default 70000)
       maxtemp_hyst Temperature delta (in millicelcius) below maxtemp
                           at which the fan begins to slow down (default 2000)
 #############################
Or directly refer to the following:
dtoverlay=cm4io-fan,minrpm=500,maxrpm=5000,midtemp=45000,midtemp_hyst=2000,maxtemp=50000,maxtemp_hyst=2000
The temperature is higher than 45 degrees Celsius and starts to accelerate, and the highest speed is higher than 50 degrees Celsius.

CSI DSI

CSI DSI

New Version (Bookworm)

The DSI screen is 800x480 resolution screen by default, please refer to the corresponding WIKI for other resolution screens

When using the official base board Compute Module 4 IO Board, note that the J6 jumper cap needs to be connected


DSI

#Add the following to the config.txt file:
sudo nano /boot/firmware/config.txt
#DSI0 (V1~V3)
dtoverlay=vc4-kms-dsi-7inch,dsi0
#DSI1 (V4)
dtoverlay=vc4-kms-dsi-7inch,dsi1

CSI

  • Add the following to the config.txt file:
  • sudo nano /boot/firmware/config.txt
    Mode CAM0 setup statement CAM1 setup statement
    OV9281 dtoverlay=ov9281,cam0 dtoverlay=ov9281,cam1
    IMX290/IMX327 dtoverlay=imx290,clock-frequency=37125000,cam0 dtoverlay=imx290,clock-frequency=37125000,cam1
    IMX378 dtoverlay=imx378,cam0 dtoverlay=imx378,cam1
    IMX219 dtoverlay=imx219,cam0 dtoverlay=imx219,cam1
    IMX477 dtoverlay=imx477,cam0 dtoverlay=imx477,cam1
    IMX296 dtoverlay=imx296,cam0 dtoverlay=imx296,cam1
    IMX708 dtoverlay=imx708,cam0 dtoverlay=imx708,cam1
  • Use the shortcut Ctrl+o to save the file, then press Enter
    CM4-NANO-B-CSI-03.png
  • Use the shortcut Ctrl+x to exit the editor
  • Reboot the device
    sudo reboot
  • Note:

    1. The single-port camera can only work on CAM0, that is, it is not possible to use CAM1 port alone. But you can use the CAM0 port alone, or connect the dual cameras
    2. If the device is recognized, and the startup prompt "Camera frontend has timed out!" appears, please update "sudo rpi-update"
    
    Test Camera
    1. Enter the camera detection command, and you can see that the camera has been detected
      libcamera-hello --list-cameras

      CM4-NANO-B-CSI-01.png
    2. Display the camera screen to the desktop
      libcamera-hello -t 0
    3. Take a photo
      libcamera-jpeg -o test.jpg
    4. Record a 10s video
      libcamera-vid -t 10000 -o test.h264

    Other commands
    Check if the camera is detected

    libcamera-hello --list-cameras
    

    Open the corresponding camera

    libcamera-hello  --camera 1
    libcamera-hello  --camera 0
    

    Take a photo

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


    #The new system uses dual cameras
    #Remove camera_auto_detect=1 in config.txt
    #camera_auto_detect=1
    
    #Add
    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
    
    #Take 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.
    • Connecting either HDMI port will allow output of an image, regardless of which HDMI port is used. If two HDMI screens are connected, only HDMI0 has an image output.
    • To enable two HDMI ports, remove the configuration from config.txt:
    • And then reboot it.

    Please refer to Raspberry Pi manual.

    Old System Version (Buster and Bullseye)

    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/
     #Execute (for version V1~V3)
     sudo  dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts
     #Execute (for version V4)
     sudo  dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp1-double_cam.dts
    
     Add the following to the config.txt file:
     sudo nano /boot/config.txt
     Change dtoverlay=vc4-kms-v3d to
     dtoverlay=vc4-fkms-v3d
    
     #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 
     #After execution, turn off the power and restart

    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
    


    Openwrt

    Openwrt has high customization and scalable performance. Openwrt is becoming more and more popular at present. Compared with commonly used wireless routers, OpenWrt's modifiable firmware allows us to customize router functions according to our own needs, such as single-arm routing, automatic Define routing policies, qos, etc., intranet penetration, etc.

    img

    Compiled without configuration

    Link: https://drive.google.com/file/d/1KccdLCYQ88Pcm0pp77e3k50qTOSgi_nK/view?usp=share_link


    Configured

    Link: https://drive.google.com/file/d/17THOplBPD-BZZJS9_1JpFUj3MW7_fBh0/view?usp=sharing

    Openwrt Configuration

    Note: The openWrt system will not provide any technical support if there is any problem during use, only the following tutorials and images are provided, and no other technical support other than hardware is provided. The OpenWrt image configured above supports CM4 onboard wifi and the driver of RTL8153. CM4 can be turned into a smart router.
    The following will tell you how to install Openwrt on the Raspberry Pi to realize the function of a wireless router so that the devices in the local area network can access the Internet through the wireless router, and realize the intelligent management of the local area network. The overall network topology is shown below.

    CM4-DUAL-ETH-BASE-openwrt-1.png

    After booting up correctly, log in to the system:
    The computer is connected to the ETH0 interface, and then directly ssh remote login or web page login.
    The configured system default IP is: 192.168.14.1
    The default IP of the system without configuration is: 192.168.1.1
    Account: root without password
    CM4-DUAL-ETH-BASE-openwrt-2.png
    CM4-DUAL-ETH-BASE-openwrt2.png
    If you think the network port is not enough, you can buy USB 3.2 Gen1 TO Gigabit ETH RTL8153 expansion network port, if any ETH/USB HUB HAT RTL8152 can also expand the 100M Ethernet port and support it.

    Resources

    Document

    Demo codes

    Software

    Project Resources

    This section features third - party project resources. We merely provide links and bear no responsibility for content updates or maintenance. Thank you for your understanding.


    Jeff Geerling-Homebrew routers just got a whole lot more important in the US

    FAQ

     Answer:

    a) Check if dtparam -audio -on is blocked in /boot/config.txt.
    b) Check if the /boot/dt-blob.bin file exists, if it does, please delete it.

    {{{5}}}






    Support



    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)