Development of serial port application based on S3C2410 in ADS environment

Publisher:星际穿越Latest update time:2009-10-27 Source: 电子技术Keywords:S3C2410 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Hardware Structure

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:

The values ​​of each member of the structure

2.2 Serial port reading and writing

Sending Data

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:

Partial Program

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.

Keywords:S3C2410 Reference address:Development of serial port application based on S3C2410 in ADS environment

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

s3c2410 Timer
S3C2410 provides 5 16-bit Timers (Timer0~Timer4), among which Timer0~Timer3 supports Pulse Width Modulation - PWM (Pulse Width Modulation). Timer4 is an internal timer (internal timer), it has no output pins (output pins). The following is the working principle diagram of the Timer. As shown in the above figure, PCLK
[Microcontroller]
Production of ARM Linux Root Filesystem
Introduction: Introduces the composition of the root file system: directory, shell, library, and script. Table of contents The root file system must contain these required directories: /dev, /bin, /usr, /sbin, /lib, /etc, /proc, /sys /dev is the mount point of devfs (device file system) or udev. If there is no /de
[Microcontroller]
JFFS2 file system construction and configuration (Micro2440 + linux 2.6.39)
1. JFFS2 file system configuration a) Kernel configuration         # make menuconfig //The default MINI2440 configuration has enabled JFFS2 support         File systems ---                   Miscellaneous filesystems ---                           * Journalling Flash File System v2 (JFFS2) support          
[Microcontroller]
About Watchdog of s3c2410
1. Watchdog principle Watchdog is essentially a timer. The timer counts the clock. When the timer overflows, a reset signal is generated to reset the entire system. In a program or embedded system, the watchdog timer needs to be reset and re-counted regularly. The timer will not overflow and reset the system, thus ens
[Microcontroller]
About Watchdog of s3c2410
Discussion on the Selection of Linux Embedded System Development Platform
  1 Embedded Systems and Linux   According to a definition of the Institute of Electrical Engineers: Embedded systems are devices used to control or monitor large-scale systems such as machines, devices or factories. Specifically, it is a combination of computer software and hardware; it is application-centric, based
[Power Management]
Discussion on the Selection of Linux Embedded System Development Platform
[Primary Tutorial] Implementation of arm-linux bare metal development - bootstrap.bin
1 Introduction We know that if a program written under the Linux platform wants to run on the arm platform, we have to use a cross compiler. We can use arm-linux-none-gnueabi-gcc or arm-linux-gcc. The programs compiled by these compilers can run directly on the arm platform. So what files do we need to implement our b
[Microcontroller]
[Primary Tutorial] Implementation of arm-linux bare metal development - bootstrap.bin
The growth path of single-chip microcomputer (51 basic chapters) - 006 Building a development and programming environment under Linux
There is no easy-to-use IDE like Keli to develop 51 microcontrollers under Linux, so the development environment can only be built by yourself.  Step 1: Install cross-compilation tools  a) Install SDCC  sudo apt-get install sdcc  b) Test whether SDCC is available. This is a simple running light code test.c found on
[Microcontroller]
The growth path of single-chip microcomputer (51 basic chapters) - 006 Building a development and programming environment under Linux
Linux driver study notes touch screen driver
The touch screen is summarized as an input subsystem. Here it is mainly for the resistive screen. Its usage process is as follows When pressed with the touch pen, an interrupt is generated. Start the ADC conversion of x,y coordinates in the interrupt handler function. ADC ends and ADC interrupt is generated Report (in
[Microcontroller]
Latest Microcontroller 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号