4G module is an important carrier for connecting things to things, and is one of the core components for terminal devices to access the Internet of Things. With the popularization of 4G, the demand for 4G communication modules in many emerging markets is increasing, so how to quickly apply 4G modules on embedded devices on the ARM platform?
The 4G communication module integrates the frequency receiver and signal amplifier and other components together to achieve integration. With the development of industry, the demand for embedded devices to access the network is increasing. In an environment without wired or wireless networks such as WiFi, it is a good method to directly connect to the operator network through the 4G communication module to access the Internet. Therefore, this article will introduce to readers how to use the 4G module in Linux for embedded devices based on the ARM platform.
1. Development Environment
1. Development host environment:
Ubuntu12.04 (64-bit), arm-fls-linux-guneabi-gcc series cross-compilation chain.
2. Hardware List:
IoT-3960 industrial control board, Longshang 4G module U8300C or U8300W.
3. Software resources:
The kernel source code package in the CD EPC-280_283_287V1.04.iso is: linux-2.6.35.3-fec60fa.tar.bz2 (the CD content can be downloaded from the official website of ZHIYUAN Electronics http://www.zlg.cn).
2. Hardware Overview
IoT-3960L is an industrial IoT network controller developed by Guangzhou Zhiyuan Electronics Co., Ltd. with NXP i.MX287 processor as the core. It integrates multiple communication interfaces and supports multiple communication protocols. It has the characteristics of high cost performance, rich functions, stable operation and strong compatibility. The actual product is shown in Figure 1.
Figure 1 IoT-3960L industrial control board
Through the customized Mini-PCIE interface, IoT-3960L can expand 3G, 4G, GPRS, ZigBee, RFID and other wireless communication modules. The module expanded in this article is Longshang 4G module, and the model used is shown in Figure 2.
Figure 2 Longshang 4G modules U8300C and U8300W
3. Technical Implementation
1. Unzip the kernel source code
Copy the linux-2.6.35..3-fec60fa.tar.bz2 source package in the EPC-280_283_287 V1.04.iso CD to the "~/" directory of the Ubuntu system, and decompress it to get the linux-2.6.35.3 directory. The reference command is as follows:
vmuser@Linux-host:~$ tar -jxvf linux-2.6.35..3-fec60fa.tar.bz2
2. Modify the configuration file
The default configuration of CONFIG_GPIO_M28X macro is set in the Kconfig file under the kernel source directory "drivers/gpio/". Open this Kconfig file with the vim editor, search for "GPIO_M28X", find its configuration settings, and modify it to an independently configurable option. The modified configuration is as follows (the red mark is the modified part):
config GPIO_M28X
tristate "GPIO support for MiniPCI-E slot control"
#depends onIoT_3960 || IoT_3962
help
Say yes here to enable the IoT_396x boardgpio driver.
3. Modify the kernel compilation script
The build-kernel script file in the Linux source directory is mainly used to switch the kernel default configuration. However, since the script file in the CD is not flexible enough, it is recommended to directly replace the entire build-kernel text content with the code shown in the following list:
#!/bin/sh
echo "build menu, please select your choice:"
echo " 1 make clean"
echo "2 config for EPC_28xA"
echo "3 config for EPC_283 or EasyARM-i.MX283A"
echo "4 config for EPC_287 or EasyARM-i.MX287A"
echo " 5 config for EPC_280 or EasyARM-i.MX280A"
echo "6 config for IoT_3960"
echo "7 config for IoT_3962"
echo " 8 config for A287_W128LI"
echo " 9 config for A287_WB128LI"
echo " a make menuconfig"
echo " b make uImage"
echo " c make zImage"
echo "d make modules"
echo " q exit"
make_distclean() {
echo "make distclean"
make clean
}
config_EPC_28xA() {
echo "EPC_28xA"
cp .config .config.bk
cp arch/arm/configs/EPC_28xA_defconfig .config
}
config_EPC_283B() {
echo "EPC_283B"
cp .config .config.bk
cp arch/arm/configs/EPC_283B_defconfig .config
}
config_EPC_287B() {
echo "EPC_287B"
cp .config .config.bk
cp arch/arm/configs/EPC_287B_defconfig .config
}
config_EPC_280() {
echo "EPC_280"
cp .config .config.bk
cp arch/arm/configs/EPC_280_defconfig .config
}
config_IoT_3960() {
echo "IoT_3960"
cp .config .config.bk
cp arch/arm/configs/IoT_3960_defconfig .config
}
config_IoT_3962() {
echo "IoT_3962"
cp .config .config.bk
cp arch/arm/configs/IoT_3962_defconfig .config
}
config_A287_W128LI() {
echo "A287_W128LI"
cp .config .config.bk
cp arch/arm/configs/A287_W128LI_defconfig .config
}
config_A287_WB128LI() {
echo "A287_WB128LI"
cp .config .config.bk
cp arch/arm/configs/A287_WB128LI_defconfig .config
}
make_uImage() {
make uImage
}
make_zImage() {
make zImage
}
make_modules() {
make modules
}
make_menuconfig() {
make menuconfig
}
read sel
echo "select $sel"
case $sel in
[1]) make_distclean;;
[2]) config_EPC_28xA;;
[3]) config_EPC_283B;;
[4]) config_EPC_287B;;
[5]) config_EPC_280;;
[6]) config_IoT_3960;;
[7]) config_IoT_3962;;
[8]) config_A287_W128LI;;
[9]) config_A287_WB128LI;;
[a]) make_menuconfig;;
[b]) make_uImage;;
[c]) make_zImage;;
[d]) make_modules;;
[q] | [Q]) exit 0;;
*) echo "ONLY accept 1~9,a~d/q/Q"
esac
(Pull down to show more codes)
4. Configure kernel source code
Enter the root directory of the unpacked Linux source code and use the default kernel configuration of IoT-3960L. The reference command is as follows:
vmuser@Linux_host:~/linux-2.6.35.3$ ./build-kernel
Then enter 6 to select Iot3960. If it is other industrial control boards or development kits, select the corresponding options. If there is no .config file in the corresponding Linux source code root directory, a cp command execution error will be prompted after running this step. Just ignore this error.
The industrial control board or development kit uses the USB interface to communicate with the Longshang 4G module. The kernel needs to be configured to support the USB to serial port function. The reference command is as follows:
vmuser@Linux-host:~/linux-2.6.35.3 $ make menuconfig
After entering the configuration interface, press the Enter key to enter the "Device Drivers --->" option. After configuring the kernel, save and exit the kernel configuration operation.
5. Modify & compile kernel source code
For the Longshang 4G module, we need to modify the contents of three arrays in the linux-2.6.35.3 directory:
Use vi or vim command to open drivers/gpio/gpio_m28x.c file and make changes in all_gpios_info[ ] array;
Use vi or vim command to open the arch/arm/mach-mx28/mx28evk_pins.c file and make changes in the mx28evk_fixed_pins[] array;
Use vi or vim command to open drivers/usb/serial/option.c file and make changes in option_ids[] array.
After completing the above modifications, you can compile the kernel. The kernel compilation reference command is as follows:
vmuser@Linux-host:~/linux-2.6.35.3 $ make uImage
After the kernel is compiled, burn the generated uImage file (which can be found in the arch/arm/boot directory) to the industrial control board or development kit. For the burning method, please refer to Chapter 6 of the "IoT-3960 User Manual.pdf".
4. 4G module test
This article mainly introduces the control interfaces of the Longshang 4G module, such as telephone and network, and the communication process of the IoT-3960L industrial control board. The industrial control board used for testing must be burned with the V1.03 uboot and file system in the EPC-280_283_287 V1.04.iso CD, because it contains the necessary dial-up Internet access tools.
1. Telephone control interface
The commands for answering and dialing a phone call are shown in Table 1. By sending the corresponding commands to the serial port, you can answer and dial a phone call. For example, you can send "ATD12345678901;nr" to the serial port to dial 12345678901.
Table 1 Phone dialing and answering control commands
Order | Syntax and function |
---|---|
ATD | Make a phone call: ATD+phone number+;rn" such as ATD10010; followed by a semicolon Cannot be less, return OK or ERROR |
AT+COPS? | "AT+COPS?rn" detects the operator and returns OK or ERROR |
AT+CVHU=0 and ATH | Hang up the phone: "AT+CVHU=0rn" and then send "ATHrn" |
ATA | Answer the call: "ATAnr" |
The execution flow of the phone dialing and answering code is shown in Figure 3. The code will first display the available menus, such as phone dialing, SMS receiving, etc. Wait for the user to enter parameters and execute the process corresponding to the parameters. Then determine whether the execution is successful. If the execution is successful, it will return to the menu display code to continue the next cycle.
Figure 3 Flowchart of phone call dialing and answering
2. Network control interface
The 4G module Internet access function connects to the network through the interface provided by PPP dial-up. A dial-up script for reference is preset in the "/etc/ppp" directory of the development kit file system. After the dial-up is successful (execute the PPP dial-up script), the kernel will generate a PPP network device. You can access the network by creating a socket.
3. Demonstration program operation
Enable 4G module
When the default kernel starts, the reset pin of the 4G module is pulled low, making the module in a non-working state. To fully enable the module, run the upmodule.sh script in the /opt directory.
At this time, the WWAN LED of the board will flash, with a flashing frequency of about 800 milliseconds, and then the device will start to access the network. After successful access, the flashing frequency of the WWAN LED of the board will change to about 3 seconds. At the same time, about 10 seconds later, the board will start to detect the insertion of the USB device, and then the board will automatically install the USB to serial port driver. After the driver is installed, the 6 serial port devices ttyUSB0~ttyUSB5 will be automatically generated in the /dev directory of the board.
Compile the demo program
Copy the longsung-test folder in the /works/mx28x/app/ directory to the Linux development host, compile the code under longsung-test, and copy the generated longsung-test file to the board for subsequent phone function testing.
Previous article:The composition and difference of gcc, arm-Linux-gcc and arm-elf-gcc
Next article:ARM instruction set - conditional execution, memory operation instructions, jump instructions
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Sandia Labs develops battery failure early warning technology to detect battery failures faster
- Level 2 PC Technician-FIELD ENGINEER
- [Fudan Micro FM33LC046N Review] + Use of some peripherals
- cc3200 gets stuck when performing sl related operations in the event case of receiving successful Ap connection
- Promoting the application of RFID technology through wireless warehouse management system
- 【Qinheng CH582】7 Help Qinheng---Control USB keyboard indicator light
- How to learn 51 single chip microcomputer self-understanding
- What are common-collector, common-base, and common-emitter amplifiers? Let's find out...
- [Synopsys IP Resources] The market demand for dedicated artificial intelligence IP in SoC is increasing
- Download and get a gift|Keysight Technology Test Equipment Report
- TI MSP430 series microcontroller serial communication baud rate calculation method