Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of porting EC20 4G modules to Linux system

2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what is the method of porting Linux system EC20 4G module". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of transplanting EC20 4G module of Linux system".

1.4G network connection

For embedded Linux, 4G network connection is a relatively easy function, most 4G module interfaces are MiniPCIE interfaces, but after a deep understanding, we will find that the communication interface of 4G module is USB, so the driver of 4G module is USB driver. As long as the USB driver is normal, 4G module can communicate normally on hardware. Let's take a look at the hardware schematic of the 4G module:

In the schematic, U25 is the MiniPCIE interface of the 4G module, and then the communication pin will be connected to the HUB chip of U15, so the 4G module will be recognized as the USB device, and CON5 is the SIM card interface. When using the 4G module, you need to insert the SIM card first. The EC20 4G module used on the i.MX6UL Terminator development board, as shown in the figure

2. EC20 4G module configuration

2.1. Add USB device information

To use the EC20 4G module, you first need to add the USB information of EC20 to the Linux kernel, so that the EC20 4G module can be correctly identified after the kernel starts. Open the drivers/usb/serial/option.c file under the Linux kernel and add the following information:

1809 / * add support EC220 4G Module * /

1810 {USB_DEVICE (0x05C6, 0x9090)}, / * Quectel UC15 * /

1811 {USB_DEVICE (0x05C6, 0x9003)}, / * Quectel UC20 * /

1812 {USB_DEVICE (0x05C6, 0x9215)}, / * Quectel EC20 * /

1813 {USB_DEVICE (0x2C7C, 0x0125)}, / * Quectel EC25/EC20 R2.0 * /

1814 {USB_DEVICE (0x2C7C, 0x0121)}, / * Quectel EC21 * /

1815 / * end add * / where line 1813 is the USB information of the EC20 4G module.

2.2. Linux kernel configuration

After adding the USB information for the EC20 4G module, you need to modify the Linux kernel configuration to support the USBNET feature. The specific configuration is as follows:

Device Drivers->

Network device support->

USB Network Adapters->

The Multi-purpose USB Networking Framework configuration is shown in the figure

Next, we also need to enable USB serial port GSM and CDMA drivers. The configuration path is as follows:

Device Drivers->

USB support->

USB Serial Converter support->

USB driver for GSM and CDMA modems

Configuration as shown in the figure

Then configure ppp. The configuration path is as follows:

Device Drivers->

Network device support->

PPP (point-to-point protocol) support

PPP BSD-Compress compression

PPP Deflate compression

PPP filtering

PPP MPPE compression (encryption)

PPP multilink support

PPP over Ethernet

PPP support for async serial ports

PPP support for sync tty ports

The tty ports configuration is shown in the figure

After the configuration is complete, recompile the kernel, and then use the new kernel to start the development board. If the configuration is successful, the information as shown in figure 2.2.4 will be printed after the development board starts:

It can be seen that the EC20 4G module is identified successfully, and five USB devices are virtual, which are ttyUSB0~ttyUSB4.

3. EC20 4G module networking test

3.1. Compilation of PPP software package

First copy ppp-2.4.4.tar.gz to Ubuntu, and then execute the following command to extract:

Tar-xvf ppp-2.4.4.tar.gz

Decompress to get the ppp-2.4.4 directory, and enter the ppp-2.4.4 directory as shown in the figure.

Use configure for configuration, and the command is as follows:. / configure results as shown in figure

After the configuration is complete, compile using the following command:

Make CC=arm-linux-gnueabihf-gcc

"CC=arm-linux-gnueabihf-gcc" specifies the compiler, which uses the same compiler as the Linux kernel of the development board. Compilation is completed as shown in the figure

After the compilation is completed, the executable files of chat, pppd, pppdump and pppstats are generated in the four directories of chat, pppd, pppdump and pppstats respectively, which are used in the following 4G module networking testing.

3.2. EC20 4G module networking test

First install the EC20 4G module, antenna and SIM card, as shown in the figure

When the development board is ready, start the Linux system. After the system starts, enter the / etc directory, and then create the ppp directory. The specific commands are as follows:

Cd / etc / / enter the etc directory

Mkdir ppp / / create a ppp directory

After the directory is created, use USB disk to copy the four executable files chat, pppd, pppdump and pppstats compiled in the previous section to the / etc/ppp directory, as shown in the figure:

Then create the pap-secrets file under the / etc/ppp directory, using the following command:

Touch pap-secrets / / create pap-secrets file vi pap-secrets / / Open pap-secret

Enter the following:

# Secrets for authentication using PAP

# client server secret IP addresses

Card * card *

When the 4G signal is communicating, there is a password comparison, and if the password is right, you can communicate. It shows that the user is card and the password is card.

Then create a new folder, peers, and command "mkdir peers".

Go to the peers folder and create the wcdma file with the following command:

Touch wcdma

Vi wcdma

Enter the following:

# / etc/ppp/peers/wcdma

# This is pppd script for China liantong

# Usage: root > pppd call wcdma

Hide-password

Noauth

Connect' / etc/ppp/chat-s-v-f / etc/ppp/peers/wcdma-chat-connect'

Disconnect' / etc/ppp/chat-s-v-f / etc/ppp/peers/wcdma-chat-disconnect'

Debug

/ dev/ttyUSB2

115200

Defaultroute

Noipdefault

Novj

Novjccomp

Noccp

Ipcp-accept-local

Ipcp-accept-remote

Local

Lock

Dump

Nodetach

User "card"

Password "card"

Crtscts

Remotename 3gppp

Ipparam 3gppp

Usepeerdns

It is important to note that the / dev/ttyUSB2 device node file is used.

"user" card "" and "password" card "" correspond to the user name and password in the pap-secrets file.

Create a wcdma-chat-connect file:

Touch wcdma-chat-connect

Vi wcdma-chat-connect

The contents are as follows:

ABORT "BUSY"

ABORT "NO CARRIER"

ABORT "NO DIALTONE"

ABORT "ERROR"

ABORT "NO ANSWER"

TIMEOUT 120

"" AT

OK\ rATZ

OK\ rAT+CGDCONT=1, "IP", "3gnet", 0jin0

OK-AT-OK ATDT*99#

CONNECT\ d\ c

Here OK\ rAT+CGDCONT=1, "IP", "3gnet", 0jin0

OK-AT-OK ATDT*99#

These two sentences will change according to Mobile Unicom or Telecom, where Mobile 4G is used.

Create a wcdma-chat-disconnect file:

Touch wcdma-chat-disconnect

Vi wcdma-chat-disconnect

The contents are as follows:

ABORT "ERROR"

ABORT "NO DIALTONE"

SAY "INSending break to the modem\ n"

""\ k "

"" + ATH "

SAY "\ nGood bye\ n"

Once the required files have been created, you are ready for networking testing.

First turn off the eth0 device because of a conflict with the EC20 4G module and only one device can be used at the same time. The command is as follows:

Ifconfig eth0 down

Then enter the instruction in the / etc/ppp directory:

. / pppd call wcdma &

The result is as shown in the picture

The figure above shows that the IP address after successful networking is 10.47.135.182. Use the ifconfig command to view the result as shown in the figure.

At this point, use the ping command to see if you can ping the public network, as follows:

Ping 202.108.22.5-c 4

The "- c" option specifies the number of times for the ping network. "202.108.22.5" is the IP address of Baidu. The result is shown in the figure:

Found that ping can not be connected to the public network, willing to be because DNS is not set up, there is a file resolv.conf under etc. This file is used to put DNS. This is the domain name that is not set up correctly. However, it is mandatory to copy this file to 192.168.1.1 in eth0's run script. As a result, even if you set the correct DNS in the file here, you will find that it already contains 192.168.1.1 when you turn it on. This is because eth0 is self-booting.

Let's create a new file resolv.conf_back in the / etc directory:

Touch resolv.conf_back

Vi resolv.conf_back

Enter the following:

Nameserver 202.99.160.68

Nameserver 221.130.33.52

Nameserver 221.130.33.60

Nameserver 192.168.1.1

Then create a new script file ppp0:

Touch ppp0

Vi ppp0

Enter the following:

#! / bin/sh

Ifconfig eth0 down

Cp / etc/resolv.conf_back

/ etc/resolv.conf/etc/ppp/pppd call wcdma&

Modify the execution permissions of the ppp0 file:

Chmod 777 ppp0

The first step here is to turn off eth0, the second step is to overwrite our DNS file on resolv.conf, and the third step is to run it. Then reboot and execute the ppp0 script with the following command:

/ etc/ppp0

After the script executes successfully, use the ping command again, and the result is as shown in the figure:

The picture shows the IP address that can ping Baidu normally. At this point, the EC20 4G module can be used normally.

Thank you for your reading, the above is the content of "what is the method of porting Linux system EC20 4G module". After the study of this article, I believe you have a deeper understanding of what the method of transplanting EC20 4G module of Linux system is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report