mirror of
https://gitee.com/Vancouver2017/luban-lite-t3e-pro.git
synced 2025-12-14 18:38:55 +00:00
321 lines
50 KiB
HTML
321 lines
50 KiB
HTML
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-cn" lang="zh-cn" data-whc_version="26.0">
|
||
<head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><meta name="description" content="通用异步收发传输器(Universal Asynchronous Receiver/Transmitter),通常称作 UART,是一种通用串行数据总线。 串行通信是指利用一条传输线将数据一位位地顺序传送,通信线路非常简单。 UART 为双向通信,可以实现全双工传输和接收。在嵌入式设计中,UART 用于主机与辅助设备通信,如汽车音响与外接 AP 之间的通信,也用于 PC ..."/><meta name="DC.rights.owner" content="(C) 版权 2025"/><meta name="copyright" content="(C) 版权 2025"/><meta name="generator" content="DITA-OT"/><meta name="DC.type" content="concept"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-12-16"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="uart_user_guide"/><meta name="DC.language" content="zh-CN"/><title>UART 使用指南</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/uart/uart_user_guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/uart/uart_user_guide.html"/>
|
||
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/commons.css?buildId=2023110923"/>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/app/topic.css?buildId=2023110923"/>
|
||
|
||
<script src="../../../webhelp/app/options/properties.js?buildId=20250121171154"></script>
|
||
<script src="../../../webhelp/app/localization/strings.js?buildId=2023110923"></script>
|
||
<script src="../../../webhelp/app/search/index/keywords.js?buildId=20250121171154"></script>
|
||
<script defer="defer" src="../../../webhelp/app/commons.js?buildId=2023110923"></script>
|
||
<script defer="defer" src="../../../webhelp/app/topic.js?buildId=2023110923"></script>
|
||
<link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-styles-web.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/notes.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-common.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-images.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/footnote.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/aic-web-watermark.css?buildId=2023110923"/><link rel="stylesheet" type="text/css" href="../../../webhelp/template/topic-body-list.css?buildId=2023110923"/></head>
|
||
|
||
<body id="uart_user_guide" class="wh_topic_page frmBody">
|
||
<a href="#wh_topic_body" class="sr-only sr-only-focusable">
|
||
跳转到主要内容
|
||
</a>
|
||
|
||
|
||
|
||
|
||
<header class="navbar navbar-default wh_header">
|
||
<div class="container-fluid">
|
||
<div class="wh_header_flex_container navbar-nav navbar-expand-md navbar-dark">
|
||
<div class="wh_logo_and_publication_title_container">
|
||
<div class="wh_logo_and_publication_title">
|
||
|
||
<a href="http://www.artinchip.com" class=" wh_logo d-none d-sm-block "><img src="../../../company-logo-white.png" alt="RTOS SDK 使用指南SDK 指南文件"/></a>
|
||
<div class=" wh_publication_title "><a href="../../../index.html"><span class="booktitle"><span class="ph mainbooktitle">RTOS SDK 使用指南</span><span class="ph booktitlealt">SDK 指南文件</span></span></a></div>
|
||
|
||
</div>
|
||
|
||
|
||
</div>
|
||
|
||
<div class="wh_top_menu_and_indexterms_link collapse navbar-collapse" id="wh_top_menu_and_indexterms_link">
|
||
|
||
|
||
|
||
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</header>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_search_input navbar-form wh_topic_page_search search " role="form">
|
||
|
||
|
||
|
||
<form id="searchForm" method="get" role="search" action="../../../search.html"><div><input type="search" placeholder="搜索 " class="wh_search_textfield" id="textToSearch" name="searchQuery" aria-label="搜索查询" required="required"/><button type="submit" class="wh_search_button" aria-label="搜索"><span class="search_input_text">搜索</span></button></div></form>
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<div class="container-fluid" id="wh_topic_container">
|
||
<div class="row">
|
||
|
||
<nav class="wh_tools d-print-none navbar-expand-md" aria-label="Tools">
|
||
|
||
<div data-tooltip-position="bottom" class=" wh_breadcrumb "></div>
|
||
|
||
|
||
|
||
<div class="wh_right_tools">
|
||
<button class="wh_hide_highlight" aria-label="切换搜索突出显示" title="切换搜索突出显示"></button>
|
||
<button class="webhelp_expand_collapse_sections" data-next-state="collapsed" aria-label="折叠截面" title="折叠截面"></button>
|
||
|
||
|
||
|
||
|
||
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
|
||
|
||
|
||
</div>
|
||
|
||
</nav>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="wh_content_area">
|
||
<div class="row">
|
||
|
||
|
||
<div class="col-lg-10 col-md-10 col-sm-10 col-xs-12" id="wh_topic_body">
|
||
|
||
<button id="wh_close_topic_toc_button" class="close-toc-button d-none" aria-label="Toggle topic table of content" aria-controls="wh_topic_toc" aria-expanded="true">
|
||
<span class="close-toc-icon-container">
|
||
<span class="close-toc-icon"></span>
|
||
</span>
|
||
</button>
|
||
|
||
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic concept/concept topic concept" role="article" aria-labelledby="ariaid-title1"><span class="edit-link" style="font-size:12px; opacity:0.6; text-align:right; vertical-align:middle"><a target="_blank" href="http://172.16.35.88/tasks/jdssno1uvvbf2mltu9kb9v3if05d5gopuakboe8hlud18rma/edit/F:/aicdita/aicdita-cn/topics/sdk/uart/uart_user_guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">UART 使用指南</h1><div class="date inPage">16 Dec 2024</div><div style="color: gray;">
|
||
Read time: 3 minute(s)
|
||
</div><div class="- topic/body concept/conbody body conbody"><p class="- topic/p p" data-ofbid="d213008e22__20250121171640">通用异步收发传输器(Universal Asynchronous Receiver/Transmitter),通常称作 UART,是一种通用串行数据总线。</p><p class="- topic/p p" data-ofbid="d213008e24__20250121171640">串行通信是指利用一条传输线将数据一位位地顺序传送,通信线路非常简单。</p><p class="- topic/p p" data-ofbid="d213008e26__20250121171640">UART 为双向通信,可以实现全双工传输和接收。在嵌入式设计中,UART 用于主机与辅助设备通信,如汽车音响与外接 AP 之间的通信,也用于 PC
|
||
机通信包括与监控调试器和其它器件,如 EEPROM 通信。</p><p class="- topic/p p" data-ofbid="d213008e28__20250121171640">在 UART 上追加同步方式的序列信号变换电路的产品,被称为 USART (Universal Synchronous Asynchronous Receiver
|
||
Transmitter)。</p><div class="table-container"><table class="- topic/table table frame-all" id="uart_user_guide__table_eny_3yy_21c" data-ofbid="uart_user_guide__table_eny_3yy_21c" data-cols="3"><caption class="- topic/title title tablecap" data-caption-side="top" data-is-repeated="true"><span class="table--title-label">表<span class="table--title-label-number"> 1</span><span class="table--title-label-punctuation">. </span></span><span class="table--title">术语定义</span></caption><colgroup><col style="width:21.69197396963124%"/><col style="width:42.51626898047723%"/><col style="width:35.791757049891544%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_eny_3yy_21c__entry__1">术语</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_eny_3yy_21c__entry__2">定义</th><th class="- topic/entry entry colsep-0 rowsep-1" id="uart_user_guide__table_eny_3yy_21c__entry__3">注释说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">UART</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Universal Asynchronous Receiver/Transmitter</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">通用异步收发传输器</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">TTL</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Transistor-Transistor Logic</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">逻辑门电路</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">DCD</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Data Carrier Detect</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">载波侦听</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">DTR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Data Terminal Ready</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">数据终端准备好</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">DSR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Data Set Ready</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">数据准备好</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">RTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Request To Send</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">请求发送</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">CTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Clear To Send</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">清除发送</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">RI</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Ring Indicator</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">响铃指示</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">THR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Transmit Holding Register</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">发送保持寄存器</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__1">RBR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Receive Buffer Register</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_eny_3yy_21c__entry__3">接收缓冲寄存器</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_eny_3yy_21c__entry__1">ACPI</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_eny_3yy_21c__entry__2">Advanced Configuration and Power Interface</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="uart_user_guide__table_eny_3yy_21c__entry__3">高阶配置和电源接口</td></tr></tbody></table></div><section class="- topic/section section" id="uart_user_guide__id12" data-ofbid="uart_user_guide__id12"><h2 class="- topic/title title sectiontitle">模块特性</h2>
|
||
|
||
<ul class="- topic/ul ul simple" id="uart_user_guide__ul_qj4_btm_fdc" data-ofbid="uart_user_guide__ul_qj4_btm_fdc"><li class="- topic/li li" data-ofbid="d213008e129__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e131__20250121171640">兼容工业标准 16550 UART</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e134__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e136__20250121171640">256x8bit 发送与接收 FIFO</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e139__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e141__20250121171640">传输速度可达 3 Mbps</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e144__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e146__20250121171640">支持 5-8 数据位以及 1/1 ½/2 停止位</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e149__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e151__20250121171640">支持奇校验,偶校验或者无奇偶校验</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e154__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e156__20250121171640">支持 DMA 控制器接口</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e159__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e161__20250121171640">支持软件/硬件流控</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e164__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e166__20250121171640">支持 IrDA 1.0 SIR</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e169__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e171__20250121171640">支持 RS-485/9bit 模式</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e174__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e176__20250121171640">RS-485 支持硬件使能</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e179__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e181__20250121171640">Compact-IO 精简 2 线模式</p>
|
||
</li></ul>
|
||
</section><section class="- topic/section section" id="uart_user_guide__section_wll_lyy_21c" data-ofbid="uart_user_guide__section_wll_lyy_21c"><h2 class="- topic/title title sectiontitle">通信协议</h2>
|
||
|
||
<p class="- topic/p p" data-ofbid="d213008e190__20250121171640">UART 作为异步串行通信协议的一种,工作原理是将传输数据的每个字符一位接一位地传输。其协议中添加了一些特殊的表示位:</p>
|
||
<ul class="- topic/ul ul" id="uart_user_guide__ul_zfw_qgp_ybc" data-ofbid="uart_user_guide__ul_zfw_qgp_ybc"><li class="- topic/li li" data-ofbid="d213008e194__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_agw_qgp_ybc" data-ofbid="uart_user_guide__dl_agw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e198__20250121171640">起始位 Start bit</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e202__20250121171640">先发出一个逻辑“0”的信号,表示传输字符的开始</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e206__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_bgw_qgp_ybc" data-ofbid="uart_user_guide__dl_bgw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e210__20250121171640">数据位 Data bits</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e214__20250121171640">紧接着起始位之后。数据位的个数可以是 4、5、6、7、8 等,构成一个字符。通常采用 ASCII
|
||
码。从最低位开始传送,靠时钟定位。</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e218__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_cgw_qgp_ybc" data-ofbid="uart_user_guide__dl_cgw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e222__20250121171640">奇偶校验位 Parity</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e226__20250121171640">数据位加上这一位后,使得“1”的位数应为偶数(偶校验)或奇数(奇校验),以此来校验数据传送的正确性。</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e230__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_dgw_qgp_ybc" data-ofbid="uart_user_guide__dl_dgw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e234__20250121171640">停止位 Stop bits</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e238__20250121171640">它是一个字符数据的结束标志。可以是 1 位、1.5 位、2 位的高电平。
|
||
由于数据是在传输线上定时的,并且每一个设备有其自己的时钟,很可能在通信中两台设备间出现了小小的不同步。因此停止位不仅仅是表示传输的结束,并且提供计算机校正时钟同步的机会。停止位的位数越多,时钟同步的容忍程度越大,但是数据传输率会越慢</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e242__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_egw_qgp_ybc" data-ofbid="uart_user_guide__dl_egw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e246__20250121171640">流控 Flow contorl</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e250__20250121171640">管理两个节点之间数据传输速率的过程,以防止出现接收端的数据缓冲区已满,而发送端依然继续发送数据,所导致数据丢失,我们会在一些上位机上看到
|
||
RTS /CTS、DTR /DSR 和 XON /XOFF 的选项,这是对流控制的选项</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e254__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_fgw_qgp_ybc" data-ofbid="uart_user_guide__dl_fgw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e258__20250121171640">空闲位</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e262__20250121171640">处于逻辑“1”状态,表示当前线路上没有数据传送,该位为协议位,自动产生</p>
|
||
</dd></dl>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e266__20250121171640">
|
||
<dl class="- topic/dl dl" id="uart_user_guide__dl_ggw_qgp_ybc" data-ofbid="uart_user_guide__dl_ggw_qgp_ybc"><dt class="- topic/dt dt dlterm" data-ofbid="d213008e270__20250121171640">波特率 BaudRate</dt><dd class="- topic/dd dd">
|
||
<p class="- topic/p p" data-ofbid="d213008e274__20250121171640">是衡量数据传送速率的指标。表示每秒钟传送的 bit 数。比如波特率 115200,表示传输速率是 115200 bps</p>
|
||
</dd></dl>
|
||
</li></ul>
|
||
<ul class="- topic/ul ul simple" id="uart_user_guide__ul_aj4_btm_fdc" data-ofbid="uart_user_guide__ul_aj4_btm_fdc"><li class="- topic/li li" data-ofbid="d213008e280__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e282__20250121171640">串口、COM 口是指的物理接口形式(硬件)。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e285__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e287__20250121171640">TTL、RS-232、RS-485 是指的电平标准(电信号)。</p>
|
||
</li></ul>
|
||
</section><section class="- topic/section section" id="uart_user_guide__section_fml_lyy_21c" data-ofbid="uart_user_guide__section_fml_lyy_21c"><h2 class="- topic/title title sectiontitle">参数信息</h2><p class="- topic/p p" data-ofbid="d213008e294__20250121171640">在 UART
|
||
进行通信的时候,双方需要协商相关参数,否则无法进行信息解析,因此在通信之初,需要对所使用的工具设置上述的所有参数</p><div class="- topic/p p" data-ofbid="d213008e296__20250121171640"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="uart_user_guide__image_gml_lyy_21c" src="../../../images/uart/uart-param.jpg" alt="uart-param1"/></div><br/></div></section><section class="- topic/section section" id="uart_user_guide__section_qvz_tyy_21c" data-ofbid="uart_user_guide__section_qvz_tyy_21c"><h2 class="- topic/title title sectiontitle">常用接口</h2>
|
||
|
||
<div class="- topic/p p" data-ofbid="d213008e305__20250121171640">串口、COM 口是指的物理接口形式(硬件)。TTL、RS-232、RS-485 是指的电平标准(电信号)。<ul class="- topic/ul ul" id="uart_user_guide__ul_pj4_vyy_21c" data-ofbid="uart_user_guide__ul_pj4_vyy_21c"><li class="- topic/li li" data-ofbid="d213008e308__20250121171640">TTL<ul class="- topic/ul ul" id="uart_user_guide__ul_iml_lyy_21c" data-ofbid="uart_user_guide__ul_iml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e311__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e313__20250121171640">TTL 标准是低电平(0V)为 0,高电平(+5V)为 1。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e316__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e318__20250121171640">TTL 接口需要对端接口也为 TTL,但诸如 PC 等设备无 TTL 接口的 UART 口,一般转 TTL 为 USB 等 PC
|
||
更通用的接口。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e321__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e323__20250121171640">TTL 接口为全双工,连接设备的时候一般只接 GND/RX/TX。不会接 Vcc 或者 +3.3v
|
||
的电源线,避免与目标设备上的供电冲突,但 GND 可以保证源设备和目标设备供地,有助于信号稳定。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e326__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e328__20250121171640">信号线采用交叉的方式,即源端的 RX 连接目标设备的 TX,源端的 TX 连接目标设备的 RX。</p>
|
||
</li></ul></li><li class="- topic/li li" data-ofbid="d213008e331__20250121171640">RS232<ul class="- topic/ul ul" id="uart_user_guide__ul_jml_lyy_21c" data-ofbid="uart_user_guide__ul_jml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e334__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e336__20250121171640">RS232 标准是正电平(+3V~+15V)为 0,负电平(-13V~-15V)为 1。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e339__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e341__20250121171640">RS232 接口在总线上只允许连接 1 个收发器,单站能力。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e344__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e346__20250121171640">RS232 传输线采用屏蔽双绞线,最高传输距离一般为 15M,最大速率为 20Kbps。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e349__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e351__20250121171640">RS232 接口为全双工,连接设备的时候一般只接 GND/RX/TX。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e354__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e356__20250121171640">信号线也采用交叉的方式,即源端的 RX 连接目标设备的 TX,源端的 TX 连接目标设备的 RX。</p>
|
||
</li></ul></li><li class="- topic/li li" data-ofbid="d213008e359__20250121171640">RS422<ul class="- topic/ul ul" id="uart_user_guide__ul_kml_lyy_21c" data-ofbid="uart_user_guide__ul_kml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e362__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e364__20250121171640">RS422
|
||
标准采用差分信号负逻辑,逻辑“1”以两线间的电压差为+(2—6)V 表示。逻辑“0”以两线间的电压差为-(2—6)V 表示。接口信号电平比
|
||
RS232 降低了,就不易损坏接口电路的芯片,且该电平与 TTL 电平兼容,可方便与 TTL 电路连接。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e367__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e369__20250121171640">RS422 接口在总线上是允许连接多达 128 个收发器,多站能力。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e372__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e374__20250121171640">RS422 的数据最高传输速率为 10Mbps,100 米长双绞线的最大速度为 1Mb/s。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e377__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e379__20250121171640">RS422 采用平衡发送和差分接收,因此具有抑制共模干扰的能力。RS422
|
||
接口的最大传输距离标准值为 4000 英尺(约 1219 米),实际上可达 3000 米。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e382__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e384__20250121171640">RS422 是全双工,连接设备的时候一般接 RX+/RX-/TX+/TX-/GND。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e387__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e389__20250121171640">信号线也采用交叉的方式,即源端的 RX-/RX+ 连接目标设备的 TX-/TX+,源端的 TX-/TX+ 连接目标设备的
|
||
RX-/RX+。</p>
|
||
</li></ul></li><li class="- topic/li li" data-ofbid="d213008e392__20250121171640">RS485<ul class="- topic/ul ul" id="uart_user_guide__ul_lml_lyy_21c" data-ofbid="uart_user_guide__ul_lml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e395__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e397__20250121171640">RS485 的电气性能和 RS422 完全一样,主要区别是 RS485 是半双工。连接设备的时候一般接 A-/A+/GND,DB9
|
||
接口定义了两组,同时必须使用同一组的+/-。</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e400__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e402__20250121171640">信号线也采用交叉的方式,即源端的 A- 连接目标设备的 A-,源端的 A+ 连接目标设备的 A+。</p>
|
||
</li></ul></li></ul></div>
|
||
</section><section class="- topic/section section" id="uart_user_guide__section_qsp_xyy_21c" data-ofbid="uart_user_guide__section_qsp_xyy_21c"><h2 class="- topic/title title sectiontitle">插头</h2><div class="- topic/p p" data-ofbid="d213008e409__20250121171640">公母之分<ul class="- topic/ul ul" id="uart_user_guide__ul_mml_lyy_21c" data-ofbid="uart_user_guide__ul_mml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e412__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e414__20250121171640">针形的为公头,孔形的为母头</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e417__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e419__20250121171640">PC 串口一般为公头,设备的一般为母头</p>
|
||
</li></ul></div><div class="- topic/p p" data-ofbid="d213008e422__20250121171640">
|
||
<br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="uart_user_guide__image_nml_lyy_21c" src="../../../images/uart/port-male.jpg" width="288" alt="port-male1"/></div><br/>
|
||
</div> RS232DB9 的信号分分四组:<ul class="- topic/ul ul" id="uart_user_guide__ul_pml_lyy_21c" data-ofbid="uart_user_guide__ul_pml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e430__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e432__20250121171640">DCD/RI:电气 Ready 参数</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e435__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e437__20250121171640">DTR/DSR:模块 Ready 参数</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e440__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e442__20250121171640">RTS/CTS:流控参数</p>
|
||
</li><li class="- topic/li li" data-ofbid="d213008e445__20250121171640">
|
||
<p class="- topic/p p" data-ofbid="d213008e447__20250121171640">RXD/TXD:数据收发</p>
|
||
</li></ul><div class="table-container"><table class="- topic/table table frame-all" id="uart_user_guide__table_qml_lyy_21c" data-ofbid="uart_user_guide__table_qml_lyy_21c" data-cols="7"><caption></caption><colgroup><col style="width:25%"/><col style="width:25%"/><col style="width:25%"/><col style="width:25%"/><col/><col/><col/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__1">针序</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__2">RS232</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__3">说明</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__4">RS422</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__5">说明</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__6">RS485</th><th class="- topic/entry entry colsep-0 rowsep-1" id="uart_user_guide__table_qml_lyy_21c__entry__7">说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">1</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">DCD</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">数据载波检测</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">RXD-</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">接收</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">A-</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">组 1</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">2</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">RXD</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">接收数据</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">-</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">-</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">-</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">-</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">3</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">TXD</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">发送数据</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">-</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">-</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">-</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">-</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">4</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">DTR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">数据终端准备好</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">TXD+</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">发送</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">A+</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">组 2</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">5</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">GND</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">信号地</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">GND</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">信号地</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">GND</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">信号地</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">6</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">DSR</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">数据准备好</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">RXD+</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">接收</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">A+</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">组 1</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">7</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">RTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">请求发送</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">RTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">请求发送</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">RTS</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">请求发送</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__1">8</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__2">CTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__3">清除发送</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__4">CTS</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__5">清除发送</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__6">CTS</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_qml_lyy_21c__entry__7">清除发送</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__1">9</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__2">RI</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__3">响铃指示</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__4">TXD-</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__5">发送</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__6">A-</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="uart_user_guide__table_qml_lyy_21c__entry__7">组 2</td></tr></tbody></table></div>
|
||
</section><section class="- topic/section section" id="uart_user_guide__section_rml_lyy_21c" data-ofbid="uart_user_guide__section_rml_lyy_21c"><h2 class="- topic/title title sectiontitle">流控</h2>
|
||
|
||
<p class="- topic/p p" data-ofbid="d213008e617__20250121171640">这里讲到的
|
||
“流”,指的是数据流。在数据通信中,流控制是管理两个节点之间数据传输速率的过程,以防止出现接收端的数据缓冲区已满,而发送端依然继续发送数据,所导致数据丢失。</p>
|
||
<p class="- topic/p p" data-ofbid="d213008e620__20250121171640">当接收端的数据缓冲区已满,无法处理数据来时,就发出 “不再接收” 的信号,发送端则停止发送,直到发送端收到 “可以继续发送” 的信号再发送数据。</p>
|
||
<div class="- topic/p p" data-ofbid="d213008e623__20250121171640">计算机中常用的两种流控制分别是硬件流控制(RTS /CTS、DTR /DSR 等)和软件流控制(XON /XOFF)。<ul class="- topic/ul ul" id="uart_user_guide__ul_n1b_bzy_21c" data-ofbid="uart_user_guide__ul_n1b_bzy_21c"><li class="- topic/li li" data-ofbid="d213008e626__20250121171640">硬件流控<p class="- topic/p p" data-ofbid="d213008e628__20250121171640">RTS/CTS
|
||
属于硬件握手的一种,最初是设计为电传打字机和调制解调器半双工协作通信的,每次它只能一方调制解调器发送数据。终端必须发送请求发送信号然后等到调制解调器回应清除发送信号。</p><div class="- topic/p p" data-ofbid="d213008e630__20250121171640">
|
||
<br/><div class="imagecenter"><img class="- topic/image image imagecenter" id="uart_user_guide__image_tml_lyy_21c" src="../../../images/uart/flowctrol.jpg" alt="flowctrol1"/></div><br/>
|
||
</div></li><li class="- topic/li li" data-ofbid="d213008e636__20250121171640">软件流控<p class="- topic/p p" data-ofbid="d213008e638__20250121171640">软件流控制(Software flow control)是在计算机数据链路中的一种流控制方法,特别适用于 RS232
|
||
串口通信。它是采用特殊字符来传输带内信令,特殊编码字符称作 XOFF 与 XON(分别表示 “transmit off” 与 “transmit
|
||
on”)。因此,也被称作 “XON /XOFF 流控制”。</p><div class="table-container"><table class="- topic/table table frame-all" id="uart_user_guide__table_vml_lyy_21c" data-ofbid="uart_user_guide__table_vml_lyy_21c" data-cols="5"><caption></caption><colgroup><col style="width:20%"/><col style="width:20%"/><col style="width:20%"/><col style="width:20%"/><col style="width:20%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_vml_lyy_21c__entry__1">码的名字</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_vml_lyy_21c__entry__2">含义</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_vml_lyy_21c__entry__3">ASCII</th><th class="- topic/entry entry colsep-1 rowsep-1" id="uart_user_guide__table_vml_lyy_21c__entry__4">十进制</th><th class="- topic/entry entry colsep-0 rowsep-1" id="uart_user_guide__table_vml_lyy_21c__entry__5">十六进制</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_vml_lyy_21c__entry__1">XOFF</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_vml_lyy_21c__entry__2">暂停传输</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_vml_lyy_21c__entry__3">DC3</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="uart_user_guide__table_vml_lyy_21c__entry__4">19</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="uart_user_guide__table_vml_lyy_21c__entry__5">13</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_vml_lyy_21c__entry__1">XON</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_vml_lyy_21c__entry__2">恢复传输</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_vml_lyy_21c__entry__3">DC1</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="uart_user_guide__table_vml_lyy_21c__entry__4">17</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="uart_user_guide__table_vml_lyy_21c__entry__5">11</td></tr></tbody></table></div><p class="- topic/p p" data-ofbid="d213008e682__20250121171640">A 端的 DTR(数据设备就绪)发出信号, 当 B 端准备好后,B 端的 DTR(数据设备就绪)向 A 端的
|
||
DSR(通讯设备就绪)发出信号。 接下来就可以通过 RTS(请求发送)和 DTR(允许发送)来控制通信。</p></li></ul></div>
|
||
</section><section class="- topic/section section" id="uart_user_guide__section_wml_lyy_21c" data-ofbid="uart_user_guide__section_wml_lyy_21c"><h2 class="- topic/title title sectiontitle">RAW 模式</h2>
|
||
|
||
<p class="- topic/p p" data-ofbid="d213008e691__20250121171640">UART 作为 tty 设备工作时,有两种工作方式:</p>
|
||
<ul class="- topic/ul ul" id="uart_user_guide__ul_xml_lyy_21c" data-ofbid="uart_user_guide__ul_xml_lyy_21c"><li class="- topic/li li" data-ofbid="d213008e695__20250121171640">Canonical Input<p class="- topic/p p" data-ofbid="d213008e697__20250121171640">RX 端接收到数据之后不会直接反馈给用户态的 read
|
||
函数,而是要一直等到一个回车,意即对一些特殊字符进行语意解析</p></li><li class="- topic/li li" data-ofbid="d213008e699__20250121171640">Raw Input<p class="- topic/p p" data-ofbid="d213008e701__20250121171640">RX 端接收到什么直接返回到用户空间的 read 函数里面</p></li></ul>
|
||
<p class="- topic/p p" data-ofbid="d213008e704__20250121171640">两种工作模式均为 kernel 层逻辑,和驱动/硬件无关,对于普通的 uart 应用,建议 Canonical 方式,对于 RS485 应用,建议使用 Raw
|
||
方式,二者通过 termios 的 lflag 参数的 ICANON 位进行区分。</p>
|
||
</section></div></article></main></div>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
<nav role="navigation" id="wh_topic_toc" aria-label="On this page" class="col-lg-2 d-none d-lg-block navbar d-print-none">
|
||
<div id="wh_topic_toc_content">
|
||
|
||
<div class=" wh_topic_toc "><div class="wh_topic_label">在本页上</div><ul><li class="section-item"><div class="section-title"><a href="#uart_user_guide__id12" data-tocid="uart_user_guide__id12">模块特性</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_wll_lyy_21c" data-tocid="uart_user_guide__section_wll_lyy_21c">通信协议</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_fml_lyy_21c" data-tocid="uart_user_guide__section_fml_lyy_21c">参数信息</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_qvz_tyy_21c" data-tocid="uart_user_guide__section_qvz_tyy_21c">常用接口</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_qsp_xyy_21c" data-tocid="uart_user_guide__section_qsp_xyy_21c">插头</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_rml_lyy_21c" data-tocid="uart_user_guide__section_rml_lyy_21c">流控</a></div></li><li class="section-item"><div class="section-title"><a href="#uart_user_guide__section_wml_lyy_21c" data-tocid="uart_user_guide__section_wml_lyy_21c">RAW 模式</a></div></li></ul></div>
|
||
|
||
</div>
|
||
</nav>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
|
||
|
||
</div>
|
||
<footer class="navbar navbar-default wh_footer">
|
||
<div class=" footer-container mx-auto ">
|
||
<title>footer def</title>
|
||
<style><!--
|
||
|
||
.p1 {
|
||
font-family: FangZhengShuSong, Times, serif;
|
||
}
|
||
.p2 {
|
||
font-family: Arial, Helvetica, sans-serif;
|
||
}
|
||
.p3 {
|
||
font-family: "Lucida Console", "Courier New", monospace;
|
||
}
|
||
|
||
--></style>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<div class="webhelp.fragment.footer">
|
||
<p class="p1">Copyright © 2019-2024 广东匠芯创科技有限公司. All rights reserved.</p>
|
||
</div><div>
|
||
<div class="generation_time">
|
||
Update Time: 2025-01-21
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
<div id="go2top" class="d-print-none">
|
||
<span class="oxy-icon oxy-icon-up"></span>
|
||
</div>
|
||
|
||
<div id="modal_img_large" class="modal">
|
||
<span class="close oxy-icon oxy-icon-remove"></span>
|
||
<div id="modal_img_container"></div>
|
||
<div id="caption"></div>
|
||
</div>
|
||
|
||
|
||
<script src="${pd}/publishing/publishing-styles-AIC-template/js/custom.js" defer="defer"></script>
|
||
|
||
|
||
</body>
|
||
</html> |