当前位置:网站首页>Is there any cumulative error in serial communication and the requirements for clock accuracy
Is there any cumulative error in serial communication and the requirements for clock accuracy
2022-07-19 07:59:00 【Embedded Linux,】
1. The problem background :
2. Problem analysis :
3. summary :
1. The problem background :
For embedded developers , Serial port should be the most widely used module , In the process of daily customer support, customers often ask some questions about the stability of serial communication , Some typical problems are as follows :
stay 9600 Baud rate can work , But switch to 115200 You can't communicate normally , Is it related to the accuracy of the clock ?
What is the requirement of serial port stable communication for clock accuracy , Whether the higher the baud rate configuration, the higher the clock accuracy requirements ? Inside RC Can you meet ?
The serial port communicates normally for a period of time, and the communication error , Is it because the cumulative error is too large ?
Despite the overwhelming information about serial port configuration on the Internet , But there is really not much description of these specific problems , So I studied it carefully .
2. Problem analysis :

To answer these questions, we need to start with the sampling sequence of serial communication , As shown in the figure above , According to the sampling characteristics of the serial port, it is not difficult to see , For the sender , The data is being drive On the bus , The receiving end is at each bit Sampling in the middle of , This means that in the last Bit Bit sampling , The allowable limit offset is 50%, If used 1 Starting bits +9 Data bits +1 Two parity bits +1 Stop bits to calculate , Then each deviation is up to :
±50% / 12 = ±4.16%
Note: For some serial ports that support oversampling , The sampling point may not be 50% In the middle , Generally, it will be more backward , No discussion here ;
If used 1 Starting bits +8 Data bits +1 Stop bits to calculate , Then each deviation is up to :±50% / 10 = ±5%
And serial communication , It involves both sending and receiving ends , When one end is 0 error , The maximum error at the other end can reach 4.16%, If the errors at both ends are the same , Then the maximum error at each end can only be 2.08%, This is why many hardware masters suggest that the baud rate error of the serial port be controlled within 2% within .
±4.16% / 2 = ±2.08%
therefore , For serial communication , It can be roughly considered that , The clock error is less than ±2% when , Communication is relatively reliable . For the actual application system of customers , in consideration of UART It is an asynchronous communication , The stability of communication depends on the clock accuracy of both sides , It doesn't mean that only one side's accuracy meets the requirements , The system will work , So it needs to be considered systematically .
3. summary :
Based on the above analysis , It can be concluded as follows :
The stable communication of serial port is related to the clock accuracy of both sides , The total error cannot exceed ±4.16%, For most full temperature ranges ±1% Of MCU Come on , Can meet the basic communication needs .
The cumulative error of serial communication occurs in each data ( It can also be simply understood as each byte , Just the bytes are not precise , Because sometimes the data may be 9 bits) Send internal , There is no cumulative error between successive transmissions , Because consecutive multiple bytes will be sent Start Start signal for resynchronization , That is to say, transmission 1 Error and transmission of bytes 1000 The error of bytes is basically the same ;
Whether the serial port is stable or not has nothing to do with the baud rate , It is not that the higher the baud rate configuration, the higher the clock accuracy requirements , Only with the length of serial port data sent each time ( Contains the start bit / Data bits / Parity bit / Stop bit length ) of , Longer bit length , The higher the accuracy of the clock ;
For using serial port LIN Communications , The above conclusion is also basically applicable ;
The above conclusion is only analyzed from the perspective of sampling timing , Do not consider the influence of external electromagnetic interference , Because usually the higher the baud rate , The shorter the time length of each data , The more vulnerable it is to electromagnetic interference, resulting in unreliable communication .


边栏推荐
- Use of mongodb
- Redis storage structure principle 2
- Flowable query, complete, void, delete tasks
- fiddler 抓包工具使用
- High performance integrated video image processing board based on ultrascale FPGA + Huawei Hisilicon arm / fpga+arm
- 利用PCA来简化数据
- 60. Clear cache
- How to write the highlights of SCI papers (seriously teach you how to write)
- 【刷题篇】完全平方数
- Introduction & use of Maxwell
猜你喜欢

Pytorch随记(1)

How does continuous integration manage Jenkins?

Redis 跳跃表实现原理 & 时间复杂度分析
![Virtual machine stack of [JVM]](/img/7b/5d847112230adcac087b9d6071baed.png)
Virtual machine stack of [JVM]
【特征工程】

Real time data warehouse - Design & Implementation of real-time data warehouse from 0 to 1 (sparkstreaming3.x)

Visit Beijing Zoo in dog days

How does Jenkins set the mailbox to automatically send mail?

在线问题反馈模块实战(五):实现对通用字段内容自动填充功能

【MySQL】 MVCC:正确理解MVCC及其实现原理
随机推荐
Facial key point detection CNN
912. 排序数组(数组排序)
Modify scroll bar style
Redis storage structure principle 2
修改select样式
半导体材料技术
京东购买意向预测(三)
Visual Studio 生产环境配置方案:SlowCheetah
Spark3.x-practical double flow join (window and redis implementation method and template code)
How to choose the right model
力扣114题:二叉树展开链表
Use of mongodb
泰坦尼克号乘客获救预测(进阶)
redis缓存雪崩、穿透、击穿
Comparative analysis of the differences between nor and NAND
Modify checkbox style
Visit Beijing Zoo in dog days
MongoDB的使用
Environment variables and folder placement location
Regular expression extraction of matching content