Minimum SMS sending and receiving system design with USB interface
From: http://www.c51bbs.com/c51blog/user1/698/archives/2005/3455.shtml
Short Message Service is a basic wireless service on mobile networks. It is a process of storing and forwarding information on mobile networks. However, it is inconvenient to edit short messages with a common mobile phone. Input and display are limited. Of course, they are not suitable for industrial applications and do not exist in PCs. This short message sending and receiving system is generally based on the RS 232 CD * 2 serial bus, which is not only difficult to install, but also limited by the number of computer slots, addresses, and resource interruptions, it is impossible to mount many devices. In some scenarios with strong electromagnetic shielding capabilities, it is impossible to perform electromagnetic shielding on the sites, leading to information distortion. This design uses the GSM network as the data wireless transmission network, and is developed by using the TC35I module that supports the GSM network and a single chip microcomputer with a USB interface.
1. system structure features and main Devices
The system is mainly composed of the SMS receiving and receiving module and a single-chip microcomputer that monitors the dual functions of USB interfaces, that is, the TC35I module of Siemens and the c8051f320 of cygnal. System diagram 1. In this design, the TC35I terminal is connected to the computer (through the USB interface, the TC35I terminal supports the gsmu AT Instruction Set), and the short message sending and receiving software can be compiled by itself, use the Super Terminal function of the PC to send and receive short messages. The system supports point-to-point bidirectional sending and receiving in both Chinese and English. A maximum of 70 Chinese characters and 160 English characters can be sent at a time. Once a message is sent, the sender will receive a notification that the message is successfully sent. It can also send a group of up to 10 users at a time, and has the phone book function. This terminal has the features of random sending and receiving, real-time receiving, instant reply, and low cost.
Figure 1 system diagram
1.1 Introduction to The TC35I Module
Currently, common GSM modules in China include waecome's wmo2, Ericsson's dm10/dm20 series, ZTE's zxgm18 series, and Siemens's TC35i. Among them, Siemens TC35i series modules are cost-effective and have domestic radio device access licenses. This design selects TC35I from Siemens.
TC35I is an industrial GSM module that supports short messages in Chinese. It works in the egsm900 and GSM 1800 dual-band, and the power supply range is 3.3 ~ 5.5 V, capable of transmitting voice and data signals. The power consumption in egsm900 (class 4) and GSM 1800 (class 1) is 2 W and 1 W respectively, connect the SIM card reader and antenna respectively through the Interface connector and antenna connector. The data interface (CMOs level) of TC35I can transmit commands and data in two directions through the AT command. The optional baud rate is 300 B/S ~ 115 kb/s, with an automatic baud rate of 1.2 kb/s ~ 115 kb/s. It supports SMS (Short Message Service) in the text and PDU formats, and can be restarted and recovered through AT commands or shutdown signals. TC35I consists of six parts: Power Supply Module (ASIC), flash memory, zif connector, and antenna interface. As the core of TC35I, the baseband processor processes voice and data signals in GSM terminals and covers all analog and digital functions in cellular RF devices. Supports FR, HR, and EFR voice channel encoding without additional hardware circuits.
1.2 introduction to c8051f320
USB features a unified connection interface for all peripheral devices. Different plugs and sockets are designed with a uniform specification, which solves the problem of which device plug should be connected to which interface. As a general interface for peripherals, USB bus interfaces have incomparable advantages. Speed performance is a prominent feature of USB technology. It supports hot swapping and is a real plug-and-play device that supports bidirectional and synchronous transmission to ensure the needs of certain devices that need to connect data streams. Before developing the USB device, you must select an appropriate USB controller based on the specific requirements. There are two types of USB controllers available on the market: single-chip microcomputer (MCU) with USB interface or pure USB interface chip. I chose cygnal's c8051f320 chip as the former chip.
Cygnal's c8051f series single-chip microcomputer is an integrated hybrid signal chip system Soc. It has a fully compatible Microcontroller with the MCS-51 kernel and instruction set, with a USB transceiver, fully compliant with USB protocol 2.0, supports 12 Mbps full speed transmission or 1.5 Mbps low speed transmission, clock recovery, no extra crystal oscillator is required (based on design habits, you can also use an external crystal oscillator). Eight endpoints are provided, and the transmission type and transmission direction of each endpoint are freely configured. In addition, it is integrated with 1 kb usb sram and USB transceiver, built-in 16 KB flash memory and 256 B internal RAM, as well as access to external Data Memory RAM, that is, xram. It can also provide enough storage space for the firmware without the need to expand the external memory. More importantly, the c8051f320 contains a C2 (Cygnal2-Wire) debugging circuit, through the 2-foot C2 interface using the Development Kit, can be non-intrusive, full speed in the system debugging. In addition, these two feet are public, and there are other functions, so the PCB design is relatively simple.
2 hardware system circuit design
The system uses cygnal c8051f320 as the control chip. Cygnal c8051f is a single-chip microcomputer compatible with the MCS-51 kernel, with 8 KB flash built-in and 256 bytes RAM. Because of the built-in flash, the circuit design can save external program memory, reduce the PCB Area, and improve the reliability of the entire system. In this GSM system, there are some basically unchanged or few changes, such as the number, number, and short message center number of the sub-machine, which can be directly written into the flash of the program as constants. The single-chip microcomputer communicates with TC35I through a serial port. The single-chip microcomputer receives external information from TC35I and communicates with the PC through a USB interface.
Figure 2 regulated power supply circuit
2.1 regulated power supply circuit
The minimum operating voltage is 5 v dc. Due to the sudden power consumption peak of the TC35I module can reach 3 A, the voltage regulator must be sufficient to provide the rated current. In addition, the power supply indicators not only have voltage, but also the power margin and other indicators must meet the requirements. Therefore, the design scheme in Figure 2 is adopted. In this system, the switching power supply chip lm7805 to complete the conversion of 12 V to 5 V, the power supply circuit is mainly composed of lm7805 and the AS1117-3.3 of the two three-end regulated power supply module, power Supply Module AS1117-3.3 receives lm7805 input 5 V level, the output for the entire Microcontroller System to provide + 3.3 V operating voltage, connected to the zif connector 1 ~ The 5-pin provides a charging voltage of + 5 V and 500 Ma for TC35i. The output of the power supply is basically not affected by external input changes, and electromagnetic interference is effectively eliminated.
2.2 Impaired Glucose Circuit
For the control of the TC35I module, the glucose signal is very important. Only the correct glucose signal can make the TC35I module run normally. After the system power-on, in order to make TC35I into the working state, must add a delay greater than 100 MS low pulse, level decline duration cannot exceed 1 ms. The supply voltage of the TC35I cannot be lower than 3.3 V when the drive is impaired. Otherwise, the TC35I cannot be activated. Circuit Design 3. The startup circuit consists of an Open-drain pole transistor and a power-on reset circuit. In order to ensure the normal start of the entire system, it is required that when the power supply is powered on, the system must maintain a low level greater than 100 ms before jumping to a high level. In the circuit board, the RC circuit is used to complete the process, the descent time of the signal is less than 1 ms. After the device is started, the signals of the impaired glucose feet should be kept high. After the power supply is powered on, the + 5 V power supply uses the resistance to charge the capacitor, so that the voltage on the positive pole of the capacitor increases slowly. After about 100 ms, the high potential is reached, so that the Schmidt trigger is flipped and the system is reset. After the device is started, the system maintains a high level (3.3 V ).
TC35I data interface is directly connected to PC through USB cable. The data interface complies with the DCE itu2t RS232 internal switching circuit standard to Implement Asynchronous Serial Transmission and receiving.
2.3 other TC35I Circuits
TC35I uses an external SIM card. The zif connector has 6 pins as the SIM card interface, and the SIM card also has 6 pins corresponding to it. The SIM card is connected to TC35I in this way: on the sim, The ccrst, ccio, cccl, ccvcc, and ccgnd are directly connected to the TC35I end with the same name through SIM card readers, and CCIN is suspended, the CCIN on TC is connected to ccvcc through a 3.3 kb resistor to detect whether the SIM card is properly inserted. This connection method is determined by the SIM card reader. This section is not provided because the circuit is simple.
The sync pin of TC35I has two working modes: one is to indicate the power increase in the transmitting status, and the other is to indicate the working status of TC35I. You can use the at sync command to switch between them, this module uses the latter one. When the LED is off, TC35I is off or sleep; when the LED is 600 Ms on/600 Ms off, it indicates that the SIM card is not inserted or TC35I is in network login; when the LED is 75 Ms on/3 s off, it indicates that TC35I has logged on to the network and is in the standby status.
2.4 MCU peripheral circuit
The high-performance microcontroller chip c8051f320 with built-in USB interface of cygnal simplifies the design of hardware. The single-chip microcomputer implements the USB interface function and controls the module. Because c8051f320 is a single-chip microcomputer with a USB interface, the whole hardware part is similar to the development of general Single-Chip Microcomputer application systems, the communication between the module and the single-chip microcomputer can be realized only by connecting the 40-foot zif socket through port ipv5 and IPv4. The following issues should be paid special attention to during the design: in the external crystal, it is necessary to connect the 10 m Ω resistance at both ends of the crystal, the crystal shell is best grounded, And the wiring is as short as possible, minimize interference. To quickly and successfully develop a USB device, correct and reasonable debugging methods are essential. The JTAG port used for design and debugging should be pulled up on TCK with 3.3 V, and the pull-up resistance is 4.7 kb. The single-chip microcomputer has 32 pins. for unused I/O ports, it is best to use a 100 Ω resistor to drop down to the ground. This helps protect the I/O port.
3. Software Design
The text message sending system with USB interface includes both hardware design and software design. The software design is briefly introduced below. The Software Design of the USB application system is divided into three parts: firmware on the USB peripheral end, client driver on the host operating system, and host application software. The 8051f320 firmware program controls the operation of the entire system and processes various USB requests sent from the PC to complete data transmission between them. The firmware contains a total of 7 program files. It responds to various USB standard requests from the system and completes data exchange and event processing. The single-chip microcomputer controls TC35I through a serial port, and the control method adopts a standard at command set. Because in the GSM standard, the Chinese encoding adopts unicode encoding, rather than the current domestic commonly used GB-2312 encoding, it also needs to convert Chinese encoding, In order to display the Chinese font. Therefore, when sending short messages, user data must be encoded in PDU format. To enhance the hardware function, it is best to put this part in the firmware. These underlying driver functions facilitate the compilation of upper-layer protocols. More importantly, they provide a hardware abstraction layer. When the underlying hardware is changed, you only need to change the underlying driver function, while the Code of the Upper-layer function remains unchanged. On this basis, write the application layer program. The Host application software communicates with the system USB di through the customer driver to realize the USB data transmission.
Figure 3 impaired access circuit
In USB transmission, four transmission types are defined, namely control transmission and interrupt transmission, because the types of peripheral devices are different from those of applications) bulk transfer and isochronous transfer ). Note that a slow device only supports Transmission Control and transmission interruption. Interrupt transmission is used in this system.
The writer uses Keil C51 to design the firmware, and uses Visual C ++ 6.0 in the Driver Studio environment to design the USB driver, finally, use visual c ++ 6.0 to develop and generate the application software and related instructions. This design fully adopts the Windows style, allowing users to quickly use this device.
4 Conclusion
The TC35I module of Siemens and the minimal system of c8051f320 of xinhualong company are used for design and development, which is simple and easy to use. The development cycle is short and has a USB interface, which improves security and reduces the complexity of on-site staff, easy to use for engineering practice. In this paper, the function of sending and receiving text messages is realized through the computer, and the program control is implemented by using the C51. On this basis, the software and hardware can be modified and further developed to implement other functions, for example, mobile Terminals can be used to check various information and control field equipment of various projects. In short, as a wireless communication system, this system has a wide range of application prospects.