1S3C2410 Hardware Platform Introduction
S3C2410 is a new generation of high-performance microprocessor produced by Samsung, South Korea. It is a 16/32-bit RISC processor based on the ARM920T core. It is mainly used in embedded systems.
S3C2410 has powerful data processing capabilities, low cost, low power consumption and other advantages. It is increasingly widely used in various handheld and mobile devices, and the program functions based on its platform are becoming more and more complex. Therefore, building a multi-threaded operating system on its platform has become the demand of more and more system designers. This article introduces the specific implementation process of multi-threading on S3C2410.
2 System Structure Analysis
The essential function of the serial port is to act as a code converter between the CPU and the serial device. Generally, microcomputers are equipped with communication adapters, which enable the computer to communicate with other computers or devices with RS232C serial ports. The main purpose of this system is to achieve short-distance serial communication between the host and the target. The host is a Red Hat Linux 9.03 environment PC with Intel X86 architecture, and the target is an ARM architecture development board.
The core of the target machine development board in this system is Samsung's S3C2410. The development board adopts the mode of core board plus baseboard. The core board interface adopts DIMM200 standard connector. It works very reliably and can run stably at a clock frequency of 203 MHz. Its peripherals are very rich and powerful. It can fully meet the design needs. The serial port line adopts the commonly used RS 232C interface mode. It can realize data transmission and control between the computer and the development board.
3 System Hardware Structure Principle
Serial communication can be performed in DOS or Windows environment. Communication programs can be written in assembly or high-level language. This article introduces how to achieve serial communication under Linux operating system.
In the process of realizing serial communication, it is necessary to ensure the reliability and stability of data transmission. Its hardware design is indispensable. In this paper, the S3C2410 chip is selected as the core device. The S3C2410 chip is a 16/32-bit RISC processor of SAMSUNG. It adopts the ARM920T core, has two independent UART controllers and separate 16 kB instruction cache and 16 kB data cache. The highest baud rate supported by each controller can reach 230.4 kb/s. These characteristics of the S3C2410 chip provide a reliable guarantee for the realization of serial communication between the computer and the development board under the "nux operating system". The hardware structure principle of the embedded serial communication based on S3C2410 is shown in Figure 1.
In the host computer system, the serial communication program is written under the Linux operating system. It is downloaded to the target machine, i.e. the development board, through the JTAG interface module. Under the corresponding software control command, the data between the host and the target machine can be sent and received through the serial interface line. The power module in the target machine provides the normal voltage required for the development board system to work. Various data information can be displayed in time through the LCD display module. The operation of the target machine can also be controlled through the keyboard control module. The external memory module can be composed of FLASH or SDRAM. Of course, as a complete system, it must also be equipped with other peripheral circuits to ensure the normal operation of the system.
4 Software Implementation
The design of serial communication software is the key to the successful operation of the system. How to ensure the efficiency, reliability, real-time performance of communication and save system resources are the issues that designers are concerned about. Therefore, the definition of communication protocol, the structural design of software outsourcing, and the selection of program development tools are extremely important in system design. The development of the PC-side serial communication program is based on the object-oriented design method of the Windows environment. The development environment uses vc++. There are many implementation methods, and there are many literatures introducing this. I will not go into details here. For the serial communication program on the microcontroller side, there are literatures introducing the program framework based on assembly language, but there are few introductions to the C language implementation based on the hierarchical structure. The following will specifically introduce the design and implementation of the serial full-duplex communication program under the hierarchical structure framework in KeilC51.
4.1 Communication protocol port baud rate
There are two communication modes based on serial I=1: intermittent communication and asynchronous communication. This adopts asynchronous serial communication. During the communication process, the microcontroller should handle the following issues: (1) Identify the command. The PC transmits the command to the microcontroller. The microcontroller can identify different commands and perform different operations according to the content of different commands. (2) Identify the data. The microcontroller can identify the data attached to the command. The maximum number of bits of transmitted data is determined by the set buffer size. (3) Error handling. Including identifying invalid commands and handling communication errors. When the microcontroller receives a command that the system has not defined, or the received command does not conform to the pre-defined format. It should respond, report an error to the system and perform error handling. The error type number should be defined in advance. (4) Correct response. When the microcontroller system receives a message without communication error and in accordance with the communication protocol, it should perform the corresponding operation according to the received command and return the operation result to the PC, such as sending an "OK" message for confirmation.
Issues that the PC should handle: (1) Collecting data sent by the MCU, such as the status information of a device module; (2) Receiving the normal response and error response information of the MCU. If there is an error response information, it should be processed according to the error type. Since there may be multiple device modules to be controlled, the device modules can be uniformly addressed and unique 16-bit addresses can be set for different devices to distinguish them. In this way, when the PC and the MCU are transmitting data, both parties can identify the source of the data and the object to be controlled. Table 1 shows an example of the communication protocol format. It consists of a PC transmission command protocol and a MCU response protocol.
4.2 Layered Design of MCU Communication Software
The software development environment of the single-chip microcomputer system is Keil C51. Compared with assembly language, C language has obvious advantages in structure, readability and maintainability. It is more conducive to program transplantation and expansion. The serial port communication program adopts a layered structure. That is, the program is divided into physical layer, driver layer and application layer. The layered design has the following advantages: (1) The serial port program that communicates with the host supports concurrent reception and transmission (active transmission and passive query devices coexist), which is conducive to improving communication efficiency and real-time data processing. (2) When the single chip
When the machine has only one serial port and there are multiple device modules controlled by serial communication, the serial port must be expanded. In order to simplify the hardware, the simulated serial port must be implemented by software. Therefore, the system should have software implementation that supports I/O port simulated serial port operation. Standard serial I/O and simulated serial port are different in physical implementation, but a unified external package is used to improve the encapsulation and modularity of the program. (3) Prevent serial port operations from monopolizing CPU resources in the process and avoid the occurrence of phenomena such as missed detection of status information.
The main functions of the three-layer program and its implementation in C language are as follows:
(1) Driver layer: Also known as the abstract layer, this layer defines the basic operation structure of the serial port. Based on this structure, serial port designs in different modes are implemented, including serial port implementation in interrupt mode and serial port implementation in I/O port simulation mode. Although the underlying implementation of the two modes is different, the driver layer shields the physical details of different serial port operations and simplifies the application layer's operation of the serial port. The structure of the serial port is defined as follows:
typedef struct Serial
{ void (* pfSetBaudRate)(unsigned long baud_rate); //Set the serial port baud rate
void (*pfOpen)(void); //Serial port open
void (*pfClose)(void); //Serial port closed
unsigned (*pfGetChar)(unsigned char *c); //Get a number from the receive buffer
void (*pfPutChar)(unsigned char c); //Send a byte
void (*pfPutStr)(unsigned char *tmp_str, unsigned char tmp_len); //Send a string of numbers
}Cserial;
(2) Physical layer: In this layer, different physical operations are performed for different serial port entities, such as microcontroller serial port initialization, timer initialization in I/O simulated serial port mode, I/O interrupt initialization, etc. Its function is to provide support for different serial port operation modes. Different serial port entities are designed for the two different physical implementation methods of standard full-duplex serial port and simulated serial port (including internal execution of the underlying operations of each type of serial port and related basic external initialization operations). Different implementation methods bind different operation function pointers. The pointers point to different operations. The two serial port entities are encapsulated into a unified serial port basic class, making the program more versatile and extensible. In the physical layer, a circular FIFO double buffer queue is used to cache and read the received and sent data. The combination of the buffer circular FIFO operation mode and the reception and transmission of data in the interrupt mode ensures the reliability and real-time performance of data processing. Due to space limitations, the following only gives the sample code for the declaration of the buffer structure and related pointers:
Previous article:Design of flexible DC transmission bridge arm controller based on Zynq7000
Next article:Necessary steps to get started with ARM embedded development
Recommended ReadingLatest update time:2024-11-15 12:55
- Popular Resources
- Popular amplifiers
- Semantic Segmentation for Autonomous Driving: Model Evaluation, Dataset Generation, Viewpoint Comparison, and Real-time Performance
- Machine Learning and Embedded Computing in Advanced Driver Assistance Systems (ADAS)
- Embedded.Systems.2nd.Edition
- Embedded security in cars: securing current and future automotive IT applications
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Microchip Accelerates Real-Time Edge AI Deployment with NVIDIA Holoscan Platform
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Melexis launches ultra-low power automotive contactless micro-power switch chip
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- Apple faces class action lawsuit from 40 million UK iCloud users, faces $27.6 billion in claims
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- The US asked TSMC to restrict the export of high-end chips, and the Ministry of Commerce responded
- Hetai ESK32-360 development board "pats" you, free evaluation is waiting for you!
- The results of the US 337 investigation on DJI are released: no ban will be issued
- Car lock relay output (open drain output) circuit confusion
- Mir Edge AI Computing Box FZ5 Review Summary
- FPGA Practice (II) 8 LED Lights on and off and Flowing Lights
- Helping startups~21 Maxim evaluation boards are here! Free redemption in progress!
- iic communication, the host cannot receive relevant data
- 280049Solution to the problem of LaunchPad emulator not being able to connect
- Commonly used algorithms for drones - Kalman filter (XI)
- How to choose 18650 charging IC?