Compute Module PoE 4G Board manual

From Waveshare Wiki
Jump to: navigation, search

Write image

  • Download the rpiboot_setup software to the PC, unzip it and install the rpiboot. Note: Pay attention to remember the installation directory.
  • Download the latest version of the image on the Raspberry Pi official website., or directly download and use the pre-configured image we provide on the 'Resources' page(If you use our pre-configured image, you don’t need to download the sample program). Note: You should prepare a 16G or larger SD card if you want to use the pre-configured image we provide.

Using with Compute Module 3 Lite or Compute Module 3+ Lite

If you use Compute Module 3 Lite or Compute Module 3+ Lite, you should write the image to SD card just like common Raspberry Pi

  • To write the image, you should prepare an SD card (8G or larger, we suggest to use 16G) and card reader.
  • Use Win32DiskImager software to write the image to SD card. (It is same as how you write an image for Pi 3B)
  • After the image has finished writing, insert the SD card into the SD card slot interface of the Board.
  • Insert CM3L/CM3+L into the CM3 card slot, and then power on the board.

Using with Compute Module 3 or Compute Module 3+

If you use Compute Module 3 or Compute Module 3+, you should write an image to the internal eMMC.

  • Insert your CM3/CM3+ to PoE 4G board, then use a USB cable to connect the SLAVR interface of PoE 4G board to your PC, and then connect the Power interface of the PoE 4G board to the power adapter.

Compute Module PoE 4G Board02.png

  • In the installation directory of rpiboot_setup, run rpiboot.exe as administrator, PC will recognize eMMC of Compute module as a portable drive. (Note: When CM3+ is used for the first time, you may need to manually format and assign a drive letter in the PC's Disk management before it can be found in your Computer)
  • open the Win32DiskImager software, select the system image downloaded in the previous step, and click‘Write’ to write the image to eMMC(the disk recognized by the PC, remember to format it first).
  • After writing, you can disconnect the USB cable, and re-power the POE 4G board to start the CM3/CM3+.

【Note】

  • While writing the image, DO NOT write other portable storage drives to avoid conflicting.
  • The default user name and password of the image of Raspberry is pi and raspberry.
  • The EMMC of CM3+ is extended, which allows CM3+ to install a common desktop image. However, the eMMC of CM3 is only 4G, therefore if you want to write an image to CM3, please choose Raspbian Lite. You can also install GUI for Lite image separately by commands below (network is required)
sudo apt-get update
sudo apt-get install raspberrypi-ui-mods

Connect CSI camera

  • 1.Test camera with pre-configured image

If you are using the image provided by us, the relevant files have already been configured, so no additional settings are required. You can directly test the cameras after connection.

  • 2. Test camera with the original image

The official Raspbian image doesn't have the startup file of the official camera and the official 7-inch screen configuration by default. In this case, if you use the official Raspbian image, you need to convert the official dts file into a bin file and put it under the system /boot/ directory. (You can find the dts file in the demo of Compute_Module_PoE_4G_Board.7z)

Use the following command to convert:

sudo dtc -I dts -O dtb -o /boot/dt-blob.bin dt-blob-disp1-cam2.dts

View the image of the camera connected

  • Test the camera 1
sudo raspivid -t 0 -cs 0
  • Test camera 2
sudo raspivid -t 0 -cs 1

【Note】: -cs indicates the number of cameras that are connected, but the camera number indicated by the -cs parameter maybe not the same as the silkscreen of the board and the case. For example, if you connect a camera to the CAM1 interface, the command should be -cs 0 to indicate the first camera connected.

Download the demo for Raspberry Pi OS

  • If you are using our pre-configured image, you don’t need to download the demo code, you can skip this step directly. If you are using the original Raspberry Pi OS, please refer to the following steps to download the demo.
  • You may need to connect a keyboard and HDMI LCD to Pi for demo installing or log in remotely with SSH or VNC.
  • You need to install the bcm2835 and the wiringPi function library before you install the demo.

Install BCM2835 function library

Execute the following commands on the Raspberry Pi terminal:

wget http://www.airspayce.com/mikem/bcm2835/bcm2835-1.68.tar.gz
tar zxvf bcm2835-1.68.tar.gz 
cd bcm2835-1.68/
sudo ./configure && sudo make && sudo make check && sudo make install

Install wiringPi function library

Execute the following commands on the Raspberry Pi terminal:

sudo apt-get install wiringpi  

Note: This step is for the version of Raspberry Pi system after May 2019, which may need to be upgraded(it may not be executed for the system earlier than this before)

wget https://project-downloads.drogon.net/wiringpi-latest.deb
sudo dpkg -i wiringpi-latest.deb
gpio -v   

Run gpio -v and the 2.52 version will appear. If it does not appear, it means that the installation error occurred.

Install the demo cade

Execute the following commands on the Raspberry Pi terminal:

sudo apt-get install p7zip-full
sudo wget  https://www.waveshare.net/w/upload/6/6c/Compute_Module_PoE_4G_Board.7z
7z x Compute_Module_PoE_4G_Board.7z -O./Compute_Module_PoE_4G_Board
sudo chmod 777  -R Compute_Module_PoE_4G_Board
cd Compute_Module_PoE_4G_Board

SIM7600X module

For the original Raspberry Pi OS

1. Turn on the SIM7600X module

Open the config.txt in the terminal

sudo nano /boot/config.txt

Add the following code at the end of the config.txt:

dtoverlay=sc16is752-spi1,int_pin=16

And then reboot the system

sudo reboot 

Enter the following directory after reboot.

cd Compute_Module_PoE_4G_Board/

After executing this command, the 4G module will be turned on, and you need to wait for 1 minute. And then the LED corresponding to 4G_STA will light up, which means that the 4G module has been turned on

sudo ./4G_Module.sh 1

And use the following command to turn off the 4G modules, you need to wait for 1 minute. And then the LED corresponding to 4G_STA will light off, which means that the 4G module has been shut down

sudo ./4G_Module.sh 0

Note:

  • If you add some USB devices, the original pin number will be changed, for example, the default is 503, after connecting FT232RL and restarting the pin number becomes 499.

Compute Module PoE 4G Board Manual 4G.png

  • If you need to boot up and start the 4G board automatically, you can add the corresponding command in sudo nano /etc/rc.local
sudo nano /etc/rc.local

And then add the following line and the end of the file(before the exit 0)

sudo /home/pi/Compute_Module_PoE_4G_Board/4G_Module.sh 1

Or solder a 0R resistor on this pan or solder directly to connect(under the SIM card slot on the back)

Compute Module PoE 4G Board Manual 4G 1.png

2. SIM7600 configuration to network


【Note】Status of the two LED indicators for 4G_NET and 4G_STA

LEDs status Module atatus
Two LED lights flash SIM7600X module has been turned on normally
Two LED lights are off SIM7600X module did not start successfully
Two LED lights are on always SIM card not inserted/recognized

Before configuration, please make sure that the SIM7600X module has been turned on. Execute the following commands on the Raspberry Pi terminal:

cd Compute_Module_PoE_4G_Board
sudo chmod 777 sim7600_4G_hat_init

Set the boot initialization script:

sudo nano /etc/rc.local

Add the following line before exit 0

sh /home/pi/Compute_Module_PoE_4G_Board/sim7600_4G_hat_init

Set up the network by using monicom

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

Enter the following command:

AT+CUSBPIDSWITCH=9011,1,1

And then reboot the system

sudo reboot

For the pre-configured image

If you use our pre-configured image, the SIM7600 module has been already turned on. You can directly use the following code to configure the network.

sudo minicom -D /dev/ttyUSB2

Enter the following command:

AT+CUSBPIDSWITCH=9011,1,1

And then reboot the system

sudo reboot

AT commands for testing

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

sudo apt-get install minicom
sudo minicom -D /dev/ttyUSB2
AT Command Description Return
AT AT test command OK
ATE ATE1: Echo mode on
ATE0: Echo mode off
OK
AT+CGMI Request manufacturer indentification OK
AT+CGMM Request model indentification OK
AT+CGSN Request product serial number identification OK
AT+CSUB Request porduct version OK
AT+CGMR Request firmware version OK
AT+IPREX Configure buad rate of model +IPREX:OK
AT+CRESET Reset model OK
AT+CSQ Query network signal quality, return sugnal value +CSQ: 17,99
OK
AT+CPIN? Query SIM card status +CPIN:RRADY
AT+COPS? Query provider information +COPS:OK
AT+CREG? Query network registation status +CREG: OK
AT+CPSI? Query UE system information
AT+CNMP Select Network Mode:

2: Automatic
13: GSM only
38: LTE only
48: Any modes but LTE <nr /> ....

OK

More AT commands refer to: AT_Command_V2.00

For more information, please refer to: SIMCom

Open the Audio

sudo nano /boot/config.txt 
dtoverlay=pwm-2chan,pin=12,func=4,pin2=13,func2=4
sudo reboot

And then turn on the Audio by sudo raspi-config -> Advanced Options -> Audio

ADC test

C

Execute the following commands to run the demo

cd ADC/c/
sudo ./main

python

cd ADC/python/
sudo python examples/main.py

Result: output voltage value

【Note】The ADC function uses the ADS1113 chip, the internal reference voltage is 2.048V, differential input, input voltage range: ±2.048V.

CAN test

Connect the module to the Raspberry Pi, and then reboot the Pi and modify the config.txt

sudo nano /boot/config.txt

Add the following lines at the end of the config.txt

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25

Reboot the system

sudo reboot

After the rebooting, use the following command to check the SPI information:

dmesg | grep spi

Compute-Module-board-Manual-can-1.png

Turn on CAN

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

Note: For more information of the CAN kernel commands please refer to this link: https://www.kernel.org/doc/Documentation/networking/can.txt

Check the ifconfig

ifconfig

Compute-Module-board-Manual-can-2.png

C

Enter the following cammands in the terminal:

1.Receive

cd CAN/c/receive/
sudo make clean
sudo make
sudo ./can_receive

2.Send

cd CAN/c/send/ 
sudo make clean
sudo make
sudo ./can_send

python

cd python/

1.Receive

sudo python receive.py

2.Send

sudo python send.py

【Note】The CAN demo uses the method of the combination of the MCP2515 and SN65HVD230 chip, and the demo cannot be used without adding a driver. If you need to test two CAN modules, you can choose 2-CH CAN HAT or RS485 CAN HAT.

GPIO test

The GPIO ports can support 5V or 3.3V power input, which needs to be switched by the jumping cap.

C

Enter the following code in the terminal:

cd IO/c/
sudo ./main

python

cd IO/python/
sudo python examples/main.py

Result: If OUT1 and IN1 are short-circuited, and OUT2 and IN2 are short-circuited, the output result is as follows.

Compute-Module-board-Manual-IO-1.png

【Note】

  • The IN1 input uses the SPI0.1 chip select pin of the Raspberry Pi, if you need to use IN1, please be careful to prevent SPI pin conflicts.
  • If you need to use the CAN and the GPIO at the same time, please refer to the following steps in the terminal:
sudo raspi-config

Turn off the SPI interface

Compute-Module-board-Manual-IO-2.png

sudo nano /boot/config.txt

Add the following lines in the config.txt

dtparam=spi=on
dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25

And then reboot the system

sudo reboot

OUT can only be used as output, IN can only be used as input.

LED buzzer test

C

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

python

cd LED_BUZZER/python/
sudo python main.py

Result:

Compute-Module-board-Manual-LED BUZZER-1.png

The buzzer stops and the LED lights up alternately.

RS232 test

Edit the config.txt in the terminal

sudo nano /boot/config.txt 

Add the following line at the end of the file

dtoverlay=sc16is752-spi1,int_pin=16

C

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

python

cd RS232/python/
sudo python examples/main.py

Result:

After receiving any string, click 'Enter' and then it will return any string immediately.

【Note】This test using USB TO RS232/485/TTL communicate with the computer.

RS485

Edit the config.txt in the terminal

sudo nano /boot/config.txt 

Add the following line at the end of the file

dtoverlay=sc16is752-spi1,int_pin=16

C

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

python

cd RS485/python/
sudo python examples/main.py

Result:

After receiving any string, click 'Enter' and then it will return any string immediately.

【Note】This test using USB TO RS232/485/TTL communicate with the computer.

RTC test

Open SPI and I2C interface

Open the Raspberry Pi terminal and enter the following command to enter the configuration interface.

sudo raspi-config

And then select Interfacing Options -> SPI -> Yes to open the SPI interface.

RPI open spi.png

And then reboot the system

sudo reboot

The way to open the I2C interface is the same as the SPI. Enter the configuration interface and select Interfaceing Options -> I2C -> Yes to open the IIC interface, and then reboot the system.

C

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

python

cd RTC/python/
sudo python examples/main.py

Result: Show the data of week, date, time

Compute-Module-board-Manual-RTC-1.png