• sales

    +86-0755-88291180

Raspberry Pi CM4-IO-WIRELESS-BASE-B User Guide

Resource

Datasheet

Schematic

3D Drawing

Program

Software

Overview

Based on Raspberry Pi CM4, this is an industrial expansion module with a UPS module, which features common interfaces such as Gigabit Ethernet, HDMI, USB, and GPIO, allowing additional 4G / 5G wireless communication modules to be connected via the M.2 or Mini-PCIe socket. There are also industrial interfaces/resources including RS485, CAN, and RTC. Combined with the industrial rail-mount protection case, the module is an ideal choice for building IoT gateway, 4G/5G router, IoT data acquisition, or even the PLC device in the industrial automatic control system, and more.

Note

1: Do not unplug devices other than USB and HDMI when powered on.
2: Confirm the fan voltage before connecting, support 5V and 12V by default connect 12V, switch please modify the FAN_VCC resistance. 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: The module needs to be powered with 5V 2.5A /12V 1A or higher. Otherwise, there may be problems with automatic shutdown, degradation, etc. 5: The first time the battery is connected, there may be no power output, you need to press the BOOT activation button on the UPS module or charge the battery protection chip to activate the power output, the UPS module power switch needs to be set to the OFF position, the CM4 base plate switch is set to ON, ready to use. 6: The USB2.0 interface is disabled by default, you should add line dtoverlay=dwc2,dr_mode=host to the /boot/config.txt file to enable it.
7: When using UPS alone, the circuit should not exceed 2.5A, long working hours in the 2.5A state will heat up, pay attention to heat dissipation.
8. The external power supply must be greater than the overall system power, otherwise there is not enough current to charge the battery for a long time, and the battery power is getting low until shutdown.
9. When the system load is large and the battery voltage is low, there may be a lack of battery current and causing the system to constantly restart.
10: The battery is relatively strong, disassembly needs to be paired with tools (screwdriver), do not use a screwdriver to pry the battery positive pole easily leads to a short circuit, to pry the battery negative pole.

SAFETY CAUTIONS

  • Li-ion and Li-po batteries are quite unstable. They may cause fire, personal injury, or property damage if they're not properly recharged or used.
  • Do not reversely connect the polarities when recharging or discharging the battery. Do not use an inferior charger/charging panel to recharge the battery.
  • Do not mix use old batteries with new ones, avoid using batteries of different brands.
  • When buying a Lithium battery, should always make sure the battery specification is compatible with the expansion board.
  • Choose batteries from the formal manufacturer, and ensure the batteries will work stably and safely by aging test.
  • Lithium batteries have limited cycle life, they will also deteriorate as time goes by.
  • Should be replaced with new ones when the batteries reach their max cycle life, or work over two years, whichever comes first.
  • Should be placed carefully and properly, keep it away from inflammable and explosive articles, away from children, and avoid any safety accident caused by careless storage.

Dimensions

CM4-IO-WIRELESS-BASE-B
CM4-IO-WIRELESS-BASE-B01.jpg
Compute_Module 4
Compute Module 4 IO Board 5.png

Onboard Resources

CM4-IO-WIRELESS-BASE-B02.jpg

NO.NameDescription
1CM4 socketsuitable for all variants of Compute Module 4
2HDMI connectorsupports 4K 30fps output
3USB 2.0 ports3x USB 2.0, for connecting sorts of USB devices
4RJ45 Gigabit Ethernet10/100/1000M compatible
5DC power supply7 ~ 36V DC input
6CM4 status indicatorPWR (Red): Raspberry Pi power indicator
ACT (Green): Raspberry Pi operating status indicator
74G/5G module status indicatorM.2 PWR (Red): module enable indicator
M.2 NET (Green): module operating status indicator
8PWR & USB5V DC power supply or USB programming port
9M.2 B KEYsupports 4G/5G modules with M.2 B KEY connector, or other communication modules using USB channel
10Nano-SIM ard slotsupports standard Nano-SIM card for 5G/4G/3G/2G communication
11BOOT selectionON: CM4 will be booted from USB-C interface
OFF: CM4 will be booted from eMMC or TF card
12UPS module ON/OFFON: CM4 and the base board will be powered by UPS module
OFF: Turn off the UPS power supply to CM4 and base board
13DC power supply7 ~ 36V DC input
14Dual non-isolated RS4852x RS485, with 600W lightningproof, anti-surge, and 15KV ESD protection (reserved 120R optional balancing resistor jumper)
15Non-isolated CANESD protection and transient spike voltage protection (reserved 120R optional balancing resistor jumper)
16Micro SD card slotfor connecting a TF card with pre-burnt image (Lite variant ONLY)
17FAN headerfor connecting cooling fan, allows speed adjustment and measurement
18CAMMIPI CSI camera port, 15Pin 1mm pitch
19RTC battery holdersupports CR1220 button cell
20M.2 VCC selectionselect 3.3V or 4.2V power supply
21RTC interruption configurationPI-RUN: CM4 will reboot on RTC interruption
GL-EN: CM4 power down on RTC interruption
D17: D17 pin is triggered on RTC interruption (default)
22IO-VREF selectionset the CM4 IO logic level as 3.3V (default) or 1.8V
23FAN power supply selectionselect 12V (default) or 5V power to drive the fan
24System function configurationBT_DIS: Bluetooth disabled, for CM4 with antenna variant ONLY
WiFi_DIS: WiFi disabled, for CM4 with antenna variant ONLY
WP_DIS: boot mode switch, ONLY be used when NOT booted from eMMC or SD card
25RTC/FAN I2C bus selectionSDA0/SCL0: I2C-10 is shared with CSI/DSI (default)
GPIO3/2: I2C-1 is shared with GPIO header
26Partial GPIO headerincluding 1x I2C, 2x GPIO pins, and power supply
27UPS Module Mini headerAdopts 10440 3.7V Lithium battery

Precautions

Prohibit unplugging any equipment while powered.

Writing Image

RS485

The default is off, if you want to turn it on, you need to add the following to config.txt:

sudo nano /boot/config.txt
dtoverlay=uart3
dtoverlay=uart5

The device numbers are:

/dev/ttyAMA1 
/dev/ttyAMA2

CAN

Close by default, if you want to open it, you need to add the following content in config.txt:

# Open and edit config.txt
sudo nano /boot/config.txt
#Add the following
dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
#reboot
reboot

Execute after rebooting:

dmesg | grep spi0

Compute Module 4 PoE 4G Board 1.png

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

CM4-IO-WIRELESS-BASE-B FAQ11.png
The can0 device number appears meaning drive successfully.

Test

Install can-utils:

sudo apt-get install can-utils

Receive data:

candump can0

Send data:

cansend can0 000#11.22.33.44
#Where 11.22.33.44 is the data
#If you need to send additional data you can use the Continue to add for example
# cansend can0 000#11.22.33.04.70
#English and Chinese are not allowed, and two codes are added in one format.

M.2 B KEY

On-board M.2 B KEY with internal PCIE, USB2.0, GPIO, I2C, SPI interfaces.
The default can only be connected to
SIM7600G-H-M.2
SIM8202G-M2
SIM8200EA-M2
M.2 B KEY interface modules, etc.
SSD supporting NVME 2242 with M.2 B KEY interface.
CM4-IO-WIRELESS-BASE-B 09.png

4G/5G

The board itself does not support 4G/5G, you need to access the module through the M.2 B KEY interface, M.2 B KEY only USB2.0 channel.
CM4-IO-WIRELESS-BASE-B 10.png
Connect the 4G/5G module and insert the SIM card afterward.
If you need to turn off the 4G/5G module, you can use GPIO6 (BCM code 6) control, GPIO6 output a high level to turn off the module, and GPIO6 output a low level to turn on the module.
It takes some time (about 30 seconds) to turn off or turn on the module if the antenna is not connected or the SIM card is not connected before turning on the module.
If the module can not be turned on, it may be GPIO6 pin is pulled high, please use the following command to pull the GPIO6 pin low to turn it on:

echo Exporting pin 6
echo 6 > /sys/class/gpio/export
echo Setting direction to out.
echo out > /sys/class/gpio/gpio6/direction
echo Setting pin 0

M.2 4G/5G NIC

M.2 status indicator:

STANETStatus
Always onOffShutting down or turning on
Always onAlways onSearching the web
Always onFlashNetworked and working normally
OffFlash/Always onShutting down

Make sure the module is powered on before configuration.
For 5G, you can refer to [5G Configuration]

4G Configuration

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
# Enter the following command:
AT+CUSBPIDSWITCH=9011,1,1
#return OK and you're done
#Then wait for the card to reboot
#This command only needs to be set once, the next power-up will default in this mode
#If you can't get the USB0 NIC to execute.
sudo dhclient -v usb0
  • For RNDIS dial-up Internet access, please refer to RNDIS Dial-Up.
  • USB0 NIC will be recognized after normal execution above (if you don't connect other USB NICs).
  • If you use an IoT card, such as a mobile IoT card, and successfully register the network; however, the dial-up Internet access fails to ping through, you can try to select the optimal band with one of the following AT commands:
AT+CNBP=0x0002000000400183,0x000001E000000000,0x0000000000000021
AT+CNBP=0x0002000000400180,0x480000000000000000000000000000000000000000000042000001E200000095,0x0000000000000021

AT Command

If you cannot connect to the network, you can check the status by AT commands:

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2

Common AT Commands

The following AT commands are for 4G/5G modules:

CommandDescriptionReturn Value
ATAT Test CommadsOK
ATEATE1 sets echo

ATE0 turns off echo|| OK

AT+CGMIInquire about module manufacturersOK
AT+CGMMInquire about module modelOK
AT+CGSNInquire about product serial numberOK
AT+CSUBCheck module version and chipOK
AT+CGMRCheck the firmware version serial numberOK
AT+IPREXSet the module hardware serial port baud rate+IPREX:
OK
AT+CRESETRetset moduleOK
AT+CSQNetwork signal quality query, return signal value+CSQ: 17,99
OK
AT+CPIN?Query SIM card status, return READY, means SIM card can be recognized normally+CPIN: READY
AT+COPS?Query the current operator, the operator information will be returned after normal networking+COPS:
OK
AT+CREG?Check network registration status+CREG:
OK
AT+CPSI?Query UE system information
AT+CNMPNetwork mode selection command:
2: Automatic
13:GSM only
38: LTE only
48: Any modes but LTE
... ....
OK

For more AT commands, you can refer to SIM7500 SIM7600 Series AT Command Manual V2.00.pdf.
For more documents, you can refer to SIMCom.

RTC FAN

  • Note: Please connect the fan before powering on the expansion board and then finish the test, please do not connect the fan after the expansion board has been powered on, that is, the fan control chip has been powered on, otherwise the chip will be burned!
  • Caution: Please confirm the fan voltage and the actually connected fan power supply before connecting.

Use the Raspberry Pi system(2021-05-07-raspios-buster-armhf-full )
Note: Do not use DSI and CSI when using RTC.
If simultaneous use is required, switch I2C to the I2C1 device (right).
CM4-DUAL-ETH-4G-5G-BASE-12.png
All demos or drivers need to be modified after switching.
Demos adopt I2C10 (left) by default.

For simple use, or to add to your program, refer to the C and Python references. Click here to see.
Here's how 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 # sign in front of dtparam=audio=on
#dtparam=audio=on
#Save to exit and reboot
sudo reboot

Hwclock Simple Use

Synchronize system clock -> Hardware clock.

sudo hwclock -w

Synchronize the hardware clock -> system clock.

sudo hwclock -s
# Need to turn off the network, or turn off the network pair time, the responsible will be changed back

To set the hardware clock time:

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

To view the hardware clock:

sudo hwclock -r

Show version information:

sudo hwclock --verbose

Fan

When the power is on, the fan will turn for 1 second, then stop for 2 seconds, then turn again, this is a normal phenomenon.
Fan currently has no official configuration method, there is a third-party configuration method: https://github.com/neg2led/cm4io-fan
This method is a third-party release, not the official release, any problems, not responsible!

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 the 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 refer directly to the following:
dtoverlay=cm4io-fan,minrpm=500,maxrpm=5000,midtemp=45000,midtemp_hyst=2000,maxtemp=50000,maxtemp_hyst=2000
Temperature above 45 degrees Celsius starts to accelerate, above 50 degrees Celsius maximum speed.

If there is a failure to compile properly, you can click here.

CSI DSI

CSI and DSI are off by default when using the camera and DSI will occupy I2C-10, I2C-11, and I2C-0.
The DSI interface of CM4-DUAL-ETH-4G/5G-BASE is the DSI1 interface.
The power-on execution is as follows:

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 you use two cameras and DSI0 to execute
sudo  dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts
#If two cameras and DSI1 are used to perform
sudo  dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp1-double_cam.dts
#In the use of any DSI, HDMI1 no image output, even if you do not connect the DSI screen as long as the corresponding file compiled, that HDMI1 no output
#If you need to restore, just delete the corresponding dt-blob.bin, e.g. sudo rm -rf /boot/dt-blob.bin 
#Execution complete, Power off, Restart CM4

Then connect the camera and DSI screen to:

  1. Ensure connection in the power-off condition.
  2. Connecting the Compute Module 4 PoE Board to the DSI screen using the CM-DSI-ADAPTER .
  3. Connecting Compute Module 4 PoE Board and CSI Camera with CSI Adapter Board.
  4. Connect to the power.
  5. Wait a few seconds for the screen to start.
  6. If it fails to boot, check if /boot/dt-blob.bin exists, if it does, reboot it again.
  7. The camera needs to run raspi-config, select Interfacing Options -> Camera -> Yes -> Finish -> Yes, reboot the system, turn on enable camera, and then reboot to save the changes.

Reference:
Testing the Raspberry Pi camera To view the first camera screen accessed:

sudo raspivid -t 0 -cs 0

To view the second camera screen:

sudo raspivid -t 0 -cs 1

You can refer to CSI camera and DSI display.

UPS Battery Level Detection and Function Pins

  • UPS( INA219 ) on i2c-10 at 0x43 (7-bit address).
  • Run the program by entering the following command:
sudo apt-get install p7zip
wget https://www.waveshare.com/w/upload/5/59/CM4_UPS_Code.7z
7zr x CM4_UPS_Code.7z -r -o./
cd CM4_UPS_Code
python3 INA219.py
  • After running the program, it can out the battery voltage, current, power, and the battery remaining percentage.

CM4-IO-WIRELESS-BASE-B 011.png
Note: A positive current indicates the battery output current (which can be considered as Raspberry Pi load current), and if the current is negative, it indicates the battery charging current.
When the system load is high and the battery voltage is low, there is a possibility that the battery current will be insufficient and the system will keep rebooting. This is not desired. The actual application can be avoided by judging that the battery voltage is too low to shut down automatically.
The sample demo has added the battery voltage judgment, the demo will shut down the system within the 60s when the battery voltage is too low and there is no external power supply for charging.
The demo shows the following statement that the battery voltage is too low and needs to be charged in time, otherwise, the demo will shut down automatically.

Voltage Low, please charge in time, otherwise, it will shut down in 58 s

If you need to use the camera or DSI screen, it is recommended to switch the I2C pin of the INA219 to GPIO2/3 After the switch the program is modified to:

#ina219 = INA219(i2c_bus=10,addr=0x43)
ina219 = INA219(i2c_bus=1,addr=0x43)
  • When the case is fixed and the UPS is turned on, there is no output from the UPS, you need to start CM4, control the P2 (pin 13) pin to pull down 500ms, and then pull up.
  • If you need to know the battery status, you need to read the P25 (physical pin 37) pin.
    • If it reads low, it is charging.
    • If it reads high, it is not charging.
    • Read as 1Hz duty cycle 50%, then the battery is faulty.

FAQ

Question:What if I cannot search for the I2C address of the RTC/FAN controller using i2cdetect -y 10?

 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.