add doc v1.1.2

This commit is contained in:
刘可亮
2025-01-23 16:37:00 +08:00
parent ba327e0931
commit b4033d8696
1883 changed files with 417094 additions and 0 deletions

View File

@@ -0,0 +1,197 @@
<!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="驱动配置 在 Luban-Lite 根目录下执行 scons --menuconfig ,进入 menuconfig 的功能配置界面。 选择需要的 XPWM/PWM 通道。以下打开了部分 XPWM/PWM 通道: 3. 在 menuconfig 界面中打开 RT-Thread 的 XPWM/PWM 设备驱动框架。 使用 RT-Thread 内核的时PWM/XPWM 驱动需要依赖 ..."/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-12-05"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>参数配置</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_config.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_config.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="id" 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 topic" 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/xpwm/xpwm_config.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">参数配置</h1><div class="date inPage">5 Dec 2024</div><div style="color: gray;">
Read time: 1 minute(s)
</div><div class="- topic/body body"><section class="- topic/section section" id="id__ref-lite-xpwm-cfg" data-ofbid="id__ref-lite-xpwm-cfg"><h2 class="- topic/title title sectiontitle">驱动配置</h2>
<ol class="- topic/ol ol arabic simple" id="id__ol_dzx_nyh_ddc" data-ofbid="id__ol_dzx_nyh_ddc"><li class="- topic/li li" data-ofbid="d89914e23__20250121171530">
<p class="- topic/p p" data-ofbid="d89914e25__20250121171530"><span class="- topic/ph ph">Luban-Lite</span> 根目录下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">scons --menuconfig</span>,进入 menuconfig
的功能配置界面。</p>
</li><li class="- topic/li li" data-ofbid="d89914e34__20250121171530">
<p class="- topic/p p" data-ofbid="d89914e36__20250121171530">选择需要的 XPWM/PWM 通道。以下打开了部分 XPWM/PWM 通道:</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d89914e40__20250121171530">3. 在 menuconfig 界面中打开 RT-Thread 的 XPWM/PWM 设备驱动框架。 使用 RT-Thread 内核的时PWM/XPWM 驱动需要依赖
RT-Thread 的 PWM 设备驱动框架。</p>
<div class="- topic/note note tip note_tip" id="id__note_dnn_qn3_ddc" data-ofbid="id__note_dnn_qn3_ddc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d89914e45__20250121171530">为了简化使用,步骤 2 的 <span class="+ topic/ph ui-d/uicontrol ph uicontrol">Using XPWMx/PWMx</span> 会自动打开 RT-Thread 的 PWM 设备驱动框架。</p>
</div>
</section><section class="- topic/section section" id="id__pwm" data-ofbid="id__pwm"><h2 class="- topic/title title sectiontitle">PWM 自定义参数</h2>
<p class="- topic/p p" data-ofbid="d89914e57__20250121171530">XPWM 驱动在 drv_xpwm.c 中提供了一个接口 <code class="+ topic/ph pr-d/codeph ph codeph">aic_xpwm_default_action()</code> 来配置 XPWM/PWM
各通道的行为参数。</p>
<p class="- topic/p p" data-ofbid="d89914e63__20250121171530">如果因为板级硬件设计的差异,和实际应用场景不同,可以对这些参数进行调整。参数的定义如下表:</p>
<div class="table-container"><table class="- topic/table table frame-all" id="id__table_ezx_nyh_ddc" data-ofbid="id__table_ezx_nyh_ddc" data-cols="4"><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:19.038817005545287%"/><col style="width:18.484288354898336%"/><col style="width:36.04436229205176%"/><col style="width:26.432532347504615%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_ezx_nyh_ddc__entry__1">参数名称</th><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_ezx_nyh_ddc__entry__2">类型</th><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_ezx_nyh_ddc__entry__3">取值范围</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_ezx_nyh_ddc__entry__4">功能说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ezx_nyh_ddc__entry__1">default-level</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ezx_nyh_ddc__entry__2">正整数</td><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ezx_nyh_ddc__entry__3">[0, 1]</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_ezx_nyh_ddc__entry__4">默认/初始电平</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_ezx_nyh_ddc__entry__1">polarity</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_ezx_nyh_ddc__entry__2">数据结构</td><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_ezx_nyh_ddc__entry__3">NORMAL/INVERSED</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_ezx_nyh_ddc__entry__4">使能模块后,输出信号状态</td></tr></tbody></table></div>
</section><section class="- topic/section section" id="id__id3" data-ofbid="id__id3"><h2 class="- topic/title title sectiontitle">时钟配置</h2>
<p class="- topic/p p" data-ofbid="d89914e108__20250121171530">XPWM 计数器为 32-bit 的计数器,计数器时钟由系统时钟分频得出,分频系数为 CLK_DIV。驱动中默认配置计数器时钟为 24MHz。</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="#id__ref-lite-xpwm-cfg" data-tocid="id__ref-lite-xpwm-cfg">驱动配置</a></div></li><li class="section-item"><div class="section-title"><a href="#id__pwm" data-tocid="id__pwm">PWM 自定义参数</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id3" data-tocid="id__id3">时钟配置</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>

View File

@@ -0,0 +1,161 @@
<!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=""/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-10-23"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>调试指南</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_debug.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_debug.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="id" 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-12" id="wh_topic_body">
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic topic" 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/xpwm/xpwm_debug.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">调试指南</h1><div class="date inPage">23 Oct 2024</div><div style="color: gray;"></div><div class="- topic/body body"></div></article></main></div>
</div>
</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>

View File

@@ -0,0 +1,257 @@
<!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="源码说明 源代码位于 bsp/artinchip/ bsp/artinchip/drv/xpwm/drv_xpwm.cXPWM/PWM Driver 层实现 bsp/artinchip/hal/xpwm/hal_xpwm.cXPWM/PWM HAL 层实现 bsp/artinchip/include/hal/hal_xpwm.hXPWM/PWM HAL 层接口头文件 模块架构 ..."/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-10-30"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>设计说明</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_design.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_design.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="id" 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 topic" 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/xpwm/xpwm_design.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">设计说明</h1><div class="date inPage">30 Oct 2024</div><div style="color: gray;">
Read time: 2 minute(s)
</div><div class="- topic/body body"><section class="- topic/section section" id="id__id2" data-ofbid="id__id2"><h2 class="- topic/title title sectiontitle">源码说明</h2>
<p class="- topic/p p" data-ofbid="d285672e22__20250121171754">源代码位于 <code class="+ topic/ph pr-d/codeph ph codeph">bsp/artinchip/</code></p><ul class="- topic/ul ul simple" data-ofbid="d285672e27__20250121171754"><li class="- topic/li li" data-ofbid="d285672e28__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e30__20250121171754">bsp/artinchip/drv/xpwm/drv_xpwm.cXPWM/PWM Driver 层实现</p>
</li><li class="- topic/li li" data-ofbid="d285672e33__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e35__20250121171754">bsp/artinchip/hal/xpwm/hal_xpwm.cXPWM/PWM HAL 层实现</p>
</li><li class="- topic/li li" data-ofbid="d285672e38__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e40__20250121171754">bsp/artinchip/include/hal/hal_xpwm.hXPWM/PWM HAL 层接口头文件</p>
</li></ul>
</section><section class="- topic/section section" id="id__id3" data-ofbid="id__id3"><h2 class="- topic/title title sectiontitle">模块架构</h2>
<p class="- topic/p p" data-ofbid="d285672e49__20250121171754">XPWM/PWM 驱动 Driver 层采用 RT-Thread 的 PWM 设备驱动框架。HAL 层也可以支持 Baremetal
方式或配合自定义的设备驱动框架进行使用。</p>
<figure class="- topic/fig fig fignone" id="id__id7" data-ofbid="id__id7"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" src="../../../images/xpwm/sw_system13.png" alt="sw_system13"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label"><span class="fig--title-label-number"> 1</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">XPWM/PWM 驱动的软件架构图</span></figcaption></figure>
</section><section class="- topic/section section" id="id__id4" data-ofbid="id__id4"><h2 class="- topic/title title sectiontitle">关键流程设计</h2>
<div class="- topic/div div section" id="id__id5">
<strong class="+ topic/ph hi-d/b ph b">初始化流程</strong>
<p class="- topic/p p" data-ofbid="d285672e69__20250121171754">XPWM/PWM 驱动的初始化接口通过 <code class="+ topic/ph pr-d/codeph ph codeph">INIT_DEVICE_EXPORT(drv_xpwm_init)</code> 完成,主要是通过调用
PWM 子系统的接口 rt_device_pwm_register() 注册一个 PWM 设备。</p><p class="- topic/p p" data-ofbid="d285672e74__20250121171754">XPWM/PWM
控制器的初始化过程,主要步骤有:</p><ol class="- topic/ol ol arabic simple" data-ofbid="d285672e76__20250121171754"><li class="- topic/li li" data-ofbid="d285672e77__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e79__20250121171754">初始化模块的 clk</p>
</li><li class="- topic/li li" data-ofbid="d285672e82__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e84__20250121171754">初始化模块的默认参数</p>
</li><li class="- topic/li li" data-ofbid="d285672e87__20250121171754">
<p class="- topic/p p" data-ofbid="d285672e89__20250121171754">向设备框架中注册 PWM 设备</p>
</li></ol></div></section><section class="- topic/section section" id="id__id6" data-ofbid="id__id6"><h2 class="- topic/title title sectiontitle">数据结构设计</h2>
<div class="- topic/div div section" id="id__struct-aic-xpwm-arg">
<strong class="+ topic/ph hi-d/b ph b">struct aic_xpwm_arg</strong>
<div class="- topic/p p" data-ofbid="d285672e102__20250121171754">属于 HAL 层接口,记录每一个 PWM
通道的配置信息:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_dbw_tj3_fdc" data-ofbid="id__codeblock_dbw_tj3_fdc"><strong class="hl-keyword">struct</strong> aic_xpwm_arg {
u16 available;
u16 id;
u32 tb_clk_rate;
u32 freq;
u32 period;
u32 duty;
s32 def_level;
u32 dma_en;
u32 fifo_en;
u32 fifo_th;
u32 pul_limit_en;
<strong class="hl-keyword">enum</strong> xpwm_polarity polarity;
<strong class="hl-keyword">struct</strong> xpwm_int_s xpwm_int;
<strong class="hl-keyword">struct</strong> aic_xpwm_transfer_info t_info;
};</pre></div></div></section><section class="- topic/section section" id="id__driver" data-ofbid="id__driver"><h2 class="- topic/title title sectiontitle">Driver 层接口设计</h2>
<div class="- topic/p p" data-ofbid="d285672e111__20250121171754">以下接口是 PWM 设备驱动框架需要的标准接口。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_m55_5j3_fdc" data-ofbid="id__codeblock_m55_5j3_fdc"><strong class="hl-keyword">struct</strong> rt_pwm_ops
{
rt_err_t (*control)(<strong class="hl-keyword">struct</strong> rt_device_pwm *device, <strong class="hl-keyword">int</strong> cmd, <strong class="hl-keyword">void</strong> *arg);
};</pre></div><div class="table-container"><table class="- topic/table table frame-all" id="id__table_ejd_vj3_fdc" data-ofbid="id__table_ejd_vj3_fdc" data-cols="2"><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">drv_pwm_control</span></caption><colgroup><col style="width:16.666666666666664%"/><col style="width:83.33333333333334%"/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__table_ejd_vj3_fdc__entry__1">函数原型</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__table_ejd_vj3_fdc__entry__2">static rt_err_t drv_xpwm_control(struct rt_device_pwm *device,
int cmd, void *arg)</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__1">功能说明</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__2">(类似 ioctl 的接口方式)配置一个 XPWM/PWM 通道</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__1">参数定义</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__2">
<div class="- topic/div div">
<div class="- topic/div div">device - 指向 XPWM/PWM 设备的指针</div>
<div class="- topic/div div">cmd - ioctl 命令码</div>
<div class="- topic/div div">arg - 命令参数,指向 struct rt_pwm_configuration 结构的指针</div>
</div>
</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__1">返回值</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__table_ejd_vj3_fdc__entry__2">0成功 &lt; 0失败</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__table_ejd_vj3_fdc__entry__1">注意事项</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__table_ejd_vj3_fdc__entry__2">-</td></tr></tbody></table></div></section><section class="- topic/section section" id="id__hal" data-ofbid="id__hal"><h2 class="- topic/title title sectiontitle">HAL 层接口设计</h2>
<div class="- topic/p p" data-ofbid="d285672e165__20250121171754">HAL 层的函数接口声明存放在 hal_xpwm.h
中,主要接口有:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_xcb_wj3_fdc" data-ofbid="id__codeblock_xcb_wj3_fdc"><strong class="hl-keyword">void</strong> hal_xpwm_ch_init(u32 ch, u32 default_level, <strong class="hl-keyword">enum</strong> xpwm_polarity polarity);
<strong class="hl-keyword">int</strong> hal_xpwm_set(u32 ch, u32 duty_ns, u32 period_ns, u32 pulse_cnt);
<strong class="hl-keyword">int</strong> hal_xpwm_get(u32 ch, u32 *duty_ns, u32 *period_ns);
<strong class="hl-keyword">int</strong> hal_xpwm_enable(u32 ch);
<strong class="hl-keyword">int</strong> hal_xpwm_disable(u32 ch);
u32 hal_xpwm_int_stat(u32 ch);
<strong class="hl-keyword">void</strong> hal_xpwm_int_clr(u32 ch, u32 mask);
<strong class="hl-keyword">int</strong> hal_xpwm_set_fifo(u32 ch, u32 pul_num, u32 pul_prd, u32 pul_cmp);
<strong class="hl-keyword">void</strong> hal_xpwm_cnt_en(u32 ch, u32 val);
<strong class="hl-keyword">int</strong> hal_xpwm_is_enable(u32 ch);
<strong class="hl-keyword">void</strong> hal_xpwm_resume(u32 ch);
<strong class="hl-keyword">void</strong> hal_xpwm_fifo_flush(u32 ch);
<strong class="hl-keyword">void</strong> hal_xpwm_irq_en_set(u32 ch, <strong class="hl-keyword">struct</strong> xpwm_int_s *xpwm_int);
bool hal_ch_is_xpwm(u32 ch);
<strong class="hl-keyword">int</strong> xpwm_cal_prd_duty(u32 ch, u32 duty_ns, u32 period_ns);
#<strong class="hl-keyword">if</strong> defined (AIC_XPWM_FIFO_MODE) &amp;&amp; defined (AIC_DMA_DRV)
<strong class="hl-keyword">void</strong> hal_xpwm_dma_config(u32 ch, dma_async_callback callback, <strong class="hl-keyword">void</strong> *callback_param);
#endif</pre></div><div class="- topic/note note tip note_tip" id="id__note_h4n_qn3_ddc" data-ofbid="id__note_h4n_qn3_ddc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d285672e171__20250121171754">硬件上 PWM 与 XPWM 为同一模块共 24 路。 驱动中的 PWM 是使用 XPWM 的 PWM 功能来实现,软件上划分 0-7 路为 XPWM 8-23
路为 PWM。</p>
</div>
</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="#id__id2" data-tocid="id__id2">源码说明</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id3" data-tocid="id__id3">模块架构</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id4" data-tocid="id__id4">关键流程设计</a></div></li><li class="section-item"><div class="section-title"><a href="#id__id6" data-tocid="id__id6">数据结构设计</a></div></li><li class="section-item"><div class="section-title"><a href="#id__driver" data-tocid="id__driver">Driver 层接口设计</a></div></li><li class="section-item"><div class="section-title"><a href="#id__hal" data-tocid="id__hal">HAL 层接口设计</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>

View File

@@ -0,0 +1,161 @@
<!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=""/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-10-30"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>常见问题</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_faq.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_faq.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="id" 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-12" id="wh_topic_body">
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic topic" 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/xpwm/xpwm_faq.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">常见问题</h1><div class="date inPage">30 Oct 2024</div><div style="color: gray;"></div><div class="- topic/body body"></div></article></main></div>
</div>
</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>

View File

@@ -0,0 +1,352 @@
<!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="测试环境 硬件 FPGA 验证版 示波器,用于观察输出 XPWM/PWM 信号的波形 软件 PC 端的串口终端软件,用于 PC 和开发板进行串口通信 RT-Thread 系统自带的 pwm 命令行工具 软件配置 当打开 RT-Thread 系统的 PWM 设备驱动框架,就会在启动时注册生成 pwm 命令。 测试 XPWM/PWM pwm 命令帮助信息如下: spss /&gt; pwm Usage: ..."/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-12-04"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>测试指南</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_test.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_test.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="id" 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 topic" 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/xpwm/xpwm_test.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">测试指南</h1><div class="date inPage">4 Dec 2024</div><div style="color: gray;">
Read time: 7 minute(s)
</div><div class="- topic/body body"><section class="- topic/section section" id="id__id2" data-ofbid="id__id2"><h2 class="- topic/title title sectiontitle">测试环境</h2>
<ul class="- topic/ul ul" id="id__ul_mdt_jj3_fdc" data-ofbid="id__ul_mdt_jj3_fdc"><li class="- topic/li li" data-ofbid="d155459e23__20250121171615"><strong class="+ topic/ph hi-d/b ph b">硬件</strong><ul class="- topic/ul ul simple" id="id__ul_kvn_pyh_ddc" data-ofbid="id__ul_kvn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e27__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e29__20250121171615">FPGA 验证版</p>
</li><li class="- topic/li li" data-ofbid="d155459e32__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e34__20250121171615">示波器,用于观察输出 XPWM/PWM 信号的波形</p>
</li></ul></li><li class="- topic/li li" data-ofbid="d155459e37__20250121171615"><strong class="+ topic/ph hi-d/b ph b">软件</strong><ul class="- topic/ul ul simple" id="id__ul_lvn_pyh_ddc" data-ofbid="id__ul_lvn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e41__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e43__20250121171615">PC 端的串口终端软件,用于 PC 和开发板进行串口通信</p>
</li><li class="- topic/li li" data-ofbid="d155459e46__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e48__20250121171615">RT-Thread 系统自带的 <code class="+ topic/ph pr-d/codeph ph codeph">pwm</code> 命令行工具</p>
</li></ul></li><li class="- topic/li li" data-ofbid="d155459e54__20250121171615"><strong class="+ topic/ph hi-d/b ph b">软件配置</strong><p class="- topic/p p" data-ofbid="d155459e57__20250121171615">当打开 RT-Thread 系统的 PWM 设备驱动框架,就会在启动时注册生成 <code class="+ topic/ph pr-d/codeph ph codeph">pwm</code>
命令。</p></li></ul></section><section class="- topic/section section" id="id__xpwm-pwm" data-ofbid="id__xpwm-pwm"><h2 class="- topic/title title sectiontitle">测试 XPWM/PWM</h2>
<p class="- topic/p p" data-ofbid="d155459e67__20250121171615"><span class="+ topic/keyword sw-d/cmdname keyword cmdname">pwm</span> 命令帮助信息如下:</p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_mvn_pyh_ddc" data-ofbid="id__codeblock_mvn_pyh_ddc">spss /&gt; pwm
Usage:
pwm probe &lt;device name&gt; - probe pwm by name
pwm enable &lt;channel&gt; - enable pwm channel
pwm disable &lt;channel&gt; - disable pwm channel
pwm get &lt;channel&gt; - get pwm channel info
pwm set &lt;channel&gt; &lt;period&gt; &lt;pulse&gt; &lt;pulse cnt&gt; - set pwm channel info
pwm set_fifo_num &lt;channel&gt; &lt;fifo_num&gt; - set xpwm fifo count
pwm set_fifo &lt;channel&gt; &lt;fifo_index&gt; &lt;period&gt; &lt;pulse&gt; &lt;pulse cnt&gt; - set xpwm fifo info
pwm get_fifo &lt;channel&gt; - get xpwm fifo info
pwm dma_test &lt;channel&gt; &lt;loop_times&gt; - xpwm dma test</pre>
<p class="- topic/p p" data-ofbid="d155459e75__20250121171615">测试前应先注册设备:</p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_nvn_pyh_ddc" data-ofbid="id__codeblock_nvn_pyh_ddc">aic&gt; pwm probe xpwm
probe xpwm success
</pre>
<p class="- topic/p p" data-ofbid="d155459e82__20250121171615">
<strong class="+ topic/ph hi-d/b ph b">- 使用举例 1 XPWM 自由方式演示。</strong>
</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_ovn_pyh_ddc" data-ofbid="id__ol_ovn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e89__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e91__20250121171615"><span class="- topic/ph ph">Luban-Lite</span> 根目录下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">scons --menuconfig</span>,进入 menuconfig
的功能配置界面,将 XPWM
配置为普通模式:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_pvn_pyh_ddc" data-ofbid="id__codeblock_pvn_pyh_ddc">Board options ---&gt;
Select ALL XPWM MODE (normal mode) ---&gt;
</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e102__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e104__20250121171615">配置输出频率为 1KHz占空比为 80% 的 7
个脉冲。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_rvn_pyh_ddc" data-ofbid="id__codeblock_rvn_pyh_ddc">aic&gt; pwm set010000008000007
pwm info set on xpwm at channel <span class="hl-number">0</span></pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e109__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e111__20250121171615">观察示波器,可以见到输出了 7 个脉冲。</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d155459e115__20250121171615">
<strong class="+ topic/ph hi-d/b ph b">- 使用举例 2 XPWM 持续输出功能演示。</strong>
</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_tvn_pyh_ddc" data-ofbid="id__ol_tvn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e122__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e124__20250121171615"><span class="- topic/ph ph">Luban-Lite</span> 根目录下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">scons --menuconfig</span>,进入 menuconfig
的功能配置界面,将 XPWM
配置为连续模式:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_uvn_pyh_ddc" data-ofbid="id__codeblock_uvn_pyh_ddc">Board options ---&gt;
Select ALL XPWM MODE (continuous mode) ---&gt;
</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e135__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e137__20250121171615">配置输出中断频率为 1KHz占空比为
30%,任意个数脉冲。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_wvn_pyh_ddc" data-ofbid="id__codeblock_wvn_pyh_ddc">aic&gt; pwm set010000003000007
pwm info set on xpwm at channel <span class="hl-number">0</span></pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e142__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e144__20250121171615">观察示波器,可以见到连续输出的 PWM。</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d155459e148__20250121171615">
<strong class="+ topic/ph hi-d/b ph b">- 使用举例 3 XPWM 中断配置 FIFO 方式演示。</strong>
</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_yvn_pyh_ddc" data-ofbid="id__ol_yvn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e155__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e157__20250121171615"><span class="- topic/ph ph">Luban-Lite</span> 根目录下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">scons --menuconfig</span>,进入 menuconfig
的功能配置界面,将 XPWM 配置为使用 FIFO 模式,同时关闭 DMA
支持:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_zvn_pyh_ddc" data-ofbid="id__codeblock_zvn_pyh_ddc">Board options ---&gt;
Select ALL XPWM MODE (fifo mode) ---&gt;
......
[ ] Using DMA
</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e168__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e170__20250121171615">XPWM 最大支持 8 组 FIFO其中每组深度为 3*32bits。 此处演示 XPWM 通道 0 设置 5 组 FIFO通道 1 设置 1 组
FIFO通道 2 设置 1 组 FIFO通道 3 设置 2 组
FIFO。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_bwn_pyh_ddc" data-ofbid="id__codeblock_bwn_pyh_ddc">aic&gt; pwm set_fifo <span class="hl-number">0010000001000001</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo <span class="hl-number">015000002000002</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo <span class="hl-number">025000003000003</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo <span class="hl-number">032000001000001</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo <span class="hl-number">043000002000002</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo_num <span class="hl-number">05</span>
pwm set fifo num on xpwm at channel <span class="hl-number">0</span>
aic&gt; pwm set_fifo <span class="hl-number">1010000005000001</span>
pwm set fifo on xpwm at channel <span class="hl-number">1</span>
aic&gt; pwm set_fifo_num <span class="hl-number">11</span>
pwm set fifo num on xpwm at channel <span class="hl-number">1</span>
aic&gt; pwm set_fifo <span class="hl-number">2010000003000001</span>
pwm set fifo on xpwm at channel <span class="hl-number">2</span>
aic&gt; pwm set_fifo_num <span class="hl-number">21</span>
pwm set fifo num on xpwm at channel <span class="hl-number">2</span>
aic&gt; pwm set_fifo <span class="hl-number">3010000001000002</span>
pwm set fifo on xpwm at channel <span class="hl-number">3</span>
aic&gt; pwm set_fifo <span class="hl-number">3110000002000003</span>
pwm set fifo on xpwm at channel <span class="hl-number">3</span>
aic&gt; pwm set_fifo_num <span class="hl-number">32</span>
pwm set fifo num on xpwm at channel <span class="hl-number">3</span></pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e175__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e177__20250121171615">使能通道 0/1/2/3。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_dwn_pyh_ddc" data-ofbid="id__codeblock_dwn_pyh_ddc">aic&gt;pwm enable0
aic&gt;pwm enable1
aic&gt;pwm enable2
aic&gt;pwm enable3</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e182__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e184__20250121171615">可以获取当前 XPWM 通道的 FIFO
信息。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_fwn_pyh_ddc" data-ofbid="id__codeblock_fwn_pyh_ddc">aic&gt; pwm get_fifo <span class="hl-number">0</span>[<span class="hl-number">179795</span>] I/XPWM: ch0 fifo valid count: <span class="hl-number">5</span>[<span class="hl-number">179800</span>] I/XPWM: fifo_idx <span class="hl-number">0</span>: prd:<span class="hl-number">1000000</span> pulse:<span class="hl-number">100000</span> pulse cnt:<span class="hl-number">1</span>
[<span class="hl-number">179808</span>] I/XPWM: fifo_idx <span class="hl-number">1</span>: prd:<span class="hl-number">500000</span> pulse:<span class="hl-number">200000</span> pulse cnt:<span class="hl-number">2</span>
[<span class="hl-number">179815</span>] I/XPWM: fifo_idx <span class="hl-number">2</span>: prd:<span class="hl-number">500000</span> pulse:<span class="hl-number">300000</span> pulse cnt:<span class="hl-number">3</span>
[<span class="hl-number">179823</span>] I/XPWM: fifo_idx <span class="hl-number">3</span>: prd:<span class="hl-number">200000</span> pulse:<span class="hl-number">100000</span> pulse cnt:<span class="hl-number">1</span>
[<span class="hl-number">179830</span>] I/XPWM: fifo_idx <span class="hl-number">4</span>: prd:<span class="hl-number">300000</span> pulse:<span class="hl-number">200000</span> pulse cnt:<span class="hl-number">2</span>
</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e189__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e191__20250121171615">观察示波器,可以看到 XPWM 在不断输出 FIFO 中的脉冲组合。</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d155459e196__20250121171615">
<strong class="+ topic/ph hi-d/b ph b">- 使用举例 4 XPWM DMA 配置 FIFO 方式演示。</strong>
</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_hwn_pyh_ddc" data-ofbid="id__ol_hwn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e203__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e205__20250121171615"><span class="- topic/ph ph">Luban-Lite</span> 根目录下执行 <span class="+ topic/keyword sw-d/cmdname keyword cmdname">scons --menuconfig</span>,进入 menuconfig
的功能配置界面,将 XPWM 配置为使用 FIFO 模式,同时打开 DMA
支持:<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_iwn_pyh_ddc" data-ofbid="id__codeblock_iwn_pyh_ddc">Board options ---&gt;
Select ALL XPWM MODE (fifo mode) ---&gt;
......
[*] Using DMA
</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e216__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e218__20250121171615">先使能通道 0/1/2/3。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_kwn_pyh_ddc" data-ofbid="id__codeblock_kwn_pyh_ddc">aic&gt;pwm enable0
aic&gt;pwm enable1
aic&gt;pwm enable2
aic&gt;pwm enable3</pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e223__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e225__20250121171615">手动设置 FIFO。 FIFO INDEX 参数将会被忽略,此处只能设置一个 FIFO
进行测试。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_mwn_pyh_ddc" data-ofbid="id__codeblock_mwn_pyh_ddc">aic &gt; pwm set_fifo <span class="hl-number">0010000003000005</span>
pwm set fifo on xpwm at channel <span class="hl-number">0</span>
aic &gt; pwm set_fifo <span class="hl-number">106000005000003</span>
pwm set fifo on xpwm at channel <span class="hl-number">1</span>
aic &gt; pwm set_fifo <span class="hl-number">208000005000007</span>
pwm set fifo on xpwm at channel <span class="hl-number">2</span>
aic &gt; pwm set_fifo <span class="hl-number">3020003807</span>
pwm set fifo on xpwm at channel <span class="hl-number">3</span></pre></div>
</li><li class="- topic/li li" data-ofbid="d155459e230__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e232__20250121171615">观察示波器。</p>
</li><li class="- topic/li li" data-ofbid="d155459e235__20250121171615">
<div class="- topic/p p" data-ofbid="d155459e237__20250121171615">进行 DMA 循环测试,循环输出代码中的组合 N 次,此处演示 3
次。<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_own_pyh_ddc" data-ofbid="id__codeblock_own_pyh_ddc">aic &gt; pwm dma_test <span class="hl-number">03</span>
xpwm ch0 will loop <span class="hl-number">3</span>times</pre></div>
<div class="- topic/note note tip note_tip" id="id__note_xnn_qn3_ddc" data-ofbid="id__note_xnn_qn3_ddc"><span class="note__title">提示:</span>
<ol class="- topic/ol ol arabic simple" type="a" id="id__ol_pwn_pyh_ddc" data-ofbid="id__ol_pwn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e245__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e247__20250121171615"><code class="+ topic/ph pr-d/codeph ph codeph">dma_test</code> 中,会将 BUFF 中的数据循环输出,此处作演示,仅使用了一个 BUFF
空间,没有区分通道,故每个通道不能同时调用 <code class="+ topic/ph pr-d/codeph ph codeph">dma_test</code></p>
</li><li class="- topic/li li" data-ofbid="d155459e255__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e257__20250121171615"><code class="+ topic/ph pr-d/codeph ph codeph">dma_test</code> 中输出的测试组合,在源码 rt_drv_pwm.c 中。</p>
</li><li class="- topic/li li" data-ofbid="d155459e262__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e264__20250121171615">由于单组 FIFO 数据大小为 3*32bits,不符合清 CACHE
数据大小对齐,会出现相关警告为正常现象,不影响使用。</p>
<p class="- topic/p p" data-ofbid="d155459e267__20250121171615">测试组合如下:</p>
</li></ol>
</div>
</li><li class="- topic/li li" data-ofbid="d155459e272__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e274__20250121171615">观察示波器。</p>
</li></ol>
<p class="- topic/p p" data-ofbid="d155459e278__20250121171615">
<strong class="+ topic/ph hi-d/b ph b">- 使用举例 5 XPWM 中断配置 FIFO 方式演示。</strong>
</p>
<ol class="- topic/ol ol arabic simple" id="id__ol_rwn_pyh_ddc" data-ofbid="id__ol_rwn_pyh_ddc"><li class="- topic/li li" data-ofbid="d155459e285__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e287__20250121171615">PWM 功能下 <code class="+ topic/ph pr-d/codeph ph codeph">pulse_cnt</code> 参数将被忽略,配置输出频率为 1KHz占空比为 80%。</p>
<pre class="+ topic/pre pr-d/codeblock pre codeblock language-c" id="id__codeblock_swn_pyh_ddc" data-ofbid="id__codeblock_swn_pyh_ddc">aic&gt; pwm set810000008000000
pwm info set on xpwm at channel <span class="hl-number">8</span></pre>
</li><li class="- topic/li li" data-ofbid="d155459e296__20250121171615">
<p class="- topic/p p" data-ofbid="d155459e298__20250121171615">观察示波器,可以见到相应的 PWM 波。</p>
<div class="- topic/note note tip note_tip" id="id__note_ynn_qn3_ddc" data-ofbid="id__note_ynn_qn3_ddc"><span class="note__title">提示:</span>
<p class="- topic/p p" data-ofbid="d155459e303__20250121171615">XPWM 通道为 0-7PWM 通道为 8-23。</p>
</div>
</li></ol>
</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="#id__id2" data-tocid="id__id2">测试环境</a></div></li><li class="section-item"><div class="section-title"><a href="#id__xpwm-pwm" data-tocid="id__xpwm-pwm">测试 XPWM/PWM</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>

View File

@@ -0,0 +1,184 @@
<!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="表 1 . 术语定义 术语/缩略语 定义及说明 XPWM Extend Pulse-Width Modulation拓展脉冲宽度控制简称脉宽调制 占空比 PWM 信号中,高电平保持的时间 与 该 PWM 时钟周期的时间之比 FIFO First In First Out, 先进先出数据存储、缓冲器 DMA Direct Memory Access,直接内存访问 XPWM 功能简介 PWM ..."/><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="topic"/><meta name="DC.contributor" content="yan.wang"/><meta name="DC.date.modified" content="2024-11-29"/><meta name="DC.format" content="HTML5"/><meta name="DC.identifier" content="id"/><meta name="DC.language" content="zh-CN"/><title>XPWM 使用指南</title><!-- Build number 2023110923. --><meta name="wh-path2root" content="../../../"/><meta name="wh-toc-id" content=""/><meta name="wh-source-relpath" content="topics/sdk/xpwm/xpwm_user_guide.dita"/><meta name="wh-out-relpath" content="topics/sdk/xpwm/xpwm_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="id" 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-12" id="wh_topic_body">
<div class=" wh_topic_content body "><main role="main"><article class="- topic/topic topic" 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/xpwm/xpwm_user_guide.dita">Edit online</a></span><h1 class="- topic/title title topictitle1" id="ariaid-title1">XPWM 使用指南</h1><div class="date inPage">29 Nov 2024</div><div style="color: gray;">
Read time: 1 minute(s)
</div><div class="- topic/body body"><div class="table-container"><table class="- topic/table table frame-all" data-ofbid="d301612e17__20250121171807" data-cols="2"><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/><col/></colgroup><thead class="- topic/thead thead"><tr class="- topic/row"><th class="- topic/entry entry colsep-1 rowsep-1" id="id__entry__1">术语/缩略语</th><th class="- topic/entry entry colsep-0 rowsep-1" id="id__entry__2">定义及说明</th></tr></thead><tbody class="- topic/tbody tbody"><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__entry__1">XPWM</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__entry__2">Extend Pulse-Width
Modulation拓展脉冲宽度控制简称脉宽调制</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__entry__1">占空比</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__entry__2">PWM 信号中,高电平保持的时间 与 该 PWM 时钟周期的时间之比</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-1" headers="id__entry__1">FIFO</td><td class="- topic/entry entry colsep-0 rowsep-1" headers="id__entry__2">First In First Out, 先进先出数据存储、缓冲器</td></tr><tr class="- topic/row"><td class="- topic/entry entry colsep-1 rowsep-0" headers="id__entry__1">DMA</td><td class="- topic/entry entry colsep-0 rowsep-0" headers="id__entry__2">Direct Memory Access,直接内存访问</td></tr></tbody></table></div><section class="- topic/section section" id="id__section_wzb_cj3_fdc" data-ofbid="id__section_wzb_cj3_fdc"><h2 class="- topic/title title sectiontitle">XPWM 功能简介</h2>
<div class="- topic/div div section" id="id__pwm">
<strong class="+ topic/ph hi-d/b ph b">PWM 输出模式</strong>
<p class="- topic/p p" data-ofbid="d301612e60__20250121171807"> PWM 信号通常由一列占空比不同的矩形脉冲构成,其占空比可以调节。用数字输出来控制 PWM 占空比占空比提高意味着高电平脉宽增大输出的能量就会增加PWM
就相当于一个 <strong class="+ topic/ph hi-d/b ph b">功率版的 DA 转换模块</strong>。下图是一个典型的 PWM 信号波形:</p><figure class="- topic/fig fig fignone" id="id__id4" data-ofbid="id__id4"><br/><div class="imagecenter"><img class="- topic/image image imagecenter" src="../../../images/xpwm/pwm_wave.png" alt="pwm_wave"/></div><br/><figcaption data-caption-side="bottom" class="- topic/title title figcapcenter"><span class="figtitleprefix fig--title-label"><span class="fig--title-label-number"> 1</span><span class="fig--title-label-punctuation">. </span></span><span class="fig--title">图 6.106 典型的 PWM 信号波形</span></figcaption></figure>
<p class="- topic/p p" data-ofbid="d301612e72__20250121171807">占空比的计算方法: <code class="+ topic/ph pr-d/codeph ph codeph">占空比=(脉宽时间/周期)*100%</code></p><p class="- topic/p p" data-ofbid="d301612e76__20250121171807">结合上图,我们可以说: 脉宽时间 1 相比 脉宽时间 2
提供较小的占空比。</p>
</div>
<div class="- topic/div div section" id="id__id3">
<strong class="+ topic/ph hi-d/b ph b">脉冲输出模式</strong>
<p class="- topic/p p" data-ofbid="d301612e85__20250121171807">脉冲输出模式支持三种方式实现脉冲输出的功能,分别是自由方式(未采用中断和 DMA、持续方式采用中断、FIFO采用中断或 DMA方式。</p><ol class="- topic/ol ol arabic simple" data-ofbid="d301612e87__20250121171807"><li class="- topic/li li" data-ofbid="d301612e88__20250121171807">
<p class="- topic/p p" data-ofbid="d301612e90__20250121171807"> 自由方式输出脉冲每设置一次发送脉冲数量的数值XPWM 输出则发送相应数量的脉冲后则处于一直 IDLE 的状态IDLE
状态可以设置为输出高电平或低电平)。</p>
</li><li class="- topic/li li" data-ofbid="d301612e93__20250121171807">
<p class="- topic/p p" data-ofbid="d301612e95__20250121171807"> 持续方式输出脉冲即通过中断每次中断函数进行设置下次发送脉冲数量的数值XPWM 输出则一直按照设置的数值持续发送脉冲。</p>
</li><li class="- topic/li li" data-ofbid="d301612e98__20250121171807">
<p class="- topic/p p" data-ofbid="d301612e100__20250121171807">FIFO 方式输出脉冲,是利用内置的 FIFO
对影子寄存器的更新方式,实现持续发送脉冲。这样相对上面提到的持续方式,可以大大提高脉冲输出的效率,避免频繁进入中断函数。</p>
</li></ol></div>
</section></div></article></main></div>
</div>
</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>