Design of data transmission module based on audio interface

Abstract Because the data interfaces of mobile terminals are different, data exchange is not convenient. In order to try to expand the application of the audio interface, a communication protocol is designed to ensure the reliable transmission of analog signals. The downloadable mobile phone software was developed to perform differential Manchester decoding on the audio signal collected from the audio input interface and sent to the audio output interface. The program consists of 3 threads. When the data transmission service program is started on the mobile phone, the embedded system and control software are used to realize the encoding and decoding of the digital data. The data signal is coded and processed in the main control module, and then read by the control device. The external media is fetched and written, and the data is stored. The thread design, transmission algorithm and protocol format are studied in the design. The experiment proves that the design can meet the synchronization requirements of serial communication and ensure the stability of data transmission.
Key words audio interface; data transmission; module design; data format

The mobile terminal operating system application software is powerful, and the smart phone application has exceeded the original function of the call. The development of various mobile applications fully reflects the trend of intelligent and open. In mobile applications, if you want to exchange information with external devices, you need to pass a dedicated data interface, but the data interfaces of mobile phone manufacturers are different, and external devices are difficult to balance. Some manufacturers restrict the opening of data interfaces or charge high usage fees. Or there are strict qualification requirements for peripheral manufacturers, and various restrictions restrict the direct communication between intelligent terminals and external devices.

1 The structure design interface of the data transmission module is the connection circuit between the intelligent terminal system and the outside world, and has the following functions: (1) Addressing capability. The sent chip select signal is identified. (2) Input/output function. It is determined whether the current input operation or the output operation is performed based on the read/write signal. (3) Data conversion function. Conversion of parallel data to serial data or conversion between two different data formats. (4) Signal identification. Identify the ready signal, busy signal, and so on. (5) Interrupt management. The function of issuing an interrupt request signal, receiving an interrupt response signal, and transmitting an interrupt type code. (6) Reset. A reset signal is received to restart the interface itself and the connected peripherals. (7) Programmable. Use software to determine how it works, and use software to set the relevant control signals. (8) Detection information. Some interfaces can also set their detection information according to the specific situation.
The data transmission method based on the audio input and output interface can make up for the inconsistency of the data interface and expand the application of the audio interface. In the implementation of the transmission of audio analog signals on the system to exchange digital signals, the design difficulty is how to communicate data through analog signals, the need to specifically design a strict communication mechanism or communication protocol to ensure reliable data transmission based on the phone audio input and output interface.
If the terminal is used as the master device, the bit clock signal, the command selection signal, and the data are generated therefrom, but in the integrated system, it is difficult to identify the transmitting end. The data transmission protocol using differential Manchester coding was designed. The downloadable mobile phone software was developed, and an embedded system that implements codec and transmission protocol was designed for peripheral storage devices. The structure of the module is shown in Figure 1.

This article refers to the address: http://

a.JPG


The external device performs data communication with the intelligent terminal through the audio input and output interface, and the data signal is coded and processed in the main control module, and then the external medium is read and written by the control device, and the data is stored. In the specific mode of data transmission, the peripheral device sends a data signal to the mobile phone through a connection line inserted into the external microphone audio input interface or the audio line input interface of the mobile phone, and the peripheral device is inserted into the external audio interface of the mobile phone or the audio line output interface. The connection cable is connected to receive the data signal sent by the mobile phone.

2 hardware design of the data transmission module The external data transmission device is composed of a filter circuit, a main control module, a codec circuit, and a read/write device. The filter circuit separates the fixed frequency AC signal and the data signal; the read/write device comprises a standard Manchester codec circuit, the read/write decoding circuit adopts the BS730Q read/write dedicated decoding chip, and adopts single track read and write; the main control module circuit adopts low power consumption. The ARM microcontroller has a programmable working register inside, which can conveniently communicate with the host. However, it must have its own data protocol. The process of encoding and decoding the bidirectional signal by the main control module is: (1) The main control circuit module will The Manchester encoded data information transmitted by the reading and writing device is decoded into national standard data, and then encoded into a differential Manchester encoded data signal, and sent to a transmission line connecting the mobile phone microphone interface or the line audio input interface. (2) The main control circuit module receives the differential Manchester encoded data signal from the transmission line connecting the mobile phone earphone interface or the line audio output interface, decodes it into national standard data, and encodes it into standard Manchester encoded data information, and sends it to the reading and writing device. The circuit design is shown in Figure 2.

b.JPG



3 software design of data transmission module
3.1 Design Thread
Communication The mobile phone terminals of both parties are implemented by software method, and the structure is shown in Figure 3. The audio signal collected from the audio input interface is differentially decoded by the program and sent to the audio output interface. The program consists of three threads. When the data transmission service program is started on the mobile phone, three threads are formed: (1) creation An audio AC sending thread that is responsible for setting the output maximum volume, generating a fixed frequency audio AC signal and transmitting it to the audio output line. (2) Create a thread that listens to the audio input interface data, and is responsible for performing differential Manchester decoding on the audio signal collected from the audio input interface, and decoding the output data stored in the receiving data buffer, and calling the callback function registered by the external business program to notify The external business program registers to get the incoming data. (3) The main thread loops to wait for the data storage event in the data buffer to be sent. When the external business program is to send the data to be sent in the shared transmission data buffer when the data is to be sent, the data storage event occurs, the main thread The thread fetches the data to be sent, performs differential Manchester encoding, and sends it to the audio output interface using the operating system's audio control interface function.

c.JPG


3.2 Data format The data signal transmitted on the audio input and output lines adopts differential Manchester coding. Without carrier modulation and demodulation, the data coded signal is transmitted directly on the audio line. The specific agreement mechanism is as follows:
(1) The data transmission method based on the audio input/output interface is a serial communication method, which refers to the standard synchronous serial communication protocol, and adopts differential Manchester coding, which is characterized in that at least one transition per transmission bit is adapted to Data can be transmitted on audio input and output lines that can transmit AC. The intermediate signal hopping is used in the communication signal to indicate 0 or 1 of the transmission. If the first hop is positive, the hop indicates 1, and if the negative hop indicates 0, the subsequent hop is differentiated from the previous hop. It is determined by the result of comparison that it is 1 or 0. If the current bit hopping direction is the same as the hopping direction of the previous bit, it is 0, otherwise it is 1. With differential Manchester coding, the synchronization of the two sides of the communication allows a difference of half-time, and the data received during the synchronization half-time is not affected.
(2) Data transmission is duplex mode. The transmission of data from the mobile phone uses the audio output line. The data transmission into the mobile phone uses the audio input line. Before the data is sent, the bus is ready for idle, and the receiver is prompted to receive. The bus idle preparation is expressed by continuously transmitting 0 bits or more.
(3) Serial communication uses the frame start flag for synchronization. The frame start can start from any bit. The frame start flag of serial communication adopts the same identifier as in the standard serial communication, that is, 6 consecutive transmissions are performed. That is, the transmission character 0x7e indicates that the frame start flag is transmitted.
(4) Serial communication uses the end of frame flag to indicate the end of this data transmission and enter the bus idle state. Seven consecutive 1s are transmitted, that is, the transmitted character 0x7f indicates that the end of the transmitted frame. In serial communication, the unit of data transmitted on the line is bit. When transmitting a Byte, the highest bit is sent first, and finally the lowest bit is sent. When there is no interval between bytes when transmitting data. When sending data, there is a possibility that there are six consecutive 1s in the data, which is the same as the frame start flag and the end of frame flag, which may cause communication ambiguity. To eliminate ambiguity, it is stipulated that when transmitting data, after sending 5 consecutive 1s, an invalid 0 must be sent, and then other data is sent. After receiving five consecutive 1s, it is necessary to delete the 0 that is received next. The consecutive 5 1s are not necessarily in 1 Byte. For example, two Bytes 0x0f and 0xc0, each Byte has no consecutive 5s, but when 0x0f is sent first and 0xc0 is sent, there are 5 consecutive 1s. Now, you need to dynamically insert and delete a 0.
(5) In the serial communication based on the audio input/output interface, the encoded information stream is generally represented in block form, and one information flow block includes: block header and block load information, and the data frame format transmitted on the line is as shown in FIG. 4 .

d.JPG



4 Conclusion According to the general principle of embedded development, the structure of the data transmission module is designed, and then the hardware design of the data transmission module is completed. In the software design, the control program of the main control system and each related circuit is completed, and the data is transmitted by using the differential Manchester code. It can meet the synchronization requirements of serial communication and ensure the stability of data transmission.

The flame control is accurate and belongs to preheating small convection premixed combustion. Specially designed for western food,with automatic flameout protection of high safety

European Gas Hob

Steam Oven,Table Ovens,Electric Steam Oven,Home Steam Oven

Xunda Science & Technology Group Co.ltd , https://www.xundatec.com