嵌入式 - UART Flow Control

本文详细介绍了UART流量控制,包括硬件流控(RTS/CTS)的工作原理、软件流控(XON/XOFF)的应用,以及UART驱动支持的重要性。同时提到了硬件流控信号有效时的电平处理和注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

简介 / Introduction

UART 流量控制是一种让慢速和快速设备通过 UART 相互通信而不会丢失数据的方法。

考虑两个设备通过 UART 通信的情况。发送器 T 正在向接收器 R 发送一长串字节。R 是一个比 T 慢的设备,在某些时候 R 无法跟上。它需要对数据进行一些处理或清空一些缓冲区,然后才能继续接收数据。

R 需要告诉 T 暂时停止传输。这就是流量控制的作用。 流量控制提供额外的信令,通知发送器应该停止(暂停)或开始(恢复)传输。

目前存在几种形式的流量控制。例如,硬件流量控制使用额外的导线,这些导线上的逻辑电平决定发送器是继续发送数据还是停止发送。在软件流量控制中,通过正常数据线发送特殊字符来启动或停止传输。

UART Flow Control is a method for slow and fast devices to communicate with each other over  UART without the risk of losing data.

Consider the case where two units are communicating over UART. A transmitter T is sending a  long stream of bytes to a receiver R. R is a slower device than T, and at some point R cannot keep up. It needs to either do some  processing on the data or empty some buffers before it can keep receiving data.

R needs to tell T to stop transmitting for a while. This is where flow control comes in.  Flow control provides extra signaling to inform the transmitter that it should stop (pause) or start (resume) the transmission.

Several forms of flow control exist. For example, hardware flow control uses extra wires,  where the logic level on these wires define whether the transmitter should keep sending data or stop. With software flow control,  special characters are sent over the normal data lines to start or stop the transmission.

流控协议 / Flow Control Protocols

下面来介绍实现流控的常用方法。

  • UART Hardware Flow Control / 硬件流控

使用硬件流量控制(也称为 RTS/CTS 流量控制)时,除了数据线外,还需要两条额外的导线。它们分别称为 RTS(请求发送)和 CTS(清除发送)。这两条线在两台设备之间交叉耦合,因此一

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夜流冰

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值