Embedded Linux and Processing Systems Based on Embedded Linux
2026-04-06 06:21:51··#1
Radio Frequency Identification (RFID) is a non-contact automatic identification technology that automatically identifies target objects and acquires relevant data through radio frequency signals. The identification process requires no human intervention and can operate in various harsh environments. RFID technology is applied in many fields, such as parking management and container transport management systems. In most applications, only fixed readers are required, but in some special systems (such as container transport management systems), both fixed readers and handheld readers are required. TagMaster AB is a world-renowned manufacturer of RFID readers. It provides high-performance fixed readers as well as a handheld reader. The handheld reader consists of an industrial-grade PDA (Personal Digital Assistant) from Caiso and the S1510 from TagMaster AB. Although PDAs are powerful, they have the following disadvantages: (1) The touch screen input method provided is too precise and not suitable for on-site operation by staff; (2) The TFT LCD screen has poor display effect under strong light, consumes a lot of power, and cannot work at low temperature (below 0℃), so it is not suitable for outdoor work; (3) The use of Microsoft's commercial system WinCE is costly. This article introduces a portable RFID information acquisition and processing system based on embedded Linux. It uses a high-performance 32-bit ARM920T series microprocessor, an 8-key keyboard and an OLED display screen, combined with S1510 to realize the acquisition, processing and real-time display of electronic tag card information, which solves the above problems well. 1 System Composition The system uses Atmel's AT91RM9200 32-bit high-performance processor, TagMaster's S1510 and OLED display module to realize the functions of electronic tag card information acquisition, processing, real-time display and communication with the host computer. The system composition is shown in Figure 1. 1.1 Microprocessor The system uses the Atmel AT91RM9200 microprocessor, based on the ARM920T core. It has a maximum clock speed of 180MHz, advanced power-saving technology, and integrates SDRAM, Flash, infrared, and USB interfaces. The system communicates with the host computer via USB (Universal Serial Bus) and infrared. The infrared communication is implemented using an Agilent HSDL-3602 infrared transceiver. 1.2 Radio Frequency Identification Module The radio frequency identification module uses the 2.4GHz S1510 product from TagMaster AB of Sweden. This module is small in size, designed specifically for handheld devices, and can collect data from various electronic tags within a 1-meter range. It communicates with the processor via a USART serial port, offering a simple interface and easy hardware implementation. To ensure reliable data transmission, the module communicates with the microprocessor using the ConfiTalk acknowledgment-based serial communication protocol developed by TagMaster AB. ConfiTalk is a character-oriented acknowledgment-based serial communication protocol. It transmits data blocks (frames) of a certain length each time, and each frame contains a frame header (STX) and a frame trailer (ETX). To improve the reliability of data transmission, each frame also includes an 8-bit checksum (CS) and address bit (ADR). The frame structure is shown in Figure 2. MESSAGE represents information of arbitrary length. The protocol specifies that frames sent by the microprocessor to the S1510 are command frames, and returned frames are acknowledgment frames. The S1510 used in this system is the latest product from TagMaster AB, which supports data transmission via MAIL command mode based on the ConfiTalk protocol. MAIL command mode communication unifies the MESSAGE field in the frame into four formats, among which command frames have two types: MAIL_SEND and MAIL_RECEIVE, representing S1510 receiving user information and returning card information (including card number, card status, and data stored on the card), as shown in Figure 3. 1.3 OLED Display Module The system uses the RGS24128064YW001 OLED display module from Laibao Technology Co., Ltd. Organic Light Emitting Display (OLED) is hailed as the "dream display." Compared to LCD screens, OLED displays are lighter and thinner, have wider viewing angles, significantly save energy, and can still operate normally at temperatures as low as -40℃. The RGS24128064YW00 1 features serial and 8-bit parallel data interfaces. The system uses an 8-bit parallel interface to communicate with the microprocessor. 1.4 SDRAM and Flash and Custom Keyboard The system uses 32-bit Synchronous Dynamic Random Access Memory (SDRAM) as system memory and 16-bit Flash memory as non-lossable data storage. Users can perform various operations, such as reading and writing cards, using an 8-key keyboard. 2 System Software Design System software is the soul of the entire system; its design directly affects the system's stability and scalability. The system design divides the software into a two-layer structure, as shown in Figure 5. The bottom layer is the operating system layer, which mainly implements the porting of the Linux operating system and the writing of various device drivers, including drivers for OLED modules, USB devices, infrared transceivers, and keyboards. The upper layer is the application layer, which mainly implements functions such as card information display, keyboard scanning, electronic tag card reading and writing, file transfer, clock, and battery level detection. 2.1 Embedded Linux Linux is an open-source multitasking operating system with high openness, good security, strong stability, and good portability, and is widely used in embedded operating systems. The Linux kernel used in this design is based on ARM-Linux, and device drivers for the OLED display module, USB device, infrared transceiver, and keyboard are written. In the Linux system, device drivers occupy a very important position, providing an interface for operating hardware devices in user space. The Linux system divides devices into three types: character devices, block devices, and network devices, and provides data structures and registration functions for different devices. When users develop device drivers, they only need to fill in the device data structure according to the hardware operation method and register it into the kernel. To facilitate application development, USB devices are implemented as CDC (Communication Device Class) devices. Their drivers are divided into two layers: the lowest layer operates the USB device controller on the AT91RM9200, handling hardware interrupts, reading and writing registers, and operating I/O ports to detect device insertion and removal; the upper layer implements the connection between the lower layer and the TCP/IP protocol layer, primarily simulating a physical network card and registering it with the kernel. Thus, the USB device in the application is a standard network device. Users do not need to understand the driver interface and can directly use the sockets provided by Linux to develop network communication programs. When users perform secondary development, they can directly port the network communication program developed on the host computer to this system without modification, and can also perform certain operations on the embedded system through tools such as Telnet on the host computer. Other drivers (such as OLED display modules, keyboards, and infrared transceivers) are written as standard character devices under Linux, registered using the register_chrdev() function, providing read, write, and control operations. In the Linux system, application operations on character devices are the same as file operations. In Linux, device drivers can be dynamically loaded and unloaded as modules, or they can be directly compiled into the kernel. The former is more flexible and can reduce the kernel size, but because embedded systems require all devices to be fully ready after initialization, device driver modules cannot be loaded during use. Therefore, in this system, all device drivers are directly compiled into the kernel. Each device driver corresponds to a device file in user space, managed by the file system. This system uses ext2 as the root file system. For ease of development and upgrades, the root file system is first formatted as a RAMDISK. A RAMDISK is a virtual hard disk created by decompressing compressed files into memory after system startup. Then, the bootloader, kernel image, and root file system are burned into Flash. After the system is powered on, the bootloader loads the kernel image from Flash into memory and then executes from the kernel entry point: first initializing the CPU, then loading the various device drivers, and finally mounting the file system and executing the application. 2.2 Application Design Linux is a multi-tasking system that supports multi-threading and multi-processing. The advantages of multithreading are that threads are smaller than processes, making applications more lightweight and facilitating inter-thread communication; the disadvantages are that all threads use the same address space, so if one thread fails, the entire system will be affected. Processes, on the other hand, each occupy its own memory space, which can enhance system stability, but multi-processing increases system overhead and inter-process communication is complex. Therefore, based on the actual situation and considering system stability, this system adopts a combination of both methods to complete data acquisition and processing and file transfer functions separately. 2.2.1 Data Acquisition and Processing Data acquisition and processing is a process that includes a main thread and auxiliary threads. The main thread completes the reading, writing, real-time display, and querying of electronic tag information; the auxiliary thread implements a clock to provide the user with the current time and periodically detects and dynamically displays the battery level, issuing a warning when the battery is low. The application uses MAIL commands to read and write electronic tags. This process first initializes the screen, then waits for key presses. When a key is pressed, it performs the corresponding work based on the key value; if no key is pressed within a specified time, the system enters a sleep state, thereby saving power. The program flowchart is shown in Figure 6. After successfully acquiring the tag card information, the application provides the card information (including card number, card status, user data, and current time) to the user through the OLED display and writes it to a file for recording. Since the file transfer process will transmit this file to the host computer, the file must be locked when reading and writing. Linux provides file locks to prevent different processes from accessing the same file simultaneously. This article uses the `flock()` function to lock and unlock the file. Because the OLED is a graphic dot matrix display and Flash memory is limited, it is impossible to directly use a Chinese character font library. The system pre-extracts the dot matrix data of all used Chinese characters, numbers, and letters, and then creates its own font library file, enabling the application to display Chinese characters, numbers, and letters. 2.2.2 File Transfer File transfer is a process that uploads card information and downloads other data. Communication with the host computer uses a Client/Server model. This process is essentially a server-side (this system) application that continuously waits for connection requests from the client (host computer). When a request arrives, first determine which interface (USB or infrared interface) the request comes from, and then perform the corresponding upload or download according to the type of request. Considering that multiple handheld readers may be used in actual applications, in order to facilitate the management of information by the host computer, the file name is specified to consist of the handheld reader number and the file upload sequence number. When uploading a file, the program automatically adds its number and upload sequence number to the file name. The process flow is shown in Figure 7. 3 System Power Management This system uses a lithium battery to power the system. In order to extend the battery life, the application is designed to have three operating states: power-on idle state, program execution state, and system sleep state. When the user does not perform any operation, the system will enter the sleep state to save power. The system sleep is implemented based on the power management function of the microprocessor. The steps to enter sleep are as follows: (1) turn off all peripherals; (2) save the current system state; (3) put the SDRAM into self-refresh mode; (4) set the wake-up event to put the microprocessor into sleep state. When the wake-up event occurs, if a key is pressed, the system will be reset. The process is as follows: (1) Restore some of the microprocessor registers; (2) Wake up the external device and the system starts running. This article introduces the use of embedded Linux running on the AT91RM9200 high-performance ARM chip, combined with the powerful radio frequency identification module S1510 from TagMaster AB, to realize the information acquisition and processing of portable tag cards. The system is convenient and flexible to use. In addition, in order to overcome the shortcomings of LCD not working at low temperatures, insufficient brightness and high power consumption, an OLED display module is adopted to enable the system to be used in harsh environments and increase the battery life; in order to facilitate communication between the system and the host computer, a hot-swappable USB interface is adopted.