Files
luban-lite-t3e-pro/doc/topics/sdk/uart/uart_user_guide_2.html
2025-01-23 16:37:00 +08:00

338 lines
68 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!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.relation" content="../../../topics/chapter-title/chapter-interface-sdk.html"/><meta name="DC.relation" content="../../../topics/sdk/spi/spi_faq_2.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_config_lite.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_config_lite.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_debug_lite.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_test_lite.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_design_lite.html"/><meta name="DC.relation" content="../../../topics/sdk/uart/uart_faq_2.html"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-01-15"/><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="uart_user_guide-d5856e5879"/><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_2.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 "><ol class="d-print-none"><li><span class="home"><a href="../../../index.html"><span>主页</span></a></span></li><li><div class="topicref" data-id="id"><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div></li><li><div class="topicref" data-id="concept_nww_hzh_pzb"><div class="title"><a href="../../../topics/chapter-title/chapter-interface-sdk.html">接口</a><div class="wh-tooltip"><p class="shortdesc">CAN<span class="ph">、CAP</span>、CIR、GPAI、GPIO、I2C、PSADC、PWM 等接口模块的介绍和使用说明。</p></div></div></div></li><li class="active"><div class="topicref" data-id="uart_user_guide"><div class="title"><a href="../../../topics/sdk/uart/uart_user_guide_2.html">UART 使用指南</a></div></div></li></ol></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_navigation_links "><span id="topic_navigation_links" class="navheader">
<span class="navprev"><a class="- topic/link link" href="../../../topics/sdk/spi/spi_faq_2.html" title="常见问题" aria-label="上一主题: 常见问题" rel="prev"></a></span>
<span class="navnext"><a class="- topic/link link" href="../../../topics/sdk/uart/uart_config_lite.html" title="参数配置" aria-label="下一主题: 参数配置" rel="next"></a></span> </span></div>
<div class=" wh_print_link print d-none d-md-inline-block "><button onClick="window.print()" title="打印此页" aria-label="打印此页"></button></div>
<button type="button" id="wh_toc_button" class="custom-toggler navbar-toggler collapsed wh_toggle_button navbar-light" aria-expanded="false" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc">
<span class="navbar-toggler-icon"></span>
</button>
</div>
</nav>
</div>
<div class="wh_content_area">
<div class="row">
<nav id="wh_publication_toc" class="col-lg-3 col-md-3 col-sm-12 d-md-block d-none d-print-none" aria-label="Table of Contents Container">
<div id="wh_publication_toc_content">
<div class=" wh_publication_toc " data-tooltip-position="right"><span class="expand-button-action-labels"><span id="button-expand-action" role="button" aria-label="Expand"></span><span id="button-collapse-action" role="button" aria-label="Collapse"></span><span id="button-pending-action" role="button" aria-label="Pending"></span></span><ul role="tree" aria-label="Table of Contents"><li role="treeitem"><div data-tocid="revinfo_linux-d5856e989" class="topicref" data-id="revinfo_linux" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/revinfo/revinfo_rtos.html" id="revinfo_linux-d5856e989-link">修订记录</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e1003" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e1003-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/env/sdk-compile.html" id="id-d5856e1003-link">SDK 编译</a><div class="wh-tooltip"><p class="shortdesc">介绍不同编译环境下 SDK 的详细编译流程。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e1152" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e1152-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/advanced/sdk-usage.html" id="id-d5856e1152-link">使用指南</a><div class="wh-tooltip"><p class="shortdesc">系统镜像、编译选项、开发板、应用等相关的详细使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_rcx_czh_pzb-d5856e1416" class="topicref" data-id="concept_rcx_czh_pzb" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_rcx_czh_pzb-d5856e1416-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-app.html" id="concept_rcx_czh_pzb-d5856e1416-link">应用场景</a><div class="wh-tooltip"><p class="shortdesc">描述了 SDK 在不同应用场景中的配置和使用包括系统更新、OTA、安全方案等。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e2119" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e2119-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/peripheral/peripheral-intro.html" id="id-d5856e2119-link">外设移植</a><div class="wh-tooltip"><p class="shortdesc"><span class="ph">CTP、U 盘、SD 卡、有线和无线网络</span>等外设的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e2244" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e2244-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/bringup/chapter-bringup.html" id="id-d5856e2244-link">BringUp</a><div class="wh-tooltip"><p class="shortdesc">在硬件上电后快速初始化系统,为操作系统的启动准备好必要的硬件环境。</p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="id-d5856e2345" class="topicref" data-id="id" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action id-d5856e2345-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/chapter-advanced-app.html" id="id-d5856e2345-link">高级应用</a><div class="wh-tooltip"><p class="shortdesc">系统、存储、多媒体、接口、安全等模块的详细配置和设计说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="_0-d5856e2360" class="topicref" data-id="_0" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action _0-d5856e2360-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/boot/lite_boot_direct.html" id="_0-d5856e2360-link">启动引导</a><div class="wh-tooltip"><p class="shortdesc">启动引导程序 Bootloader 可以实现加载启动应用程序、 烧录和升级功能。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-system-d5856e2435" class="topicref" data-id="chapter-system" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-system-d5856e2435-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-system.html" id="chapter-system-d5856e2435-link">系统</a><div class="wh-tooltip"><p class="shortdesc"></p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-memory-d5856e3357" class="topicref" data-id="chapter-memory" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-memory-d5856e3357-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-memory-sdk.html" id="chapter-memory-d5856e3357-link">存储</a><div class="wh-tooltip"><p class="shortdesc">SDMC、SPI NAND、SPI NOR<span class="ph"> 以及文件系统</span> 等存储模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="concept_mcc_32s_nbc-d5856e3639" class="topicref" data-id="concept_mcc_32s_nbc" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action concept_mcc_32s_nbc-d5856e3639-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-multi-media-sdk.html" id="concept_mcc_32s_nbc-d5856e3639-link">多媒体</a><div class="wh-tooltip"><p class="shortdesc">GE、VE、Display、DVP、MPP、MPP 播放器等多媒体模块的介绍和使用说明。</p></div></div></div></li><li role="treeitem" aria-expanded="true"><div data-tocid="concept_nww_hzh_pzb-d5856e4868" class="topicref" data-id="concept_nww_hzh_pzb" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action concept_nww_hzh_pzb-d5856e4868-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-interface-sdk.html" id="concept_nww_hzh_pzb-d5856e4868-link">接口</a><div class="wh-tooltip"><p class="shortdesc">CAN<span class="ph">、CAP</span>、CIR、GPAI、GPIO、I2C、PSADC、PWM 等接口模块的介绍和使用说明。</p></div></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem" aria-expanded="false"><div data-tocid="can-d5856e4886" class="topicref" data-id="can" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action can-d5856e4886-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/can/can_user_guide_2.html" id="can-d5856e4886-link">CAN 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e4958" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e4958-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/cap/cap_user_guide.html" id="id-d5856e4958-link">CAP 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e5018" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e5018-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/qep/qep_user_guide.html" id="id-d5856e5018-link">QEP 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="cir-d5856e5228" class="topicref" data-id="cir" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action cir-d5856e5228-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/cir/cir_user_guide_2.html" id="cir-d5856e5228-link">CIR 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="gpai-user-guide-d5856e5336" class="topicref" data-id="gpai-user-guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action gpai-user-guide-d5856e5336-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/gpai/gpai_user_guide_2.html" id="gpai-user-guide-d5856e5336-link">GPAI 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e5408" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e5408-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/gpio/gpio_user_guide.html" id="id-d5856e5408-link">GPIO 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="i2c_user_guide-d5856e5480" class="topicref" data-id="i2c_user_guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action i2c_user_guide-d5856e5480-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/i2c/i2c_user_guide_2.html" id="i2c_user_guide-d5856e5480-link">I2C 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e5576" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e5576-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/psadc/psadc_user_guide_2.html" id="id-d5856e5576-link">PSADC 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e5648" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e5648-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/pwm/pwm_user_guide_2.html" id="id-d5856e5648-link">PWM 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="rtp-user-guide-d5856e5721" class="topicref" data-id="rtp-user-guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action rtp-user-guide-d5856e5721-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/rtp/rtp_user_guide_2.html" id="rtp-user-guide-d5856e5721-link">RTP 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="spi-d5856e5805" class="topicref" data-id="spi" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action spi-d5856e5805-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/spi/spi_user_guide_2.html" id="spi-d5856e5805-link"><span class="ph">Q</span>SPI 使用指南</a></div></div></li><li role="treeitem" aria-expanded="true" class="active"><div data-tocid="uart_user_guide-d5856e5879" class="topicref" data-id="uart_user_guide" data-state="expanded"><span role="button" tabindex="0" aria-labelledby="button-collapse-action uart_user_guide-d5856e5879-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_user_guide_2.html" id="uart_user_guide-d5856e5879-link">UART 使用指南</a></div></div><ul role="group" class="navbar-nav nav-list"><li role="treeitem"><div data-tocid="id-d5856e5891" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_config_lite.html" id="id-d5856e5891-link">参数配置</a></div></div></li><li role="treeitem"><div data-tocid="id-d5856e5903" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_debug_lite.html" id="id-d5856e5903-link">调试指南</a></div></div></li><li role="treeitem"><div data-tocid="id-d5856e5915" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_test_lite.html" id="id-d5856e5915-link">测试指南</a></div></div></li><li role="treeitem"><div data-tocid="id-d5856e5927" class="topicref" data-id="id" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_design_lite.html" id="id-d5856e5927-link">设计说明</a></div></div></li><li role="treeitem"><div data-tocid="uart_common_issues-d5856e5939" class="topicref" data-id="uart_common_issues" data-state="leaf"><span role="button" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/uart/uart_faq_2.html" id="uart_common_issues-d5856e5939-link">常见问题</a></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="usb_user_guide-d5856e5951" class="topicref" data-id="usb_user_guide" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action usb_user_guide-d5856e5951-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/usb/usb_user_guide_2.html" id="usb_user_guide-d5856e5951-link">USB 使用指南</a></div></div></li><li role="treeitem" aria-expanded="false"><div data-tocid="id-d5856e6011" class="topicref" data-id="id" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action id-d5856e6011-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/sdk/mac/mac_user_guide_2.html" id="id-d5856e6011-link">MAC 使用指南</a></div></div></li></ul></li><li role="treeitem" aria-expanded="false"><div data-tocid="chapter-safety-d5856e6083" class="topicref" data-id="chapter-safety" data-state="not-ready"><span role="button" tabindex="0" aria-labelledby="button-expand-action chapter-safety-d5856e6083-link" class="wh-expand-btn"></span><div class="title"><a href="../../../topics/chapter-title/chapter-safety-sdk.html" id="chapter-safety-d5856e6083-link">安全</a><div class="wh-tooltip"><p class="shortdesc">SPI ENC、CE、eFuse 等安全模块的介绍和使用说明。</p></div></div></div></li></ul></li></ul></div>
</div>
</nav>
<div class="col-lg-7 col-md-9 col-sm-12" id="wh_topic_body">
<button id="wh_close_publication_toc_button" class="close-toc-button d-none" aria-label="Toggle publishing table of content" aria-controls="wh_publication_toc" aria-expanded="true">
<span class="close-toc-icon-container">
<span class="close-toc-icon"></span>
</span>
</button>
<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">15 Jan 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="d233503e24__20250121171654">通用异步收发传输器Universal Asynchronous Receiver/Transmitter),通常称作 UART是一种通用串行数据总线。</p><p class="- topic/p p" data-ofbid="d233503e26__20250121171654">串行通信是指利用一条传输线将数据一位位地顺序传送,通信线路非常简单。</p><p class="- topic/p p" data-ofbid="d233503e28__20250121171654">UART 为双向通信可以实现全双工传输和接收。在嵌入式设计中UART 用于主机与辅助设备通信,如汽车音响与外接 AP 之间的通信,也用于 PC
机通信包括与监控调试器和其它器件,如 EEPROM 通信。</p><p class="- topic/p p" data-ofbid="d233503e30__20250121171654">在 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="d233503e131__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e133__20250121171654">兼容工业标准 16550 UART</p>
</li><li class="- topic/li li" data-ofbid="d233503e136__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e138__20250121171654">256x8bit 发送与接收 FIFO</p>
</li><li class="- topic/li li" data-ofbid="d233503e141__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e143__20250121171654">传输速度可达 3 Mbps</p>
</li><li class="- topic/li li" data-ofbid="d233503e146__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e148__20250121171654">支持 5-8 数据位以及 1/1 ½/2 停止位</p>
</li><li class="- topic/li li" data-ofbid="d233503e151__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e153__20250121171654">支持奇校验,偶校验或者无奇偶校验</p>
</li><li class="- topic/li li" data-ofbid="d233503e156__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e158__20250121171654">支持 DMA 控制器接口</p>
</li><li class="- topic/li li" data-ofbid="d233503e161__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e163__20250121171654">支持软件/硬件流控</p>
</li><li class="- topic/li li" data-ofbid="d233503e166__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e168__20250121171654">支持 IrDA 1.0 SIR</p>
</li><li class="- topic/li li" data-ofbid="d233503e171__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e173__20250121171654">支持 RS-485/9bit 模式</p>
</li><li class="- topic/li li" data-ofbid="d233503e176__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e178__20250121171654">RS-485 支持硬件使能</p>
</li><li class="- topic/li li" data-ofbid="d233503e181__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e183__20250121171654">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="d233503e192__20250121171654">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="d233503e196__20250121171654">
<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="d233503e200__20250121171654">起始位 Start bit</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e204__20250121171654">先发出一个逻辑“0”的信号表示传输字符的开始</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e208__20250121171654">
<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="d233503e212__20250121171654">数据位 Data bits</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e216__20250121171654">紧接着起始位之后。数据位的个数可以是 4、5、6、7、8 等,构成一个字符。通常采用 ASCII
码。从最低位开始传送,靠时钟定位。</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e220__20250121171654">
<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="d233503e224__20250121171654">奇偶校验位 Parity</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e228__20250121171654">数据位加上这一位后使得“1”的位数应为偶数(偶校验)或奇数(奇校验),以此来校验数据传送的正确性。</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e232__20250121171654">
<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="d233503e236__20250121171654">停止位 Stop bits</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e240__20250121171654">它是一个字符数据的结束标志。可以是 1 位、1.5 位、2 位的高电平。
由于数据是在传输线上定时的,并且每一个设备有其自己的时钟,很可能在通信中两台设备间出现了小小的不同步。因此停止位不仅仅是表示传输的结束,并且提供计算机校正时钟同步的机会。停止位的位数越多,时钟同步的容忍程度越大,但是数据传输率会越慢</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e244__20250121171654">
<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="d233503e248__20250121171654">流控 Flow contorl</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e252__20250121171654">管理两个节点之间数据传输速率的过程,以防止出现接收端的数据缓冲区已满,而发送端依然继续发送数据,所导致数据丢失,我们会在一些上位机上看到
RTS /CTS、DTR /DSR 和 XON /XOFF 的选项,这是对流控制的选项</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e256__20250121171654">
<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="d233503e260__20250121171654">空闲位</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e264__20250121171654">处于逻辑“1”状态表示当前线路上没有数据传送该位为协议位自动产生</p>
</dd></dl>
</li><li class="- topic/li li" data-ofbid="d233503e268__20250121171654">
<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="d233503e272__20250121171654">波特率 BaudRate</dt><dd class="- topic/dd dd">
<p class="- topic/p p" data-ofbid="d233503e276__20250121171654">是衡量数据传送速率的指标。表示每秒钟传送的 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="d233503e282__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e284__20250121171654">串口、COM 口是指的物理接口形式(硬件)。</p>
</li><li class="- topic/li li" data-ofbid="d233503e287__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e289__20250121171654">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="d233503e296__20250121171654">在 UART
进行通信的时候,双方需要协商相关参数,否则无法进行信息解析,因此在通信之初,需要对所使用的工具设置上述的所有参数</p><div class="- topic/p p" data-ofbid="d233503e298__20250121171654"><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="d233503e307__20250121171654">串口、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="d233503e310__20250121171654">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="d233503e313__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e315__20250121171654">TTL 标准是低电平0V为 0高电平+5V为 1。</p>
</li><li class="- topic/li li" data-ofbid="d233503e318__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e320__20250121171654">TTL 接口需要对端接口也为 TTL但诸如 PC 等设备无 TTL 接口的 UART 口,一般转 TTL 为 USB 等 PC
更通用的接口。</p>
</li><li class="- topic/li li" data-ofbid="d233503e323__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e325__20250121171654">TTL 接口为全双工,连接设备的时候一般只接 GND/RX/TX。不会接 Vcc 或者 +3.3v
的电源线,避免与目标设备上的供电冲突,但 GND 可以保证源设备和目标设备供地,有助于信号稳定。</p>
</li><li class="- topic/li li" data-ofbid="d233503e328__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e330__20250121171654">信号线采用交叉的方式,即源端的 RX 连接目标设备的 TX源端的 TX 连接目标设备的 RX。</p>
</li></ul></li><li class="- topic/li li" data-ofbid="d233503e333__20250121171654">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="d233503e336__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e338__20250121171654">RS232 标准是正电平(+3V~+15V为 0负电平-13V~-15V为 1。</p>
</li><li class="- topic/li li" data-ofbid="d233503e341__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e343__20250121171654">RS232 接口在总线上只允许连接 1 个收发器,单站能力。</p>
</li><li class="- topic/li li" data-ofbid="d233503e346__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e348__20250121171654">RS232 传输线采用屏蔽双绞线,最高传输距离一般为 15M最大速率为 20Kbps。</p>
</li><li class="- topic/li li" data-ofbid="d233503e351__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e353__20250121171654">RS232 接口为全双工,连接设备的时候一般只接 GND/RX/TX。</p>
</li><li class="- topic/li li" data-ofbid="d233503e356__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e358__20250121171654">信号线也采用交叉的方式,即源端的 RX 连接目标设备的 TX源端的 TX 连接目标设备的 RX。</p>
</li></ul></li><li class="- topic/li li" data-ofbid="d233503e361__20250121171654">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="d233503e364__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e366__20250121171654">RS422
标准采用差分信号负逻辑逻辑“1”以两线间的电压差为+2—6V 表示。逻辑“0”以两线间的电压差为-2—6V 表示。接口信号电平比
RS232 降低了,就不易损坏接口电路的芯片,且该电平与 TTL 电平兼容,可方便与 TTL 电路连接。</p>
</li><li class="- topic/li li" data-ofbid="d233503e369__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e371__20250121171654">RS422 接口在总线上是允许连接多达 128 个收发器,多站能力。</p>
</li><li class="- topic/li li" data-ofbid="d233503e374__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e376__20250121171654">RS422 的数据最高传输速率为 10Mbps100 米长双绞线的最大速度为 1Mb/s。</p>
</li><li class="- topic/li li" data-ofbid="d233503e379__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e381__20250121171654">RS422 采用平衡发送和差分接收因此具有抑制共模干扰的能力。RS422
接口的最大传输距离标准值为 4000 英尺(约 1219 米),实际上可达 3000 米。</p>
</li><li class="- topic/li li" data-ofbid="d233503e384__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e386__20250121171654">RS422 是全双工,连接设备的时候一般接 RX+/RX-/TX+/TX-/GND。</p>
</li><li class="- topic/li li" data-ofbid="d233503e389__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e391__20250121171654">信号线也采用交叉的方式,即源端的 RX-/RX+ 连接目标设备的 TX-/TX+,源端的 TX-/TX+ 连接目标设备的
RX-/RX+。</p>
</li></ul></li><li class="- topic/li li" data-ofbid="d233503e394__20250121171654">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="d233503e397__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e399__20250121171654">RS485 的电气性能和 RS422 完全一样,主要区别是 RS485 是半双工。连接设备的时候一般接 A-/A+/GNDDB9
接口定义了两组,同时必须使用同一组的+/-。</p>
</li><li class="- topic/li li" data-ofbid="d233503e402__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e404__20250121171654">信号线也采用交叉的方式,即源端的 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="d233503e411__20250121171654">公母之分<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="d233503e414__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e416__20250121171654">针形的为公头,孔形的为母头</p>
</li><li class="- topic/li li" data-ofbid="d233503e419__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e421__20250121171654">PC 串口一般为公头,设备的一般为母头</p>
</li></ul></div><div class="- topic/p p" data-ofbid="d233503e424__20250121171654">
<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="d233503e432__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e434__20250121171654">DCD/RI电气 Ready 参数</p>
</li><li class="- topic/li li" data-ofbid="d233503e437__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e439__20250121171654">DTR/DSR模块 Ready 参数</p>
</li><li class="- topic/li li" data-ofbid="d233503e442__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e444__20250121171654">RTS/CTS流控参数</p>
</li><li class="- topic/li li" data-ofbid="d233503e447__20250121171654">
<p class="- topic/p p" data-ofbid="d233503e449__20250121171654">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="d233503e619__20250121171654">这里讲到的
“流”,指的是数据流。在数据通信中,流控制是管理两个节点之间数据传输速率的过程,以防止出现接收端的数据缓冲区已满,而发送端依然继续发送数据,所导致数据丢失。</p>
<p class="- topic/p p" data-ofbid="d233503e622__20250121171654">当接收端的数据缓冲区已满,无法处理数据来时,就发出 “不再接收” 的信号,发送端则停止发送,直到发送端收到 “可以继续发送” 的信号再发送数据。</p>
<div class="- topic/p p" data-ofbid="d233503e625__20250121171654">计算机中常用的两种流控制分别是硬件流控制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="d233503e628__20250121171654">硬件流控<p class="- topic/p p" data-ofbid="d233503e630__20250121171654">RTS/CTS
属于硬件握手的一种,最初是设计为电传打字机和调制解调器半双工协作通信的,每次它只能一方调制解调器发送数据。终端必须发送请求发送信号然后等到调制解调器回应清除发送信号。</p><div class="- topic/p p" data-ofbid="d233503e632__20250121171654">
<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="d233503e638__20250121171654">软件流控<p class="- topic/p p" data-ofbid="d233503e640__20250121171654">软件流控制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="d233503e684__20250121171654">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="d233503e693__20250121171654">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="d233503e697__20250121171654">Canonical Input<p class="- topic/p p" data-ofbid="d233503e699__20250121171654">RX 端接收到数据之后不会直接反馈给用户态的 read
函数,而是要一直等到一个回车,意即对一些特殊字符进行语意解析</p></li><li class="- topic/li li" data-ofbid="d233503e701__20250121171654">Raw Input<p class="- topic/p p" data-ofbid="d233503e703__20250121171654">RX 端接收到什么直接返回到用户空间的 read 函数里面</p></li></ul>
<p class="- topic/p p" data-ofbid="d233503e706__20250121171654">两种工作模式均为 kernel 层逻辑,和驱动/硬件无关,对于普通的 uart 应用,建议 Canonical 方式,对于 RS485 应用,建议使用 Raw
方式,二者通过 termios 的 lflag 参数的 ICANON 位进行区分。</p>
</section></div></article></main></div>
<div class=" wh_child_links d-print-none "><nav aria-label="Child Links" role="navigation" class="- topic/related-links related-links"><ul class="ullinks"><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/uart/uart_config_lite.html">参数配置</a></strong></li><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/uart/uart_debug_lite.html">调试指南</a></strong></li><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/uart/uart_test_lite.html">测试指南</a></strong></li><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/uart/uart_design_lite.html">设计说明</a></strong></li><li class="- topic/link link ulchildlink"><strong><a href="../../../topics/sdk/uart/uart_faq_2.html">常见问题</a></strong></li></ul></nav></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>