0 Introduction
ARM ADS stands for ARM Developer suite. It is an integrated development tool for ARM series processors launched by ARM. It is widely used. The highest version is 1.2, which replaces the earlier ADS1.1 and ADS1.0. In addition to being installed under Windows NT4, Windows 98 and Windows 95 operating systems, it also supports Windows XP and Windows Me operating systems. ADS consists of command line development tools, ARM real-time libraries, Gui development environment (CodeWarrior and AXD), utilities and support software. With these components, users can write and debug their own development applications for ARM series RISC processors. The command line development tools complete the function of compiling source code and connecting it into executable code, including: armcc, armcpp, tcc, tcpp, armasm, armlink, armsd. Among them, armcc is used to compile programs written in ANSI C into 32-bit ARM instruction code. The runtime libraries that support compiling C and C++ codes are: ANSI C library functions and C++ library functions. The CodeWarrior integrated development environment (IDE) of ADS is based on the Metrowerks CodeWarrior IDE version 4.2. It has been appropriately tailored to support the ADS tool chain and provides a simple and diverse graphical user interface for managing and developing projects. Users can use the CodeWarrior IDE of ADS to develop program code in C, C++ or ARM assembly language for ARM and Thumb processors, shortening the cycle of user project code development. ADS includes three debuggers: AXD (ARM Extended Debugger), ARMSD (ARM Symbo lic Debugger), and ADW/ADU (Application Debugger Windows/Unix). In the initial stage of software development, the debugger can be used for simulation to test whether the developed software has achieved the expected results.
In the actual development and application of data acquisition, serial communication is an indispensable part. It is currently a very important and commonly used communication method between embedded systems and PCs. Computers use serial ports to control external devices such as single-chip microcomputers, which reduces the trouble caused by complex assembly language programming when accessing external devices, and is also conducive to large-scale development and design. In the Linux system, the system treats serial ports and other peripherals as files for operation, which is very convenient for port reading and writing, greatly improving the system programming efficiency. This article uses the serial port built-in by S3C2410 to control the target after porting the Linux system to S3C2410, and introduces the hardware circuit and software implementation method of serial communication in detail.
1 Hardware Structure
At present, most serial ports are used in Windows or Dos. This article uses serial ports to achieve communication in Linux system. S3C2410 chip is a 16/32bit RISC processor produced by Samsung, with independent 16kB instruction and 16kB data cache, MMU unit for virtual memory management, LCD controller (STN&TFT), nonlinear (NAND) FLASH boot unit, system manager (including chip select logic control and SDRAM controller), 3 channels of asynchronous serial port (UART), and the highest baud rate supported by each controller can reach 230400 Baud/s. These features provide a reliable guarantee for the smooth serial communication between the computer and the development board in Linux system. WNSC400 is the control box of the electric displacement platform produced by Beijing Weiner Optoelectronics Co., Ltd. It has an RS232 serial port that enables S3C2410 to communicate with it through the serial port, so that S3C2410 can control the electric displacement platform. However, the control box is implemented in Windows environment, so it is difficult to apply it to embedded systems. If the serial port of S3C2410 is to realize data transmission with the control box, then the control box and the electric translation stage it controls must be connected to other modules to form an embedded system, such as connecting with a camera. After the camera collects images of the object, it processes the collected data and calculates the displacement and other parameters of the target to be changed. Then the control box reads these data from the memory of $3C2410 and issues a command to move the electric displacement platform according to the required change. In this way, a simple embedded system is realized. The hardware principle of the connection between the computer (host machine), the target machine (S3C2410) and the control box is shown in Figure 1. After the program compiled in the ADS environment is downloaded to S3C2410 through JTAG on the host machine, S3C2410 can communicate with the control box through the serial port.
2 Implementation of UART software
Most Linux software development is done in native mode, that is, development, debugging, and operation on the host. However, since there are not enough resources on the target machine to meet the needs of embedded system development, this method is not suitable for embedded system software development. Usually, embedded system software development adopts the method of cross-compilation and debugging. The main feature of cross-compilation is that the program code executed in a machine is not compiled by the host machine, but compiled by another machine.
The basic tasks of serial communication are: data formatting, serial/parallel conversion, data transmission rate control, error detection, and TTl and EIA level conversion. Serial communication is divided into two types: synchronous communication and asynchronous communication. This article will use asynchronous serial I/O.
Since the Linux system regards all devices as files, when accessing the serial port, it is considered to be a file. We can use the file system control function to implement basic serial port operations, such as the open() function to open the serial port, the read() and write() functions to read and write the serial port, and the close() function to close the serial port after the data transmission is completed.
2.1 Basic settings of the serial port
The most basic settings of the serial port include the baud rate setting, the check bit setting, and the stop bit setting. The serial port settings mainly set the member values of the struct termios structure:
2.2 Serial port reading and writing
Sending Data
In addition to the above method of using read to read the serial port, you can also use file operation functions to implement asynchronous reading, such as fcnt1, or selectt.
2.3 Application
The advantage of the ADS development platform is that it has included all the related setting functions of the serial port in the related header files, so when developers want to use the serial port for further development, they can directly use these functions or modify the original functions. This article uses these advantages to transmit data to the WNSC400 control box through the serial port of S3C2410. Part of the program is as follows:
3 Conclusion
Through experiments, it was realized that the WNSC400 control box and the electric translation stage can be controlled by S3C2410. The development under ADS environment reduces the troubles encountered in serial port development directly under Linux system. Moreover, since AARM has multi-functional module expansion function, multiple functions can be concentrated, creating conditions for the WNSC400 control box and its electric translation stage to be widely used in embedded systems.
Previous article:Wireless and mobile infrared monitoring and alarm system based on ARM9
Next article:Design of vacuum freeze-drying control system based on ARM+FPGA
Recommended ReadingLatest update time:2024-11-15 10:35
- Popular Resources
- Popular amplifiers
- 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
- Detailed explanation of intelligent car body perception system
- How to solve the problem that the servo drive is not enabled
- Why does the servo drive not power on?
- What point should I connect to when the servo is turned on?
- How to turn on the internal enable of Panasonic servo drive?
- What is the rigidity setting of Panasonic servo drive?
- How to change the inertia ratio of Panasonic servo drive
- What is the inertia ratio of the servo motor?
- Is it better for the motor to have a large or small moment of inertia?
- What is the difference between low inertia and high inertia of servo motors?
- New wireless broadband technologies in the 5G era
- Design and implementation of temperature control system based on MSP430
- [Erha Image Recognition Artificial Intelligence Vision Sensor] Evaluation 2: Built-in 7 functions, face recognition and other tests
- 【Xianji HPM6750】Development process using Embedded Studio
- 【TouchGFX Design】Decomposition of the generated project directory structure and recommendation of two C++ introductory books
- LIS25BA package and evaluation board files
- L298N output voltage problem
- KiCad KiCost GOOD
- Support Xilinx/Altera/Lattice JTAG and UART
- R329 development board series tutorial | Running aipu program on real machine