我爱下载 发表于 2020-11-14 10:19

【AutoChips AC7801x电机demo板测评】+开发环境搭建和运行灯测试程序

<p class="MsoTitle" style="text-align:center; margin-top:16px; margin-bottom:4px"><span style="font-size:16pt"><span style="line-height:115%"><span style="font-family:Cambria,serif"><span style="font-weight:bold"><span style="font-family:宋体">开发环境搭建和运行灯测试程序</span></span></span></span></span></p>

<ol>
        <li style="text-align:justify"><span style="font-size:16pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">环境搭建</span></span></span></span></li>
</ol>

<p style="text-indent:21.0pt; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">本次搭建的测试环境基于</span>MDK IDE<span style="font-family:宋体">工具完成。系统集成的核心</span>MCU<span style="font-family:宋体">为</span>AC78013FDLA<span style="font-family:宋体">,官方网站</span><a href="http://www.autochips.com/jk/MCU1/info_225.aspx?pid=530&amp;typeid=225" style="color:blue; text-decoration:underline">http://www.autochips.com/jk/MCU1/info_225.aspx?pid=530&amp;typeid=225</a> <span style="font-family:宋体">,从这里我们可以找到所需的文档,工具和驱动程序。</span></span></span></span></p>

<ol>
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">安装芯片支持</span></span></span></span></span></li>
</ol>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">在官方网站下载</span>AutoChips.AC780x_DFP.1.0.2.rar<span style="font-family:宋体">文件,解压后安装。</span></span></span></span></p>

<p style="margin-left:28px; text-align:justify"></p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">通过</span>Pack Installer<span style="font-family:宋体">可以检查我们是否成功安装了芯片支持包。</span></span></span></span></p>

<ol start="2">
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">安装自动代码生成工具</span></span></span></span></span></li>
</ol>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">从官方网站下载</span>AutoGen Studio<span style="font-family:宋体">的安装文件,安装。安装过程略。</span></span></span></span></p>

<ol start="3">
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">仿真器</span></span></span></span></span></li>
</ol>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">这里准备了</span>JLINK<span style="font-family:宋体">仿真器,备用。</span></span></span></span></p>

<ol start="2">
        <li style="text-align:justify"><span style="font-size:16pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">测试工程</span></span></span></span></li>
</ol>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">为了检验开发环境搭建的情况,从一个闪灯的小程序开始测试。</span></span></span></span></p>

<ol>
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">通过自动代码生成工具创建第一个闪灯程序工程</span></span></span></span></span></li>
</ol>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>1<span style="font-family:宋体">,新建工程</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>2<span style="font-family:宋体">,芯片选择</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family:宋体">根据实际工程需要选择,我们这里选择</span>AC78013FDLA<span style="font-family:宋体">芯片,然后点击&ldquo;新建工程&rdquo;,完成一个基本工程创建。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>3<span style="font-family:宋体">,参数配置</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">按照原理图上的指示,绿色运行指示灯链接到</span>PA6<span style="font-family:宋体">引脚,所以我们将</span>PA6<span style="font-family:宋体">设置为</span>GPIO <span style="font-family:宋体">输出模式。</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>4<span style="font-family:宋体">,外部时钟和</span>swd<span style="font-family:宋体">调试接口配置</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family:宋体">时钟接口</span>PA12<span style="font-family:宋体">、</span>PA15<span style="font-family:宋体">,</span>swd<span style="font-family:宋体">接口</span>PA14<span style="font-family:宋体">,</span>PA13</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>5<span style="font-family:宋体">,时钟配置</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">如图所示,选择外部晶振</span>8MHz<span style="font-family:宋体">,点击</span>pll_ref_sel<span style="font-family:宋体">,并选择使用</span>HSE<span style="font-family:宋体">晶振。使时钟锁相环的最终输出时钟为</span>48MHz<span style="font-family:宋体">。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>6<span style="font-family:宋体">,工程配置</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">如图所示,基本设置为工程名称,工程位置,工具链选择为</span>MDK-ARM V5 <span style="font-family:宋体">。</span></span></span></span></p>

<p style="text-align:justify"></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>7<span style="font-family:宋体">,生成代码</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family:宋体">点击&ldquo;生成代码&rdquo;后,会在指定目录下生成我们需要工程,包含设备驱动程序。</span></span></span></span></p>

<p style="text-align:justify"></p>

<ol start="2">
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">增加功能代码</span></span></span></span></span></li>
</ol>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">为了让小灯闪烁起来,我们需要两个步骤。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>1<span style="font-family:宋体">,延时代码</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family:宋体">采用系统提供的延时函数,首先需要调用</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; InitDelay();</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="font-family:宋体">完成延时初始化。</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">步骤</span>2<span style="font-family:宋体">,小灯闪烁代码</span></span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GPIO_SetPinBit(GREEN_LED_GPIO_Port, GREEN_LED_Pin);</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mdelay(100);</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GPIO_ResetPinBit(GREEN_LED_GPIO_Port, GREEN_LED_Pin);</span></span></span></p>

<p style="text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; mdelay(1900); </span></span></span></p>

<ol start="3">
        <li style="text-align:justify"><span style="font-size:14pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-weight:normal"><span style="font-family:宋体">编译下载</span></span></span></span></span></li>
</ol>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">编译程序,如果不出意外的话,编译顺利通过。</span></span></span></span></p>

<p style="margin-left:28px; text-align:justify"></p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="line-height:115%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">下载到芯片内。</span></span></span></span></p>

<ol start="3">
        <li style="text-align:justify"><span style="font-size:16pt"><span style="line-height:240%"><span style="font-family:Calibri,sans-serif"><span style="font-family:宋体">试验验证</span></span></span></span></li>
</ol>

<p style="text-align:justify"></p>

<p style="text-align:justify">&nbsp;</p>

freebsder 发表于 2020-11-14 23:02

<p>好像stm32cubemx,不错不错,抄也是进步。</p>

我爱下载 发表于 2020-11-15 09:34

freebsder 发表于 2020-11-14 23:02
好像stm32cubemx,不错不错,抄也是进步。

<p>整体比Cubemx简单,但是够用了,如果在灵活一点就更好了。</p>

freebsder 发表于 2020-11-15 22:27

我爱下载 发表于 2020-11-15 09:34
整体比Cubemx简单,但是够用了,如果在灵活一点就更好了。

<p>一步一步来,刚开始能做这样已经不错啦。</p>

我爱下载 发表于 2020-11-16 08:15

freebsder 发表于 2020-11-15 22:27
一步一步来,刚开始能做这样已经不错啦。

<p>确实,至少是软件易用性的一个进步</p>

zxopenljx 发表于 2021-5-21 10:12

<p>谢谢分享</p>
页: [1]
查看完整版本: 【AutoChips AC7801x电机demo板测评】+开发环境搭建和运行灯测试程序