Template: CM4-DUAL-ETH-4G/5G-BASE Guide
Writing Image
- Write Image for Compute Module Boards eMMC version
- Write Image for Compute Module Boards Lite version
Precautions
Do not plug or unplug any device while it is powered on.
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 USB3.0 interfaces, it doesn't support PCIe devices.
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
- Please refer to SIM8200EA-M2_5G_HAT
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 maybe different if you connect other USB adapter)
sudo dhclient -v usb0
- If the network cannot connected properly, pleaes run theone of the following AT command 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 network properly, please try to trobuleshoot 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).
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 restore if the network is diabled
- 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, enter the following command:
sudo apt-get install p7zip-full sudo wget https://www.waveshare.com/w/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:
Python
Enter the python/example directory:
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:
FAN test
When powered on, the fan will spin for 1 second, then stop for 2 seconds, and then spin again. This is normal.<br\> There is currently no official configuration method for fans, there is a third-party configuration method: https://github.com/neg2led/cm4io-fan<br\> This method is released by a third party, not an official release, and we are not responsible for any problems! <br\>
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 and DSI are disabled by default. When using the camera and DSI, it will occupy three I2C devices: I2C-10, I2C-11, and I2C-0.
- Open a terminal and run the following commands:
wget https://www.waveshare.net/w/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 both cameras and DSI0 sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp0-double_cam.dts #If you want to ue both cameras and DSI1 sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp1-double_cam.dts #When using any DSI interface, HDMI1 will have no image output, even if you do not connect the DSI screen, as long as you compile the corresponding file, then HDMI1 will not output #If you need to restore, please 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
And then connect the cameras and DSI display
1: Please power off the IO Board first before your connection.
2: Connect the power adapter after connecting the cameras and DSI display
3: Wait a few seconds before the screen boot up.
4: If the DSI LCD cannot display, please check if you have added /boot/dt-blob.bin. If there already has the dt-blob.bin, just try to reboot.
5: The camera needs to be enabled by raspi-config, enter sudo raspi-config on the terminal, choose Interfacing Options->Camera->Yes->Finish-Yes and reboot the system
Old Version (Buster)
- Test the Cameras:
Test camera0:
sudo raspivid -t 0 -cs 0
Test camera1:
sudo raspivid -t 0 -cs 1
New Version (Bullseye)
If you are using the latest Raspberry Pi OS (Bullseye):
libcamera-hello -t 0 or libcamera-hello #The new system uses dual cameras #Remove or comment out the line camera_auto_detect=1 in config.txt #camera_auto_detect=1 #Add the following lines: dtoverlay=imx219,cam1 dtoverlay=imx219,cam0 #Add the corresponding line according to the camera you use, where imx219 is the camera sensor model, and there are other sensors dtoverlay=ov5647,cam0 dtoverlay=imx219,cam0 dtoverlay=ov9281,cam0 dtoverlay=imx477,cam0 #then restart reboot #Other part of the commands: #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
- HDMI1 is disabled if you use DSI interfaces for displaying, even if you just compile the corresponding files without connecting to the DSI screen, please note it
- Any connection of two HDMI ports can output images, not limited to which HDMI port, if two HDMI screens are connected, only HDMI0 has image output
- If you want to enable both HDMI, please delete the dt-blob.bin file with the following command:
sudo rm -rf /boot/dt-blob.bin
- Then reboot
Reference Raspberry Pi Manual
For more information about the CSI camera and DSI display, please refer to: