Abstract: As a new service of GSM network, GPRS data transmission service has been paid more and more attention by system operators and system developers. Using the GSM network as a wireless data transmission network, various applications with extremely promising prospects can be developed. This paper presents the design of a communication controller based on GPRS data transfer service, and elaborate the realization principle of the controller in detail.
GPRS (General Packet Radio Service) is a new bearer service developed on the existing GSM system. The purpose is to provide GSM users with packet-based data services. Various applications based on this business are also booming. Using the GSM network as a wireless data transmission network, a variety of promising applications can be developed, such as two-way transmission of wireless data, wireless remote detection and control, etc. Typical applications are: industrial control, environmental protection, road traffic, business finance, mobile office, retail services, etc.
GPRS allows users to send and receive data in end-to-end packet transfer mode, without the need to use network resources in circuit-switched mode; thus providing an efficient and low-cost wireless packet data service, especially suitable for intermittent, bursty Sexual and frequent, small amounts of data transmission are also suitable for occasional large data transmission.
The GPRS wireless communication controller (hereinafter referred to as the controller) designed in this article, embeds the TCP / IP protocol stack and uses an industrial-grade GPRS module; it is suitable for the case where the host does not have a TCP / IP protocol stack but uses serial communication, such as a microcontroller Data acquisition and transmission system.
1 GPRS network data transmission and reception
The terminal equipment is connected to the controller in a serial manner and communicates with the GSM base station, but it is different from circuit switching or data calls. GPRS data packets are sent from the base station to the SGSN node, rather than connected to the voice network through the mobile switching center MSC. The SGSN communicates with the gateway support node GGSM. The GGSN processes the packet data accordingly and sends it to the destination network, such as the Internet or X.25 network, see Figure 1. The IP packets from the Internet that identify the address of the mobile station are received by the GGSN, then forwarded to the SGSN, and then transmitted to the mobile station.
When the controller is working, the user's higher-level system sends work instructions and data to the controller. The data is converted by the IP module into a TCP / IP protocol and converted into an IP data packet, which is then sent to the SGSN by the MC35 module in the form of a GPRS data packet.
Since the working mode of the GPRS network is based on the IP address guide, the target server side is not the access controller to connect with the terminal device, it only needs to simply access the Internet and have the IP address assigned by the public network. At the same time, because the GPRS terminal product itself is dynamically assigned an IP address by the network provider, it does not have an IP address itself when it is not in the connection standby state (in the connection, the IP address of the module is the local area network IP in the mobile backbone network, Unable to be parsed by the public network server, the system of dynamic allocation makes obtaining more meaningless than the IP address). Therefore, before the connection between the server and the terminal has been established, it is difficult for the target server (which can convert short messages into command content) to control the terminal device and the controller. The controller must be initialized accordingly, and the device terminal actively sends data to the server to connect.
2 The hardware implementation inside the controller
The controller is composed of four parts: a microcontroller system embedded in TCP / IP, an MC35 module, a power supply, and an external interface.
In the design, considering the dual serial port performance and high-speed full static CMOS design, the embedded single-chip system selects the W77E58 chip from Taiwan Winbond as the processor chip of the MCU module. It is a high-speed, MCS-51 instruction-compatible microcontroller with no extra instruction cycles. It runs the same instruction 1.5 to 3.0 times faster than the traditional 8051 at the same clock frequency. It is completely static CMOS design, operating voltage is 4.5V ~ 5.5V, there is 32KB on-chip program ROM, there is 1KB SRAM inside, the maximum clock frequency can reach 40MHz; there are dual pointers, dual serial ports, 13 interrupt sources, 3 16-bit timer. The single chip microcomputer W77E58 is directly connected to the MC35 module through the serial port 1 to complete the initialization of the MC35 module and the data transmission and reception functions based on the GPRS service; at the same time, the serial port 2 extends the MAX232 standard serial port to exchange data with other embedded systems or PCs. Figure 2 is a hardware block diagram of the system.
The MC35 module is a GSM dual-band GSM900 / GSM1800 wireless module produced by Siemens. It supports 2 operation modes: one is the circuit-switched data mode CSD, supports voice, data, SMS and FAX services; the other is the packet-switched mode GPRS, which uses multiple time slots and supports CS1-CS4 encoding. The biggest difference between the two is that there is no need to dial when GPRS transmits data. The selection of 2 modes is realized by AT command. The MC35 module provides a 40-wire ZIF interface.
The power supply part provides suitable power supply for the single chip microcomputer system and the GPRS module. The external interface part includes an 8-pin data interface, SMA (Radio Frequency Coaxial Connector) antenna interface, and SIM (Subscriber IdenTIty Module, user identification) card connector interface. Table 1 is a detailed description of each pin.
Table 1 External interface pin description
|Features||name||Pin number||I / O||Signal level||Comment|
|Force reset||RST||1||I / O||When the module is in idle or data transmission state, this pin is pulled down below 0.45V (requires at least 0.1mA pull-down capability) for 3.5s to reset the system. This pin also serves as the system watchdog signal output, which can be used to monitor the system working status fout, min = 0.16Hz fout, max = 1.53Hz||Under normal circumstances, this pin is in the watchdog signal output state and the output current is very weak (0.01mA), so it must be in a high-impedance state; there must be no external pull-up circuit|
|RS232||RXD||2||I||This group of pins is a standard RS232 level signal, which can be directly connected to a PC||If you connect to the Internet on the PC, you need to use CTS and RTS, other communication methods show that these two pins are not needed|
|SGGND||8||0||SGGND is the RS232 signal ground, connected to GND inside the module|
|RS485||A||6||I / O||The group of pins is a standard RS485 level signal, and 120 matching resistors have been added inside the module||Photoelectric isolation circuit inside the module|
In order to make the controller run stably and reliably, its watchdog circuit has been carefully designed.
3 Software interface of the controller
In this design, need to use TCP / IP protocol to complete the GPRS business data packaging and unpacking. Due to the limited resources of W77E58, how to complete the necessary functions on the limited resources is the relationship between the implementation of the embedded TCP / IP protocol, which is to simplify the protocol reasonably.
The TCP / IP protocol is a standard protocol suite designed for a wide area network (WAN). It can be described by a model divided into four levels: the data link layer, the Internet layer, the transport layer, and the application layer. The layered model and protocol are listed in Table 2.
Table 2 TCP / IP protocol structure
|Application layer||HTTP, Telnet, FIT, SMTP, SNMP|
|Transport layer||TCP, UDP|
|Internet layer||IP, ARP, RARP, ICMP, IGMP|
|data link layer||Ethernet, X.25, SLIP, PPP|
The application layer (applicaTIon) is responsible for handling specific application details, and only the HTTP protocol is implemented in this system.
The transport layer mainly provides end-to-end communication for applications on 2 hosts. TCP protocol is to provide high-reliability data communication for two hosts. Here, TCP transmission control protocol is adopted.
The functions of the Internet layer (Internet) are addressing, addressing, data packaging and routing. All data on the Internet is transmitted in the format of IP datagrams, and its greatest particularity is to provide unreliable and connectionless data packet delivery services. In the GPRS service, each link will be assigned an IP address, so the ARP / RARP protocol is used to complete the mapping of the IP address and the physical address (that is, address resolution), and the ICMP protocol is used to determine whether the network is connected.
The task of the data link layer (link) is to send the frames to be sent to the line, and take the frames to be received from the line. The GPRS service uses IP Over PPP to achieve data terminal access. This part of the function is controlled by the single chip microcomputer MC35 module, using PPP protocol to achieve.
When the data packaging processing program processes data, each layer adds its own information to a data header, and this data header is wrapped into the data body by the protocol of the next layer. When the data unpacking processing program receives the GPRS data, it strips off the corresponding data header and treats the rest of the data packet as a data body.
In occasions with high application requirements, it is usually necessary to support the completed TCP / IP protocol family, and it can also be done in embedded systems; however, considering the cost and specific applications, it is not necessary to include all TCP / IP protocols Family. It can be seen that the TCP / IP protocol needs to be reasonably tailored to meet the situation of small ROM systems.
Before using the MC35 module's GPRS service to browse HTTP and other functions, the system must first activate the PDP connection of the GPRS network. The single chip microcomputer initializes the MC35 module and receives and sends data through the correct AT command and GPRS command set, and its working process is shown in FIG. 3.
After the MCU is powered on and reset, it first initializes the MAX232 and completes the negotiation with the external module, such as the baud rate and whether there is a parity check. Next, initialize the MC35 module through serial port 1 to check such conditions as the SIM card, GPRS network coverage, and signal status. Next, perform an interrupt scan to monitor whether data is coming. For data, if it is external data, start the data packaging process; if it is GPRS data, start the data unpacking process. If there is no data, the system enters the power saving mode. In the process of data packaging, if it is detected that the signal of the system is not good, the network connection is not smooth, or it is not a GPRS network coverage area, it will perform data transmission buffer processing, and at the same time put the data into the transmission queue to be sent.
This article uses the embedded TCP / IP protocol to realize the control of the MC35 module on a high-speed 8-bit microcontroller and the data transmission function of the GPRS service; it has the advantages of fewer peripheral components, simple circuits and low system cost. The GPRS wireless communication controller designed in this paper has been used in the environmental protection sewage treatment system in Dongguan City, Guangdong Province since January 2002. The operation effect is good. Practice has proved that the product works stably and reliably.
Home Ceiling Fan,Ceiling Fan Style,Modern Decorative Fan,Traditional Decorative Fans
Jiangmen MagicPower Electrical Appliances Co.,Ltd. , https://www.magicpowerfan.com