Font Size: a A A

Research And Implementation Of Virtual Multi-serial Port Concurrent Communication Under Android Platform

Posted on:2020-12-10Degree:MasterType:Thesis
Country:ChinaCandidate:D G RanFull Text:PDF
GTID:2428330605466653Subject:Computer technology
Abstract/Summary:PDF Full Text Request
With the development of the Android system in the fields of intelligent control,industrial automation and Internet of Things,it has been applied to millions of smart devices.There are several communication methods between the Android powered controller and the sensor,among which the serial communication is widely utilized due to its advantage on easy implementation,low cost,compatible with the industrial devices and fewer system resources occupation.However,the existing Android system does not provide any interface for serial communication.To realize the serial communication,the most popular way is to port the source code of the serial port which provide by Google or encapsulate the underlying framework interface libraries by JNI.These solutions can realize the end-to-end communication between devices but failed to meet the requirements of multiple devices communicate with controllers through the same serial port at the same time,which limits its application in the field of automation control and Internet of Things.To solve this problem,a multi-serial communication method based on the Android platform is proposed in this thesis.On the one hand,this method implements a multiplexer combined with hardware and software based on the idea of multiplexing,which provides a high-speed communication link for multiple low-speed devices to realize the communication at the same time.On the other hand,multiple serial ports are virtualized based on the idea of the virtualization,which provides multiple serial port services for the upper layer applications.The main works and contributions are as follows:(1)In order to improve the data transmission efficiency of multi-serial communication,this thesis proposes the MRSF(Minimum Remaining Space First)algorithm,which is implemented on the resource-constrained STM32 microprocessor.MRSF determines the task priority based on the remaining buffer size of the receiver and the waiting time of the task.The smaller the remaining buffer and the longer the waiting time,the higher task priority,which has a higher scheduling priority.(2)For the problem of data loss and buffer overflow caused by sharing the same buffer when data receiving and decoding,the double buffering mechanism is adopted.The double buffering is utilized for data reception and decoding in turn.To improve system stability,a decoding buffer is provided to receipt and decode data separately.(3)There is no support for serial communication related API issues for Android systems,A virtual multi-serial data stream distribution framework is proposed and implemented on the Android system based on the Reactor event processing model,multi-threading and I/O multiplexing.The virtual multi-serial channel is implemented by named pipe and the serial communication API is encapsulated by JNI technology to provide multiple serial port services for the application layer APP.(4)This thesis realizes the physical expansion of multiple serial ports based on the STM32 processor.The ?C/OS-II real-time operating system is ported,which makes the system more efficient,and improves the real-timing and stability of data forwarding.To evaluate the efficiency and effectiveness of the proposed system,this thesis designs and implements a low-cost,multi-serial port communication application on the Android platform.Combined with the Uart Assist serial debugging software on the PC,extensive functional tests and performance tests are conducted.The experimental results show that the system meets the demand of different devices for real-time and accuracy serial communication.The serial port parameters such as baud rate,data bit,stop bit and parity bit can be independently set by software,which is flexible,convenient,low in cos and easy to expand new features.
Keywords/Search Tags:Multiple Serial Port, Multiplexing, MRSF Scheduling Algorithm, Double Buffer Mechanism, Android System, Real Time Operation System
PDF Full Text Request
Related items