The basic experiment of information security system design two

Source: Internet
Author: User

Beijing Institute of Electronic Technology (BESTI)

Real Inspection report

Course: Information Security system Design Basic class: 1352 classes

Name: (by contribution size) Silver snow pure, Yi Silam, malmqvist

Number: (Ranked by contribution size) 20125221, 20135239, 20135235

Score: Instructor: Lou Jia Peng Experimental Date: 2015.11.17

Experiment level: Preview degree: Experiment time: 15:30-18:00

Instrument Group: Compulsory/Elective: Compulsory Test number: two

Experiment Name: Firmware design--Serial port programming

                 Experimental purposes and requirements:

1, understand the basic method of serial programming in the Linux environment.

2, master the terminal's main properties and setting methods, familiar with the use of terminal I/O functions.

3, learning to use multi-threading to complete the serial port processing.

Experimental instrument:

Name

Model

Number

Computer

1

Embedded development Platform

Up-netarm2410-cl

1

First, the contents of the experiment

Read the program source code, learning the use of terminal I/O functions, learning to apply multithreaded programming to the reception and transmission of the serial port program.

Second, the principle of experiment

The asynchronous serial I/O method transmits each character of the transmitted data one after another (for example, a first low, a post-high). Each of the different bits of the data can use the same transmission channel, so the serial I/O can reduce the signal line, at least with a pair of lines. The receiver for a series of digital signals on the same line, first to split into bits, and then the character composition. In order to recover the information sent, both parties must coordinate their work. Asynchronous serial I/O is used extensively in microcomputers, and both sides use their own clock signal, and allow a certain error in clock frequency, so the implementation is easier. However, because each character is determined to start and end independently (that is, each character is resynchronized), characters and character putting may also have a variable length of idle time and are therefore less efficient.

Figure 2.3.1 Serial communication character format

Figure 2.3.1 gives the transmission format of one character in asynchronous serial communication. Before starting, the line is idle, giving a continuous "1". The transfer begins with a "0" as the starting bit, and then the binary encoded data that appears on the communication line is the character. The data bits for each character can be specified as 5-bit, 6-bit, 7-bit, or 8-bit, and are generally ASCII-encoded. After the parity bit, according to the Convention, with the parity bit to the word "1" in the number of bits to make an odd number or even number. You can also agree not to parity, so that the parity bit is canceled. The last is the "1" signal indicating the stop bit, which can contract a time width of 1, 1.5, or 2 bits. At this point a character transfer is complete, and the line goes idle, continuing to "1". After a random amount of time, the next character starts transmitting before it emits the starting bit. The width of each data bit is equal to the reciprocal of the transmit baud rate. In the asynchronous serial communication of microcomputer, the commonly used baud rate is 50,95,110,150,300,600,1200,2400,4800,9600 and so on.

The receiving party receives the data in the agreed format and checks to find the following three types of errors:

1, parity Error: In the case of the agreement parity check, the received word Fu Chi even state and the Convention does not match.

2. Frame format is wrong: The total number of digits from the starting bit to the stop bit is incorrect for one character.

3, overflow error: If the first received characters have not been read by the microcomputer, the following characters are transmitted over, then the overflow error occurs.

Each error will be given a corresponding error message, prompting the user to process. The general serial port debugging uses the null modem connection cable, its connection way 2.3.2 shows.

Figure 2.3.2 Practical rs-232c Communication Connection

Third, the experimental steps

1. Read and understand the source code

Go to the Exp\basic\03_tty directory and read the source code using the VI editor or other editor.

2. Compiling the application

Run make to produce a term executable file

[Email protected] root]# cd/arm2410cl/exp/basic/03_tty/

[[email protected] 03_tty]# make

Armv4l-unknown-linux-gcc-c-O term.o term.c

Armv4l-unknown-linux-gcc-o. /bin/term Term.o-lpthread

Armv4l-unknown-linux-gcc-o term Term.o-lpthread

[[email protected] 03_tty]# ls

Makefile Makefile.bak term term.c term.o tty.c

3. Download and debug

To the HyperTerminal window, use the NFS Mount Development host's/arm2410cl to/host directory. Enter

Exp\basic\03_tty directory, run term, observe the correctness of the running results.

[/mnt/yaffs] mount-t nfs-o nolock 192.168.0.56:/arm2410cl/host

[/mnt/yaffs]cd/host/exp/basic/03_tty/

[/host/exp/basic/03_tty]./term

Read Modem

Send data

123456789:;<=>[email protected]

Note: If the following error occurs when you execute ./term , you can create a connection by using the method we mentioned earlier. /dev/ttys0:no such file or directory

Workaround:

[/mnt/yaffs] Cd/dev

[/dev] ln–sf/dev/tts/0 ttyS0 (note that the first letter is L, not the number 1)

Because the kernel has the serial port 1 as the terminal console, so you can see the data issued by the term, but can not see the development of data sent from the host, you may use another host to connect the serial port 2 for the transceiver test; At this point to modify the execution of the command, after the term to add arbitrary parameters (below./term www For example) CTRL + C or ESC to force the program to quit.

Note: If we need to use serial port 1 communication, such as to do ZigBee or micro-printer experiment, need to load the serial port 1 driver, this in the CD-ROM to do a supplement, please go to the experimental supplement inside to find the driver s3c2410-tty.o. Insmod S3C2410-TTY.O will be all right. If the following error occurs while executing the ./term www , the two connections can be resolved by the method we mentioned earlier;/dev/ttys0:no such file or directory

Workaround:

[/mnt/yaffs] Cd/dev

[/dev] ln–sf/dev/tts/0 ttyS0 (note that the first letter is L, not the number 1)

[/dev] ln–sf/dev/tts/1 ttyS1 (note that the first letter (red) is L, not the number 1, and the back Two blue ones are 1)

Iv. Experience of Experiment

On the basis of the previous experiment, we did the design of the serial port program. This experiment has a lot of success in the last experiment, the start of the experimental platform, the installation of development tools and the configuration of the development environment has been more familiar. Experiment source code is used by the teacher to write, we just do the code to compile and download the work, the source code understanding is not particularly profound, after the experiment, I will continue to learn theoretical knowledge, to strive for this experiment has a more in-depth understanding and mastery.

In this test program run, we also encountered some problems, such as serial port program can not run properly after downloading, according to the instructions to enter the "ln–sf/dev/tts/0 ttyS0" command to establish a connection, the program will work.

last week's experiment I thought it was a group to write an experimental report, so did not write, the teacher after the notice I made up the experimental report, I hope the teacher forgive!

The basic experiment of information security system design two

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.