Design of Embedded Network Voice Communication Terminal Based on STM32 and μCOSIII

. Aiming at the application demand of voice communication between user terminals in the simulated training environment, a design and implementation method of embedded network voice communication terminal based on STM32 and μCOSIII is proposed. The hardware module of communication terminal is based on STM32 microcontroller, voice communication module, LCD display module and SD card storage module. The embedded real-time operating system μCOSIII is transplanted in order to enhance the real time and stability of the control system, and the user interface management system STemWin is used to manage LCD module. The signal exchange protocol of speech communication is designed, and the realization of the communication function software based on TCP/IP protocol is completed. In order to detect the voice communication function of communication terminal, a communication server software based on .NET Framework platform is designed, which is responsible for managing the communication terminal and forwarding the communication data. The experimental results show that the user interface of the communication terminal is good, the data transmission is stable and the communication function is reliable.


Introduction
With the rapid development of science and technology, the pace of all kinds of military and civil equipment is accelerated.The new information equipment has more advantages than traditional equipment on the degree of integration, efficiency and performance.But the high technology brings greater operational complexity for the operator, at the same time, there exists some problems of ensuring high cost, difficult maintenance, limited resources and other issues under the objective conditions, these problems hindered the new equipment to carry out a wide range of practical training.In order to solve this contradiction, all kinds of simulation training system come into being, Simulation training system which can simulate actual equipment function, provides the same and installing equipment operation, to achieve a good training effect.In many simulation training systems, the communication function of the user terminal is an important part of the system.In the existing simulation training system, voice communication based on Bluetooth [1] and wireless LAN [2] can meet the requirement of reliable communication of short distance, there is a big limitation in communication distance; voice communication based on CAN bus [3]

Systerm design
The design of embedded system includes two parts, hardware design and software design.Hardware is the foundation of realizing function, software is the core of realizing function, and the two parts are indispensable.The overall design of the system is introduced from two aspects of the hardware module and the software module.

Design of hardware module
The communication terminal hardware module is based on the microcontroller STM32F103ZET6 [4] which is the core of communication terminal, the man-machine interaction module, communication module, storage module and interface module were designed.The overall design of the hardware module is illustrated in Fig 1 .The human-computer interaction module with 3.5 inch TFTLCD touch screen, used to provide GUI interface display and user input function; communication module mainly includes audio capture and playback circuit which provides voice communication function; interface module provides a communication port between terminal and server for data communication, STM32 micro controller embodied with multiple USART serial ports, so use the serial port server convert serial network port to network port, which is used to connect to the network terminal; the storage module which use the SD card storage media is responsible for the preservation of data communication.

Design of software module
The design of communication terminal software follows the general rules of embedded system software, the utility model of embedded operating system and application software has the advantages of application software architecture on the operating system, to avoid directly facing the hardware platform, improve the software reliability, portability and extended application.
The overall architecture of the software can be divided into the device driver layer, the operating system layer and the application software layer from the bottom to the top.The device driver layer includes a driver loader and guide equipment; operating system layer by the kernel of embedded operating system, file management system and GUI management system, this paper adopts embedded real-time operating system μCOSIII [5,6] for communication terminal operating system, and transplants graphical interface management system STemWin for LCD touch screen management, at the same time, FatFs was also used for the management of storage devices such as SD; the application software layer all written by the users with independent task program, which achieves specific functions separately.

Circuit of voice communication
The audio driver chip used by voice communication module is VS1053B [7] developed by for Holland VLSI Company.

Design of voice communication's signal interaction
The premise of voice communication is communication terminals between the two sides have entered the communication connection state, the connection state is accomplished through a series of signaling interaction between server software and communication terminals, the signaling interaction process of communication terminals is shown in Fig 5 , terminal A is calling equipment and terminal B is called equipment.After sending the voice communication application signaling, the server sends the call through the parsing of the content of the signaling, and forward the calling application at the same time.If the response is received, the server will reply to the calling equipment.The server needs to record the communication state between the two sides in the process of forwarding the signaling.

Program design of speech communication
According to the different ways of beginning communication, voice communication can be divided into two modes, dialing and called.The two modes have different software flow, but there are some common program codes, and the software design process of voice communication module is shown in Fig 6 .In the called mode, the call is monitored through polling serial port, if the serial port receives the call request sign, then the interface jumps to the called display interface and waits for user's operation.It is considered as overtime with no operation for a long time, communication terminal will give up this communication, and add the number to the missed call records to remind users of missed calls, so that users can call back; if users choose to answer the call in the limited time, then terminal enters the voice communication program.When one of communication terminals receives ending call signal or hangs up the phone actively, this time of communication ended.By judging the call mode, the call information is added to the corresponding call records.In the dialing mode, the form of dialing numbers includes calling records, address book and number key, the content of calling application by three dialing modes is same.After receiving the reply response of the agreed call, terminal enters the call program.The context of calling procedure and the call end judging procedure is the same as the called mode, the difference is that after the end of the call, the number is added to the call record of the dialing mode.

Systerm test
In order to test the function of voice communication of communication terminal, we using C# language [8] and Socket programming technology to achieve the server software which is based on .NET Framework platform [9]

Conclusion
By analyzing the functional requirements of speech communication in simulation training system, a design and implementation method of embedded network voice communication terminal based on STM32 and μCOSIII is proposed, and the hardware platform and software system design are completed.Through the actual communication test, the network voice data transmission of the system is low in bit error rate, clear in speech effect, which satisfies the needs of speech communication in simulated training.The network voice terminal designed on the basis of STM32 microprocessor and UCOS III operation system has the characteristics of good stability, strong real time and extensibility, which has a certain reference value for the development of terminal equipment in the simulation training system.
has a long distance, but there is a big constraint in long distance communication data.Based on the high requirement of the simulation training system for communication reliability, an embedded network communication terminal based on STM32 and COS III is designed.The terminal has strong extensibility and can be integrated on other analog training systems based on Ethernet to realize equipment simulation training together.

Fig. 2 .
Fig.2.The Software Architecture of Communication Terminal

Fig. 3 .
Fig.3.The Circuit Connection of LCD Module

Fig. 5 .
Fig.5.The Signaling Interaction Process of Communication Terminals

Fig. 7 .
Fig.7.The Physical Connection of the Test System

Fig. 8 .
Fig.8.The Test Result of speech communication The function of the whole software system is realized through the design of the configuration of each task priority, synchronization and communication between tasks.The communication terminal software architecture is shown in Fig 2.