Design and research of m2m terminal based on mc35i

Publisher:国宝集团Latest update time:2010-12-18 Source: 电子设计应用 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

At present, remote monitoring of oil pipelines, power equipment, oil wells, etc. mainly adopts manual patrol, which has the disadvantages of poor real-time performance, high cost, waste of human resources, inability to monitor areas with harsh environments, and possible false alarms. With the improvement of the modernization level of the industrial field and the development of communication technology, this production method needs to be improved urgently.

M2M refers to a series of technologies and their combinations that use wireless mobile communication technology to achieve data communication and exchange between machines and between machines and people. GPRS has the advantages of wide coverage, long communication distance, and high network reliability. With the promotion and application of GPRS and the launch of M2M products based on GPRS, using GPRS technology to solve the above problems has become a better solution.

Embedded system is one of the hot topics in current research at home and abroad. It is necessary to use embedded system technology to design a universal terminal that can solve the data transmission problem in the field of remote monitoring. This article focuses on the overall design of M2M terminal based on embedded ARM processor and GPRS module mc35i.

System hardware components

The hardware core of the M2M terminal is the GPRS communication module MC35i and the ARM processor AT91SAM7S64, and their interface design is shown in Figure 1. The M2M terminal has two RS232 serial ports for external use. By sending pre-defined digital commands, the M2M terminal can be started and shut down. When the M2M terminal is connected to the Internet, it only needs to send the encapsulated data to the M2M terminal through the serial port, and the M2M terminal will complete the function of sending data to the monitoring center.

System hardware components

GPRS module

The GPRS module is the core part of the M2M terminal platform. The design uses Siemens' GPRS communication module MC35i. This module includes CPU interface circuit, SIM card interface circuit and MC35i peripheral circuit. MC35i supports four GPRS coding protocols CS-1, CS-2, CS-3 and CS-4. The theoretical maximum transmission rate can reach 172kbps. It has complete GSM and GPRS functions and can be widely used in related M2M data transmission platforms. MC35i provides a standard AT command interface and an RS232 interface for connecting to external application systems.

ARM processor

The data transmission platform processor uses the 32-bit ARM7TDMI architecture processor AT91SAM7S64 produced by ATMEL. The chip is powered by 3.3V voltage and supports low power consumption mode. It has 64kB FLASH and 16kB SRAM, and has rich peripheral device resources, including 3 UART communication serial ports and 1 USB2.0 full-speed device. The high cost performance of the system can be achieved by using this chip to complete the system functions. The CPU module hardware circuit includes: clock circuit, JTAG interface circuit, RS232 interface circuit, etc.

Power Design

The system is powered by a 9V power supply, which is stepped down once by TI's LDO step-down chip UA7805 to reduce the voltage to 5V. The GPRS module MC35i requires a power supply voltage of 3.3V to 4.8V, and the power supply must be able to provide a peak current of 2A. Therefore, the 5V power supply needs to be input into the MC35i through a 0.7V voltage drop Schottky diode 1N5819, and a 25V, 1000μF electrolytic capacitor needs to be connected to provide enough peak current for the MC35i. The 5V power supply is stepped down to 3.3V through TI's power module REG1117-3.3 to provide power for the microprocessor and other chips.

Embedded Software Design

Using an embedded real-time operating system can more appropriately and effectively utilize CPU resources, simplify the design of application software, shorten system development time, and better ensure the real-time performance and reliability of the system. FreeRTOS is a microkernel embedded real-time operating system released on the Sourceforge website. It is a completely free operating system with the characteristics of open source code, portability, scalability, and flexible scheduling strategies. As a lightweight operating system, FreeRTOS provides the following functions: task management, time management, semaphores, message queues, memory management, etc.

FreeRTOS supports two scheduling algorithms: priority and rotating time slices. It can be set as a preemptive kernel or a non-preemptive kernel according to user needs. Based on FreeRTOS, this paper gives a software design scheme for M2M terminals to implement PPP negotiation and data encapsulation transmission.

Design GPRS connection task based on state machine

Due to reasons such as weak network and signal, the node may fail to connect to the GPRS network. The state machine-based structural design method is used to handle the errors generated at each stage, which can ensure that the module can establish a reliable connection with the GPRS network. The program state machine is shown in Figure 2.

Program state machine

Idle standby state: At this time, mc35i is in offline shutdown state, the node is in low power consumption mode, and the system is in this state after reset.

GPRS parameter setting state: The processor controls the MC35i module to enter this state after starting it. The module and necessary network parameters are set by sending AT commands. In order to ensure that all parameters are set successfully, a fault-tolerant retry mechanism is added to the software design.

PPP negotiation state: After the GPRS parameters are set, the PPP negotiation between the MC35i module and the GPRS network ISP (network service provider) is started by sending the AT*99***1# command. The LCPHandler() function is used in the software design to complete the LCP negotiation, PAPHandler() completes the authentication, and IPCPHandler() completes the IPCP negotiation. If the IP address of the ISP and this node is finally obtained, the PPPOVER state is entered, and data transmission can be carried out thereafter. Due to reasons such as the GPRS network, the PPP negotiation sometimes fails. At this time, the MC35i module should be restarted and then reconnected according to the state machine process.

UDP data transmission state: When the program uses UDP for data transmission, the program enters this state and performs UDP/IP encapsulation and parsing of data through the xDataTrsmtTask() task.

TCP data transmission state: When the node calls the uip_cionnect() function to establish a connection with the monitoring center, the program enters the TCP data transmission state and performs TCP-based data transmission.

Data packaging and transmission

Data transmission via GPRS needs to be transferred through the Internet network, so the data encapsulation must be TCP/IP protocol. In this paper, data encapsulation is performed using software. The data to be transmitted is encapsulated by the transport layer UDP protocol header, then the IP protocol header, and finally the PPP protocol. The format of the data transmitted to MC35i after encapsulation is shown in Table 1.

MC35i data format

MC35i transparently transmits the received data to the Internet network. Through the Internet network router, the data is finally transmitted to the monitoring center. The receiving end analyzes the received data according to the corresponding level to determine the target program of the data.

The system software design adopts a layered structure, from bottom to top: serial port driver layer (physical layer), PPP protocol layer (link layer), IP protocol layer (network layer), UDP protocol and ICMP layer (transport layer) and application layer. In the transplanted LwIP protocol stack, data encapsulation is achieved by establishing threads of corresponding functions in each layer. The bottom-level software provides function support for the upper-level software, and the upper-level software uses the bottom-level software to complete the writing and implementation of application programs. The software adopts a bottom-up design method to gradually implement the functions of each function in the system, and the implementation of each part of the function adopts a modular design method. Each task corresponds to a module

After each task is designed separately, it is finally managed uniformly by the FreeRTOS operating system. The communication between multiple tasks is achieved by using semaphores and mailboxes. The relationship between the main functions of each part of the software is shown in Figure 3.

The relationship between the main functions of each part of the software

After the received data is stored in the xQRxChars queue in MC35SerialISR(), the SemMC35Rx semaphore is sent to activate the PPPRxTask() task. The type of the data packet is determined by parsing the received data, and then the corresponding function processes the received data.

If the received data is the data of the application, the IPRx() function will determine whether the target host is correct, and then parse the data through the transport layer to determine the application that processes the data. Finally, the application parses the data and performs corresponding functions, such as sending data to the host through the serial port, sending control commands to the data acquisition system, receiving data from the data acquisition system and sending it, etc. When all the data in the receiving queue are processed, if no data is received after a delay of 250ms, the task will suspend itself by waiting for the semaphore SemMC35Rx. The data sending process is a reverse process.

The application creates a UDPTxTask() or ICMPTxTask() task according to the required functions and sends the data to the xAPPTxQ queue. The corresponding task then calls the IPTx() and PPPTx() functions to encapsulate the data and send the data to the XqTxChar queue, thereby waking up the MC35SerialISR() interrupt program to send the data to the MC35i through the serial port for transmission. To improve the real-time performance of the system, FreeRTOS in this article uses a preemptive kernel for scheduling. Using the FreeRTOS operating system to manage tasks simplifies the difficulty of software writing and improves the readability and portability of the program.

Summarize

Wireless data transmission and remote monitoring systems based on GPRS m2m products are currently hot topics of research at home and abroad. This paper uses a completely free operating system and TCP/IP protocol stack to provide a system design solution with the advantages of low cost, good performance, and scalability, providing a feasible design solution for data transmission in the field of remote monitoring systems.

Reference address:Design and research of m2m terminal based on mc35i

Previous article:Various applications of intelligent RFID systems in industrial control
Next article:Design of intelligent rescue robot based on AT89s52 single chip microcomputer

Recommended ReadingLatest update time:2024-11-16 16:54

The second in command of intelligent bus monitoring: GPRS and ZigBee
introduction In today's modern life, buses are the most important part of urban transportation. Their operating efficiency and service quality greatly affect urban traffic conditions and citizens' travel conditions. The important criteria for measuring operating efficiency and service quality are whether bu
[Industrial Control]
The second in command of intelligent bus monitoring: GPRS and ZigBee
Overview of the application of vehicle remote service system based on GPS/GPRS
With the development of the automobile industry, modern electronic control technology has penetrated into all parts of automobiles. The structure of automobiles has become more and more complex, and the degree of automation has become higher and higher. There is a growing shortage of maintenance technicians and expe
[Automotive Electronics]
Overview of the application of vehicle remote service system based on GPS/GPRS
Power quality online monitoring system based on GPRS technology
  0 Introduction   In recent years, with the rapid development of the electric power industry and the continuous expansion of the capacity of the power system, various distributed generation units have been gradually connected to the power grid, and the use of various nonlinear loads has also increased, causing the
[Microcontroller]
Power quality online monitoring system based on GPRS technology
Design of embedded alarm system based on GPRS and digital wireless
Abstract: In order to realize real-time monitoring of the safety status of the home environment and automatically dial a voice prompt or send an alarm text message when an alarm occurs, an embedded telephone alarm system based on GPRS and digital wireless technology is designed. The system uses the SoC (system
[Security Electronics]
Design of embedded alarm system based on GPRS and digital wireless
GSM/GPRS/EDGE Test Introduction
  GSM system is the abbreviation of Pan-European Digital Cellular Mobile Communication Network. It is the most mature digital mobile communication system currently developed. It is now renamed "Global System for Mobile Communication". It is the standard of the second-generation cellular system and the first cellular sy
[Test Measurement]
Research on GPRS communication system using single chip microcomputer
内容中广告结束 0 Introduction GPRS (General Packet Radio Service) is a wireless transmission method developed using the concept of packet switching. The GPRS network is implemented based on the existing GSM (Global System for Mobile Communications) network. Some nodes need to be added to the ex
[Microcontroller]
Research on GPRS communication system using single chip microcomputer
Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号