Compute Module 4 PoE 4G Board

From Waveshare Wiki
Jump to: navigation, search
Compute Module 4 PoE 4G Board
Compute Module 4 PoE 4G





Onboard Interfaces


The Compute Module 4 PoE 4G Board is an industrial-grade IoT baseboard designed for Raspberry Pi Compute Module 4 (not included). It features communication functions including global 5G/4G/3G/2G cellular network, and PoE Ethernet. There are also various industrial isolated interfaces such as CAN, RS485, RS232, ADC, and GPIO, which make it an ideal choice for sorts of industrial IoT applications. Compared with the CM3 version, this one will provide more powerful processing performance.

Precautions for use

1: Do not plug and unplug any device except USB and HDMI when powered on
2: Confirm the fan voltage before connecting, support 5V and 12V, and connect 12V by default, if you want to switch the voltage, please modify the jumper cap of FAN_VCC
3: The Type C interface of the USB SLAVE is only used to burn the image and cannot be used for power supply.
4: In order to ensure the normal power supply of CM4, please do not connect other devices when using the Type C interface to burn the image.
5: When CM4 is in normal use, it needs to provide 12V 2A or higher power supply for it. Otherwise, there may be problems such as automatic shutdown, frequency reduction and so on.
6: The M.2 interface is only used for 4G/5G module connection, and does not support other devices such as solid state
7: USB2.0 is disabled by default, if you need to open it, you need to add dtoverlay=dwc2,dr_mode=host
8: When using the PoE function, pay attention to check whether the switch supports PoE of the 802.3af network standard.
9: When POE is required, connect the POE jumper cap to the EN position.
10: Two DISP interfaces cannot be used together by default.
11: Due to the shortage of chips, there are multiple versions of this expansion board, and the functions are not very different. If you have any questions, you can contact the after-sales service

Onboard resources


Label Name Description
1 CM4 Connector Applies to all versions of Compute Module 4
2 Power supply interface 7~36V wide voltage power supply
3 CM4 Status LED Lamp Holder Red Light: Raspberry Pi Power Indicator
Green Light: Raspberry Pi Working Status Indicator
4 M.2 Status LED Lamp Holder Red Light: Enable Indicator
Green Light: Working Status Indicator
5 User LED Which is convenient for I/O output testing or displaying program running status
6 USB TO UART interface Easy for serial debugging
7 HDMI interface Dual HDMI interface, support dual 4K 30fps output
8 USB2.0 interface Dual USB 2.0 interface, support various USB device insertion
9 RJ45 Gigabit Ethernet port Gigabit Ethernet port with PoE power supply function, support 10/100/1000M network access
10 M.2 interface Support M.2 B KEY 4G module access
11 SIM Card Slot Can be connected to a standard SIM card for 4G/3G/2G Internet access
12 RTC Battery Holder Can be connected to a CR1220 button battery to power the RTC
13 PCIe Gen 2 × 1 Interface Module that supports PCIe Gen 2 × 1 interface part
14 FAN interface Easy to connect to the cooling fan, support speed regulation and speed measurement
15 Buzzer Active buzzer DiDiDi
16 DISP Dual MIPI DSI Display Interface
17 CAM Dual MIPI CSI camera interface
18 Isolated GPIO The device can be controlled or detected through GPIO
19 Isolated I2C Device can be controlled or read via I2C
20 Isolation ADC ADC Differential Input
21 Isolated CAN interface Communicate via CAN interface
22 Isolated RS485 interface Communicate via RS485 interface
23 Isolated RS232 interface Communicate via RS232 interface
24 Micro SD card interface (rear) Used to insert a Micro SD card with the system to start the Compute Module 4 Lite
25 USB Type-C burning interface (back) Compute Module 4 eMMC version can burn the system image through this interface


Compute Module 4 PoE 4G Board


Compute_Module 4 core board
Compute Module 4 IO Board 5.png


Do not plug or unplug any device while it is powered on
All of the following are tested on Raspberry Pi OS, no other systems are supported

Writing Image


The USB interfaces are default disabled in CM4, you need to enable it by adding the following lines:the config.txt


It will take effect after restart

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

Preparation before use

Demo Download

Open the Raspberry Pi terminal and execute the following commands:

sudo apt-get install p7zip-full
sudo wget
7z x Compute_Module_4_PoE_4G_Board_Code.7z -O./Compute_Module_4_PoE_4G_Board_Code
sudo chmod 777 -R Compute_Module_4_PoE_4G_Board_Code
cd Compute_Module_4_PoE_4G_Board_Code

Installing Libraries

All libraries are installed according to your needs, just install the one you need to use, you don't have to install all of them
If you just test the function, you can directly use the C program without installing any library. Our C program does not need to install any library by default.
With the update of each version, there may be some software incompatibilities, or running an error, if this problem occurs, you can feedback to us

  • Install BCM2835, open Raspberry Pi terminal, and run the following command ( not recommended)
#If you have any questions, please visit
#Any other problems can be reported in the link above, please do not contact the author directly
tar zxvf bcm2835-1.68.tar.gz
cd bcm2835-1.68/
sudo ./configure
sudo make
sudo make check
sudo make install
  • install wiringpi
#WiringPi does not officially support CM4, but you can install the unofficial version, because this version is not the official version
#This version is only for CM4
#Any other problems can be reported on github, please do not contact the author directly
git clone
cd WiringPi/
#Execute gpio -v and the version number is 2.6.
  • Install Python function library
sudo apt-get update
sudo apt-get install python-pip
sudo apt-get install python-pil
sudo apt-get install python-numpy
sudo pip install RPi.GPIO
sudo pip install spidev
sudo pip2 install python-can
sudo apt-get update
sudo apt-get install python3-pip
sudo apt-get install python3-pil
sudo apt-get install python3-numpy
sudo pip3 install RPi.GPIO
sudo pip3 install spidev
sudo pip3 install python-can

Open I2C interface

  • Execute in terminal:
sudo raspi-config
#Select Interfacing Options -> I2C ->yes to start the i2C kernel driver


  • then restart the raspberry pi
sudo reboot


The UART is connected to CM4 by default, and is connected to the GPIO14 (BCM) and GPIO15 (BCM) pins of CM4
When starting serial debugging, you can directly connect to the computer through this interface to log in to the CM4
Compute Module 4 PoE 4G Board 6.png
You can also supply power through this interface, but the default is not able to supply power. If you need to supply power through this interface, please connect the resistor (0R) on the interface.



The buzzer is connected to GPIO22(BCM 22), low active.

Compute Module 4 PoE 4G Board 4.png


Two LEDs are integrated for users, the green one is connected to GPIO20(BCM)and the red one is connected to GPIO21(BCM), low active.

Compute Module 4 PoE 4G Board 5.png

【expected results】

Two user LEDs flash alternately
LED changes once, buzzer sounds once

【Python examples】

cd LED_BUZZER/python/
sudo python

【C examples】

make clean
sudo make
sudo ./main


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 USB2.0 interfaces, it doesn't support PCIE devices.
Compute Module 4 PoE 4G Board 3.png
SIM card is required to work with the 4G/5G module
This carrier board supports the 4G module by default, if you use it with 5G modules, some of the 5G functions are not supported.
If you use a 5G module, please check the SIM8200EA-M2_5G HAT wiki about how to set up 5G.
It takes a certain amount of time (about 30 seconds) to close or open the mold
In the downloaded routine there is an M_2_PWR script that can be executed

sudo ./M_2_PWR 0
#Open the mod
sudo ./M_2_PWR 1
#Close the mod

Open the mod
The 5G module is not controlled by the enable pin

SIM7600 M.2 module

Status of M.2 indicators:

STA NET Status
On Off Off or starting
Long light Long light Looking for network
Steady on Blinking Connected and working fine
Off Blinking/Solid Shutting down

Before you configure the SIM7600 module, please make sure that the module is started normally.

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
# Enter the following commands:
#return OK
#Then wait for the network card to restart
#This command only needs to be set once, the next time it is powered on, it will be in this mode by default
#If the USB0 network card cannot be obtained, execute:
sudo dhclient -v usb0

About RNIDS networking, please refer to Raspberry Pi networked via RNDIS RNIDS Networking method
With the operations above, a USB0 port will be recognized.(if you don't have other USB network card connected)
If you use an IoT card, such as a mobile IoT card, to successfully register the network; but the dial-up Internet connection fails and cannot be pinged, you can try to use one of the following AT commands to select the optimal frequency band:


AT Commands

If the network cannot work, plaese check module with 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
AT+CGMI Check manfacture OK
AT+CGMM Check module type OK
AT+CSUB Check module version OK
AT+CGMR Check firmware version OK
AT+IPREX Configure hardwara baud rate +IPREX:
AT+CRESET Reset module OK
AT+CSQ Check signal quanlity +CSQ: 17,99
AT+CPIN? Check SIM status +CPIN: READY
AT+COPS? CHeck the current supplier +COPS:
AT+CREG? Check network status +CREG:
AT+CPSI? Check UE information
AT+CNMP Configure network mode:
13:GSM only
38:LTE only
48 : Any modes but LTE
... ....

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


The PCIe interface is PCIe 2.0 X1, the maximum speed is 500Mb/s
Support most PCIE x1 cards, many PCIEx1 device cards on the market, the default Raspberry Pi system is not supported, because the Raspberry Pi Linux does not add drivers.
Please check your PCIe device before you used Supported device testing
Raspberry Kernel compiling

Isolation GPIO/I2C

Isolation output pins are GPIO17 (BCM) and GPIO27(BCM)
Isolation input pins GPIO23 (BCM) and GPIO24(BCM)
Compute Module 4 PoE 4G Board 8.png

Configure the logic voltage of Isolation IO
Compute Module 4 PoE 4G Board 10.pngCompute Module 4 PoE 4G Board 9.png

Isolation I2C pins are GPIO2/3(BCM),I2C bus is I2C1,
Compute Module 4 PoE 4G Board 7.png

【Expected result】

The two OUT pins troggle in order
Read the values of two IN pins

【python example】

cd IO/python
sudo python

【C example】

cd IO/c
make clean
sudo make
sudo ./main

Isolation ADC

The isolation ADC is mounted in isolation I2C with 0x48 address
I2C is default disabled, please refer to #Enable I2C to enable the I2C interface.


 cd ADC/c/
 sudo ./main 


 cd ADC/python/
 sudo python examples/
  • Run the commands above to run the example

Expected result

Output voltage vlaue

Note: the ADC chip used is ADS1113, its reference voltage is 2.048V, the range of differential input, Input voltage range: ±2.048V


The CAN is diabled by default, you need to modify the config.txt file for enabling it.

 #Open and edit config.txt
 sudo nano /boot/config.txt
 #Add the following line to the file and save
 #reboot Raspberry Pi

After rebooting, run the following command:

 dmesg | grep spi0

Compute Module 4 PoE 4G Board 1.png
Run the following command:

sudo ip link set can0 up type can bitrate 1000000
sudo ifconfig can0 txqueuelen 65536

Compute Module 4 PoE 4G Board 2.png
If the device can0 is recognized, it means that the driver was installed successfully


Install can-utils:

 sudo apt-get install can-utils

Receive data

 candump can0

Send data

 cansend can0 000#
 # is data sent
 #If you need to transmit more dta, you can also extend the data just like this:
 # cansend can0 000#


【Python examples】

  • Go into the directorty of python example:
  • Open a terminal as receiver and run the
sudo python
  • Open another terminal as sender and run the
sudo python

The examples provided is absed on python, please make sure that you have installed the python-can library.
Create a CAN device before you send data,because the front only enables the MCP2515 core

os.system('sudo ip link set can0 type can bitrate 100000')
os.system('sudo ifconfig can0 up')
  • Step 1: Connect to the CAN bus
can0 = can.interface.Bus(channel = 'can0', bustyp = 'socketcan_ctypes')
  • Step 2: Create information
msg = can.Message(arbitration_id=0x123, data=[0, 1, 2, 3, 4, 5, 6, 7], extended_id=False)
  • Step 3: Send message


  • Close the CAN device finally
os.system('sudo ifconfig can0 down')
  • Receive data:
msg = can0.recv(10.0)

recv() defines the timeout
for more details, please refer to

【C examples】

  • Blocking receive, open the terminal of Raspberry Pi and run the following commands:
cd CAN/c/receive/
make clean
sudo make
sudo ./can_receive
  • Send data, open a terminal of Raspberry Pi and run the following commands:
cd CAN/c/receive/
make clean
sudo make
sudo ./can_send


The interface is closed by default, you can modify the config.txt to enable it.

sudo nano /boot/config.txt

Add the following lines to the config.txt file:


Reboot the Raspbery Pi and check if the ports are recognized.

 ls /dev/ttyAMA*

RS232 interfaces use the GPIO5/GPIO4(BCM4/5), recognized as ttyAMA1
RS485 interfaces use the GPIO13/GPIO12(BCM13/12),recognzied as ttyAMA2


Install minicom and test it with the minicom

 sudo apt-get install minicom
 # RS232
 sudo minicom -D /dev/ttyAMA1
 sudo minicom -D /dev/ttyAMA2


  • Note:Please first connect the FAN and then the power, otherwise you may damage the controller of fan!
  • Note: Please make sure the operation voltage of the cooling fan is the same as the carrier board.

Note that if you want to use the RTC function, please first disable the DSI and CSI.
If you want to use them at the same time, please change the I2C to I2C1 (the right)
Compute Module 4 PoE 4G Board 11.png
You need to modify the codes and driver after changing.
The demo codes use I2C10 by default (the left)

If you need simple use, or need to add to your program instead of the kernel, see C and Python routines.[CM4 RTC FAN]


Open the terminal and modify the config.txt file

 sudo nano /boot/config.txt

Add the following lines to the file and modify the audio setting

 #Add the lines to the end of file
 #remove the setting dtparam=audio=on by adding the # to the front of the line

Save and reboot the Raspberry Pi

 sudo reboot


Synchronize system clock -> hardware clock

 sudo hwclock -w

Synchronize hardware clock -> system clock

sudo hwclock  -s

Note that you need to disable the network synchronization function, otherwise the time will be changed according to network time.

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

Cooling fan

When powered on, the fan will spin for 1 second, then stop for 2 seconds, and then spin again, this is a normal phenomenon
There is currently no official configuration method for fans, there is a third-party configuration method:
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
 cd cm4io-fan
 sudo chmod 777
 sudo  ./

The device tree overlay has a few options, here's the equivalent of a /boot/overlays/README info section:

 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)

For examples, speed up the fan if the temperature is higher than 45°C and set the it to maximum value if the temperate is higher than 50°C:



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:

  unzip -o -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 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

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

#Add to

#where imx219 is the camera sensor model, and there are other sensors

#then restart

#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





3D Drawing


If you require technical support, please go to the Support page and open a tickets.