Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the basic knowledge and testing method of Android serial port?

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

Most people do not understand the knowledge points of this article "Android serial port basics and test methods", so the editor summarizes the following contents, detailed contents, clear steps, and has a certain reference value. I hope you can get something after reading this article. Let's take a look at this "Android serial port basics and testing methods" article.

Please note that in the document, many descriptions of the hardware contain the words "general situation", indicating that there are special cases.

Yes, but in most cases, it is right to remove the "general situation". In many cases, the hardware is "fuzzy" and biased.

In terms of "almost" and "the most important thing for a hardware system to run stably in a specific environment for a long time", there must be

"trade-off", although there is an "optimal solution", we can only try to get close to the "optimal solution", but we can never reach it.

Unlike software, every interface is strictly defined and similar situations are not allowed.

1 basic level knowledge

1.1 TTL level and CMOS level

In the university electronics professional course "Digital Circuit Analysis", the concept of level is mentioned, usually TTL and CMOS electricity.

Flat, TTL and CMOS are subdivided into a variety of levels, which are collectively referred to as TTL levels for the convenience of text description. TTL

It is very different from CMOS, but for pure digital circuits, the difference is not very big. The only thing to pay attention to is the signal.

If the voltage is different, you need to use a level converter chip to raise or lower the voltage of the signal.

In addition, in order to achieve the documentation goal-- in order to enable everyone to quickly grasp the rapid testing of serial ports, here TTL is based on the level.

The values are divided into 1.8VTTL level, 3.3VTTL level and 5VTTL level.

TTL level in general, high level (1.8V, 3.3V, or 5V) indicates logic 0V represents logic 0.

In general, when transmitting data between CMOS and TTL, as long as the level is the same as the type of IO, it can be positive.

Write to each other frequently.

So here is a basic conclusion: TTL level serial port, no matter as long as the development board and module fast TTL level value phase

Same as. The TX of the development board is connected with the test module RX, and the RX of the development board is connected with the test module TX with a total of GND.

To communicate normally.

1.2 RS232 level

Next, let's introduce the RS232 level. There is a lot of knowledge about RS232 on the Internet. The author only introduces the process of using it.

The hardest and most important part of.

The level of RS232 is to represent logic 1, the level is between-3V~-15V, and the level of logic 0 is between 3V~15V.

If the level is between-3V~3V, it doesn't make any sense.

Then obviously, no matter what the level of TTL is, it is impossible to communicate directly with RS232, and the logic is represented by a high level.

1, one represents logic 0 with a high level.

1.3232 level conversion Chip-Communication between TTL Serial Port and RS232

In order to enable the serial port of TTL to communicate with RS232 serial port, it is necessary to convert the serial port of TTL level into RS232 electricity.

Ping.

To convert TTL's 5V serial port into RS232 serial port signal, you need MAX232 chip (MAX is the meaning of American letter)

Is the abbreviation of a company), the 3.3V serial port of TTL is converted into RS232 serial port signal, which requires MAX3232.

At present, there is no serial port on many PC, but you can use USB to convert to serial port. Generally speaking, we default to USB.

All are RS232 serial port signals (there are also USB to TTL serial port chips).

As long as they are converted to RS232 level, TX is connected to RX,RX and TX, and the two sides can communicate.

1.4 the communication between serial port and module should be paid attention to.

There is only one thing to pay special attention to: be sure to find out the level!

If the module is a serial port, then it may be the serial port of RS232 level, it may be TTL1.8V serial port, it may be

The serial port of TTL3.3V level may also be the serial port of TTL5V.

For the serial port of the development board, refer to the first chapter of the user manual, the section related to the serial port, which describes the electricity of each serial port

Flat, network labeling, reuse and software-related device nodes.

In addition, hardware engineers with different TX and RX may have different names, if TX and RX cannot be correct.

If you write frequently, you can exchange it.

2Quick test method

This section describes how to quickly test the serial port of the development board to determine whether the serial port is sent and received properly.

First take a look at several concepts of "full duplex", "half duplex" and "simplex".

Simplex means that both sides of the communication are responsible for sending on one end and receiving on the other, typically, such as a radio.

Half-duplex means that both sides of the communication can be sent and received at both ends, but at the same time, one end sends, the other end only

Can receive, can not send and receive at the same time. Typical devices such as RS485 and USB.

Full-duplex means that both sides of the communication can send and receive at the same time, the most typical is the serial port, which can also be sent at the same time.

Receive. That is, TX and RX of serial port do not interfere with each other and can work at the same time.

The serial port is full-duplex, so what will happen if the TX and RX of the serial port of the development board are short connected? Of course it's positive.

Often take it spontaneously and receive what you send.

For example, in order to test the USB to serial port module, the TX and RX ports of the serial port can be shorted (the USB rate is much higher than

Serial port, half-duplex USB will not affect the spontaneous self-collection of serial port), then you will receive whatever data is sent.

data.

To quickly test the serial port of the development board, you can also use the short connection method of TX and RX, and the simplest method is to use a pair of tweezers.

(the wire also works), the two tips of the tweezers, one end is connected to TX, the other is connected to RX, and then run the self-receiving test program of the serial port.

Preface.

TX and RX short connection can be TTL level or RS232 level, as shown in the following figure, is the iTOP-4412 elite

Version (which is similar to other development boards) is the schematic diagram of the MAX3232 part.

As shown in the image above, both pin feet in the above four boxes can be shorted with the same effect. The left end of R20 and RS21 can be

With short connection, pin9 and pin10 of MAX3232, pin7 and pin8 of MAX3232 can be shorted, CON2

(DB9) pin2 and pin3 can be short-connected, so that the development board can achieve self-collection.

Please note that if you want to test the serial port, be sure to refer to the first chapter of the user manual of the corresponding development board.

Section, because some modules need to use the serial port, some serial ports are reused.

Short the serial port TX and RX of the development board, and use the iTOP-4412-Android- serial port test document (upgrade version)

V2.0.zip "the serial port program in the independent document, what string is sent, the development board receives the same string."

The above is about "what is the basic knowledge and testing methods of Android serial port". I believe we all have a certain understanding. I hope the content shared by the editor will be helpful to you. If you want to know more about the relevant knowledge, please pay attention to the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report