Realization of real-time network communication and LCD display in ARM11 embedded system

Publisher:HarmoniousDreamLatest update time:2011-11-15 Source: 电子产品世界Keywords:ARM11 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Abstract: Through the study of real-time network communication and LCD display under Linux of ARM11 embedded system, the network communication protocol and LCD driving mode are analyzed. Under the ARM11 embedded system, an LCD display program that directly reads and writes GPIO is designed, and the dual-threaded working mode of network terminal server and client is realized, which solves the problem of real-time and reliability of network communication. Practical application shows that this method has fast LCD display speed, strong real-time and good reliability of network communication, and high resource utilization of ARM11 and computer.
Keywords: ARM11; real-time network communication; LCD; Linux

0 Introduction
The main frequency of ARM11 is 533 MHz, and the maximum can reach 667 MHz, which is 10 times higher than that of ARM7. It has more abundant on-chip resources, faster processing speed and stronger functions. Based on the above characteristics, ARM11 can fully adapt to the design of network terminals with strong real-time performance.
In the design of network terminal with ARM11 as the core, LCD is required to display various parameters of network communication and working status of equipment in real time. The display content of LCD is controlled by the instructions in the network transmission data, and the operation data of the network terminal is also transmitted to the computer through the network. Therefore, network communication and LCD display require strong real-time performance to reasonably use the resources of computer and ARM11, so as to improve the operation efficiency of the system.
Based on the ARM11 processor S3C6410 platform and the Linux operating system, this paper designs a method to directly control LCD display in the ARM11 core, and uses TCP/IP protocol to design a terminal working mode that acts as both client and server.

1 Analysis of the real-time communication characteristics of ARM11 network terminal
1.1 Data flow analysis
In the system where the computer communicates with ARM11, the processing speed of the computer is much faster than that of ARM11. If the tasks with large workload such as data processing are assigned to the computer, the resource consumption of ARM11 can be greatly reduced, and ARM11 can respond to other operations faster. Therefore, in order to reduce the time of ARM11 display tasks, the data processing of ARM11 to display pictures can be handed over to the computer. The computer processes the data according to the data requirements of ARM11 display and then transmits it to ARM11 through the network to complete the LCD display. In addition, the ARM11 network terminal also needs to transmit the device working status information to the computer, and the computer also needs to transmit some control commands to the network terminal.
1.2 Communication protocol analysis
Network communication inevitably involves the issue of communication protocol. The commonly used network protocols are UDP protocol and TCP/IP protocol. In network communication with high real-time requirements, it is hoped that it can be sent when it wants to and received when there is data. Of the two protocols, UDP is more in line with this requirement, but it cannot guarantee the effectiveness of data transmission. When there is a lot of data, serious packet loss may occur, especially for data such as LCD display pictures, which are large and frequently transmitted, which may seriously affect the LCD display. This is unacceptable. In contrast, the TCP/IP protocol can guarantee the effectiveness of data transmission.
In the TCP/IP protocol, the ARM11 network terminal as a server or client cannot send data whenever it wants and receive data whenever it wants. For example, after the server receives data from the computer, if the computer disconnects, then if the network terminal wants to send data to the computer again, it must wait until the computer initiates a connection to the terminal as a client again. In order to solve this problem of the TCP/IP protocol, this paper designs a dual-threaded working mode in which the network terminal and the computer act as both clients and servers. In this working mode, the terminal and the computer can initiate and disconnect at any time, so that they can send data whenever they want and receive data whenever they want.

2 Software Design of LCD Display
2.1 Analysis of LCD Display Methods
(1) Based on Framebuffer Drive Mode. There is a perfect Framebuffer driver under Linux, so the LCD controller integrated in ARM11 can be used to control LCD using Framebuffer. Framebuffer is the abstraction of display device as frame buffer. After the user maps it to the process address space through memory mapping, it can directly perform read and write operations, and the operations can be directly reflected on the screen. This method has fast response speed, high execution efficiency, and simple application program, but the underlying hardware driver is complex, and it is difficult to write after hardware changes and difficult to implement. LCD without controller usually adopts this method.
(2) Direct read and write GPIO drive method. At present, many types of LCD screens have built-in LCD controllers. ARM can complete the initialization and content display of LCD by writing control instructions and data to the controller. The software design of this display method is relatively simple, occupies a small code space, and can be driven by a simple control chip. For LCD with built-in controller, this paper designs a method of directly reading and writing GPIO to drive LCD. This method provides an interface to the LCD controller and LCD application program in the underlying driver. The read and write timing of the LCD controller are all completed in the underlying driver. The underlying driver provides the initialization interface and display data interface to the application program. This method has less interaction between the application program and the kernel, and the program execution efficiency is high.
2.2 LCD display implementation
Based on the above analysis, this paper designs a method to directly read and write GPIO to drive a liquid crystal screen with an LCD controller. The program structure of this method is shown in Figure 1.

a.JPG


The bottom-level driver mainly includes the following functions:
(1) Initialization function s3c6410_inti. This function includes two parts of initialization: one is the initialization of the GPIO port control register used by ARM11 to connect to the LCD controller. The core statement is writel(tmp, S3C64XX_GPICON), where writel is the write function of the driver layer, tmp is the data written to the control register, S3C64XX_GPICON is the control register of the first group of GPIO ports in S3C6410. If other GPIO ports are used, other control register macro definitions should be used instead; the second is the initialization of the LCD controller.
(2) Write data function s3c6410_WRData and write command function s3c6410_WRCommand. These two functions complete the writing of data and commands to the LCD controller according to the write data timing and write command timing of the specific LCD control register. The function for writing data to GPIO is writel(tmp, S3C64XX_GPIDAT). Writel and tmp are the same as above. S3C64XX_GPIDAT is the data register of the first group of GPIO ports in S3C6410.
(3) Display function s3c6410_LCDdisplay. This function achieves the effect of displaying a specific picture or text at a specific position on the LCD screen by calling the write command function and the write data function.
(4) System call interface function s3c64xx_ioctl(structfile*file, int cmd, long int data). This function defines two function interfaces, s3c6410_inti and s3c6410_LCDdisplay, which are called by the application program through the system calls iotcl(fd, 1, xx) and iotcl(fd, 2, xx). The application program can initialize the crystal screen by using iotcl(fd, 1, xx). It only needs to write data to the interface iotcl(fd, 2, xx) of s3c6410_LCDdisplay to realize the LCD display of the data.

3 Overall design of network communication and LCD display
In the overall design of network communication and LCD display, from the perspective of the validity of LCD display data and the real-time operation of the network system, this paper intends to use the TCP/IP protocol to design the server and client dual-thread working mode. The LCD display uses the direct reading and writing GPIO driver method, and the display data is processed by the computer and sent to the ARM11 client to achieve. The flowchart of the program design is shown in Figure 2. The software first initializes the crystal screen by calling the LCD screen initialization function of the underlying driver through the system call iotcl (fd, 1, xx), and then uses pthread_create() to create the server thread and the client thread. When the thread is established, the ARM11 network terminal enters two threads at the same time: the server thread will wait for the client to initiate a connection. When the client has data to send, as long as the connection is initiated, it can be connected to it. After receiving the client data, it is used for LCD display or other processing. After the processing is completed, it returns to waiting for the client connection; the client thread keeps scanning the terminal status. Once there is data to be sent to the server, it immediately initiates a connection to send data, and continues scanning after the data is sent.

c.JPG


The core code of the main program is as follows:
b.JPG

4 System operation effect analysis
In the system, the network terminal and the server thread of the computer are always in working state, which ensures that any end can initiate a connection as a client at any time and successfully connect. From another perspective, any end can also receive data sent by the client at any time, so that it can send when it wants to send and receive when there is data, meeting the real-time requirements of real-time network communication.
On the ARM11 network terminal, the picture data displayed by the LCD is handed over to the computer for processing, which greatly reduces the processing time of ARM11 and makes the response speed of buttons, switches, etc. faster. The LCD display uses direct read and write GPIO, and the read and write timing of the LCD controller is all completed in the bottom driver. There is less interaction between the application and the kernel. Experiments have proved that the execution speed of the kernel is orders of magnitude greater than the execution speed of the application, and the program runs efficiently.

5 Conclusion
The ARM11 embedded system, with its small size, fast processing speed and powerful functions, can realize network networking and network communication with high real-time requirements, thereby further opening up the application prospects of embedded systems. This paper improves the reliability and real-time performance of real-time network communication by designing a TCP/IP protocol server client dual-threaded working mode and directly reading and writing GPIO to drive LCD, and handing over the display image from the network to the computer for processing, making full use of the resources of the computer and ARM11. At the same time, the design is highly portable and can be applied to the work of other network terminals, which has reference significance for the application of ARM11 embedded systems.

Keywords:ARM11 Reference address:Realization of real-time network communication and LCD display in ARM11 embedded system

Previous article:Based on STWD100xP WTD embedded system anti-EMC technology
Next article:Design and implementation of MP3 player based on ARM

Latest Industrial Control Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号