NDIS Dial-Up
What are the ways to use the 4G module to access the Internet?
Through the SIM7600 module, Raspberry Pi can access the Internet wirelessly in the following ways:
Use AT commands to use encapsulated TCP, MQTT, HTTP(S)
This method is suitable for microprocessors with limited resources, such as MCU, or for application scenarios with a relatively small amount of data, such as uploading sensor data to servers, cloud platforms, etc. through http(s), MQTT.
If the network application is not complicated and the amount of data is relatively small (such as transmitting sensor data to the server and receiving control commands from the server), the function can be quickly used by using AT commands.
Internet using NDIS driver
This method must depend on the Linux system and is suitable for application scenarios that need to be developed using Linux network socket programming. After loading the driver into the kernel, connect SIM7600 and Jetson Nano with a USB cable. After SIM7600 is turned on, wwan0 can be recognized. network port, through which the Internet can be accessed.
The bottom layer of this method depends on the USB virtual serial port of SIM7600.
This method is the official recommended way to access the Internet. Likewise, it is recommended to use this method for dial-up Internet access.
Using ppp dial-up Internet access
This method must depend on the Linux system, and is suitable for application scenarios that need to be developed using Linux network socket programming. After configuring and running the relevant scripts, connect the SIM7600 with a USB cable. After the SIM7600 is powered on, dial up the pppd script to identify it. To the ppp0 network port, you can access the Internet through this network port.
The bottom layer of this method depends on the USB virtual serial port of SIM7600.
Dial-up Internet using wvdial
The underlying implementation of this method is the same as ppp dial-up Internet access, and will not be described again.
Preparation
Next, the process of Raspberry Pi using NDIS driver to surf the Internet through SIM7600 4G module will be introduced.
Hardware Preparation
SIM7600CE 4G HAT and its accessories Raspberry Pi 4B, 16GB SD card (burning image version: 2020-02-13-raspbian-buster-full) 4G SIM card with internet access
Hardware connection
The hardware connection is shown in the following figure:
Raspberry Pi 4B connected to SIM7600CE 4G expansion board
Notice:
1. If it is connected to the 40Pin pin, please pay attention to pull down the Flight Mode and PWR pins of SIM7600, that is, you need to initialize the Raspberry Pi pins, otherwise the module may enter directly after plugging in the Raspberry Pi. Airplane mode.
2. If the Raspberry Pi supplies power to the SIM7600 through the USB cable alone, it must provide about 500mA of power, otherwise the power supply may be unstable, causing the SIM7600 to shut down after it is turned on.
How to Use
Check the hardware connection and network connection (this step must be checked and confirmed)
Press and hold the PWKKEY button on the SIM7600CE 4G HAT to turn on the SIM7600CE 4G HAT. After it is turned on normally, the NET light should flash (if it does not flash, please check whether the SIM card is available, or whether it has entered the airplane mode).
Check whether the Jetson Nano's Ubuntu system or the Raspberry Pi's Raspbian system has a built-in Qualcomm USB serial port driver. The non-new version of the mirror system may not have the built-in driver. The way to check is as shown below:
# View Ubuntu version uname -a lsb_release -a cat /proc/version # Check if there is a Qualcomm USB virtual serial port driver lsusb
If you can see the words Qualcomm/Option, it means the built-in Qualcomm USB virtual serial port driver
Enter the AT command, set it to 4G Internet access, and check the network connection status
# Close the ModemManager process to prevent display of useless data when minicom debugs the AT serial port sudo su killall ModemManager # Install minicom serial tool apt-get install minicom # View serial device, AT command serial port, /dev/ttyUSB2 ls /dev/ttyUSB* # Open serial port with minicom sudo minicom -D /dev/ttyUSB2 # Change to NDIS dial-up (9001 network card) mode: AT+CUSBPIDSWITCH=9001,1,1 # Query network quality AT+CSQ # Query network registration status AT+CREG? # Query network operator AT+COPS? # Query network band AT+CPSI?
So far, the hardware connection between SIM7600CE and Raspberry Pi is normal, and the network connection is normal.
Compile and install the driver module file
The Raspbian system of Raspberry Pi is installed with Qualcomm's driver module file for the wwan0 network port by default, which can be viewed with the following command
lsmod
As shown below:
For Raspberry Pi, you need to uninstall the driver first (otherwise it will conflict with the newly installed driver), and then install the driver module file of simcom for the wwan0 network port. The uninstall method is as follows:
sudo su rmmod qmi_wwan
On this basis, perform the next steps.
Download the driver module source program officially provided by SIMCOM:
wget https://www.waveshare.net/w/upload/0/00/SIM7600_NDIS.7z sudo apt-get install p7zip-full 7z x SIM7600_NDIS.7z -r -o./SIM7600_NDIS cd SIM7600_NDIS </re> To compile the kernel module on the Raspberry Pi, you need to install additional kernel header files (see: https://www.raspberrypi.org/documentation/linux/kernel/headers.md), the operation is as follows (this step is slow to download, you must be patient):<br/> <pre> sudo apt install raspberrypi-kernel-headers
- Note: By default, the above command will install the kernel version header file corresponding to the latest version of the official website image. If you are using an older version of the image, you need to upgrade the kernel version first. Available command:
sudo apt-get install --reinstall raspberrypi-bootloader raspberrypi-kernel
Start compiling the NDIS driver source file, first switch to super administrator privileges, as shown in the following figure:
sudo su make clean make ls
As can be seen from the above figure, it has been compiled into the kernel driver module file simcom_wwan.ko.
Next, the driver module file will be installed:
insmod simcom_wwan.ko lsmod
At this point, the simcom_wwan driver module has been installed.
You can view the print information of the kernel:
dmesg
- Note: If the installation of the driver fails, you can also check the error type through the kernel print information. If it prompts that the kernel version does not match, you must check again whether the installed kernel header file version matches the system kernel version.
Start dial and assign IP
At this point, you can see that the wwan0 network port has appeared:
ifconfig -a
However, the network port has not been assigned an IP address. To assign an IP address, you need to
- First, open the network port
ifconfig wwan0 up then dial minicom -D /dev/ttyUSB2 AT$QCRMCALL=1,1
- Finally, assign the IP
apt-get install udhcpc udhcpc -i wwan0
At this point, the IP can be assigned normally. Of course, there is no absolute! If "udhcpc: sending discover" keeps appearing, then reflect on whether you have not listened to Ma Ma. For example, the raspberry pi did not uninstall the driver rmmod qmi_wwan driver according to the above, or the dialing time was too long and disconnected, or the other steps above were wrong.
- Next, start the network port for testing:
ifconfig -a ping -I wwan0 www.baidu.com
As can be seen from the above figure, the wwan0 network port test passed.
If a dns parsing exception occurs, enter the following command to resolve it:
route add -net 0.0.0.0 wwan0