4303 views|6 replies

88

Posts

0

Resources
The OP
 

iTOP-4412 Development Board - Serial Port Basics and Test Methods [Copy link]

This document introduces the basic knowledge and test methods of the common serial port on embedded systems.
Please note that in the document, many descriptions of hardware are accompanied by the words "general situation", indicating that there are special cases
, but in most cases, it is correct to remove "general situation". In many cases, hardware is "fuzzy", tends
to be "almost", and insists on "the most important thing is that the hardware system runs stably in a specific environment for a long time". There must be
"trade-offs" in the design. Although there is an "optimal solution", we can only try to get close to the "optimal solution", but we can never reach it.
Hardware is not like software. Each interface is strictly defined and does not allow for similar situations.
1 Basic level knowledge
1.1 TTL level and CMOS level
In the university electronics major course "Digital Circuit Analysis", the concept of level is mentioned. Usually there are TTL and CMOS levels
. TTL and CMOS are subdivided into multiple levels. Here, for the convenience of text description, they are collectively referred to as TTL levels.
There is a big difference between TTL and CMOS, but for pure digital circuits, the difference is not very big. The only thing to pay attention to is
the voltage value of the signal. If the voltage is different, a level conversion chip is needed to raise or lower the voltage of the signal.
In addition, in order to achieve the goal of the document - in order to enable everyone to quickly master the quick test of the serial port, here TTL is
divided into 1.8VTTL level, 3.3VTTL level and 5VTTL level according to the level value.
In general, the high level (1.8V, 3.3V or 5V) of TTL level represents logic 1, and 0V represents logic 0.
In general, when CMOS and TTL are transmitting data, as long as the level and IO type are the same, they can
communicate normally.
Then there is a basic conclusion: the serial port of TTL level, whether it is the same as the TTL level value of the development board and the module
, the TX of the development board is connected to the RX of the test module, and the RX of the development board is connected to the TX of the test module, and the common GND ground, can
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 most difficult and important part of the use process.
RS232 level should 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 is meaningless.
So obviously, no matter what level TTL is, it cannot communicate directly with RS232. One uses high level to represent logic
1, and the other uses high level to represent logic 0.
1.3 232 level conversion chip-communication between TTL serial port and RS232
In order to enable TTL serial port and RS232 serial port to communicate, it is necessary to convert the TTL level serial port to RS232 level
.
To convert TTL 5V serial port to RS232 serial port signal, you need MAX232 chip (MAX means Maxim,
which is the abbreviation of a company), and to convert TTL 3.3V serial port to RS232 serial port signal, you need MAX3232.
Many PCs now do not have serial ports, but you can use USB to serial port. In general, we assume that the USB
output is RS232 serial port signal (there are also USB to TTL serial port chips).
As long as they are converted to RS232 level, TX is connected to RX, RX is connected to TX, and both sides can communicate.
1.4 Things to note about serial port and module communication
There is only one thing to pay special attention to: make sure you understand the level!
If the module is a serial port, it may be a serial port with RS232 level, a TTL1.8V serial port,
a TTL3.3V level serial port, or a TTL5V serial port.
For the serial port of the development board, refer to the first chapter of the user manual, the serial port related section, which describes the level
, network label, multiplexing status and software-related device nodes of each serial port.
In addition, the hardware engineers with different TX and RX may not name them the same. If TX and RX cannot
communicate normally, you can swap them.
2 Quick Test Method
This section introduces how to quickly test the serial port of the development board to determine whether the serial port sends and receives normally.
First, let's understand a few concepts "full-duplex", "half-duplex" and "simplex".
Simplex means that one end of the communication is responsible for sending and the other end is responsible for receiving, a typical example is a radio.
Half-duplex means that both ends of the communication can send and receive, but at the same time, one end sends and the other end can only
receive, and they cannot send and receive at the same time. Typical examples are RS485 and USB devices.
Full-duplex means that both ends of the communication can send and receive at the same time, the most typical example is the serial port, which can send and
receive at the same time. That is, the TX and RX of the 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 development board serial port are short-circuited? Of course, it is normal
to send and receive, and what is sent is received.
For example, to test the USB to serial port module, you can short-circuit the TX and RX ports of the serial port (USB speed is much higher than
the serial port, and half-duplex USB will not affect the serial port's self-transmission and self-reception), then the data sent will be received
.
To quickly test the serial port of the development board, you can also use the method of short-circuiting TX and RX. The simplest method is to use a pair of small tweezers
(wires are also fine), connect the two tips of the tweezers to TX at one end and RX at the other end, and then run the test program of the serial port's self-transmission and self-reception
.
The short-circuit of TX and RX can be TTL level or RS232 level, as shown in the figure below, which is the
schematic diagram of the MAX3232 part of the iTOP-4412 Elite Edition (Xunwei other development boards are similar).


As shown in the figure above, the two pins in the four boxes above can be short-circuited, and the effect is the same. The left end of R20 and RS21 can
be short-circuited, pin9 and pin10 of MAX3232, pin7 and pin8 of MAX3232 can be short-circuited, and
pin2 and pin3 of CON2 (DB9) can be short-circuited, so that the development board can realize self-transmission and self-reception.
Please note that if you want to test the serial port, please be sure to refer to the first chapter of the user manual of the corresponding development board, the serial port related
section, because some modules need to use the serial port, and some serial ports are multiplexed.
Short the serial port TX and RX of the development board, use
the serial port program in the independent document "iTOP-4412-Android-Serial Port Test Document (Upgraded Version) _V2.0.zip", and send any string, and the development board will receive the same string.

For more information, please visit: Xunwei Electronics

This post is from Embedded System

Latest reply

Thank you OP!   Details Published on 2020-7-20 14:03

79

Posts

723

Resources
2
 

Thank you! Is this document a repost of a book? What book?

This post is from Embedded System
 
 

9

Posts

0

Resources
3
 

Awesome, learning Liao

This post is from Embedded System
 
 
 

7

Posts

0

Resources
4
 

Thank you OP!!!......

This post is from Embedded System
 
 
 

17

Posts

0

Resources
5
 

I learned a lot, thanks for sharing

This post is from Embedded System
 
 
 

11

Posts

0

Resources
6
 

Thank you OP!

This post is from Embedded System
 
 
 

7422

Posts

2

Resources
7
 

Thank you OP!

This post is from Embedded System
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

Guess Your Favourite
Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list