【AT-START-F403A测评】之二freeRTOS系统IAR环境时钟配置及串口DMA实现完全pri...
本帖最后由 uuxz99 于 2020-10-3 21:08 编辑<p align="center" style="text-align:center"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:"微软雅黑","sans-serif""><span style="color:#444444"><span style="letter-spacing:.75pt">【</span></span></span></span></span></b><b><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:"微软雅黑","sans-serif""><span style="color:#444444"><span style="letter-spacing:.75pt">AT-START-F403A</span></span></span></span></span></b><b><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:"微软雅黑","sans-serif""><span style="color:#444444"><span style="letter-spacing:.75pt">测评】</span></span></span></span></span></b><b><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:"微软雅黑","sans-serif""><span style="color:#333333">之二freeRTOS系统基于IAR环境时钟配置及串口DMA实现完全printf功能</span></span></span></span></b></span></span></span></p>
<p align="left" style="text-align:left; text-indent:24.0pt"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">通过上一次测评,仅实现了简单任务切换,任务中断机制尚未实现。本次评估实现了任务中断切换等功能。通过使用DMA及其中断机制实现完整printf功能,为了获得优良的DMA性能,先看一下时钟系统的配置。</span></span></span></span></span></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">时钟配置:</span></span></b></span></span></span></p>
<ol>
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">项目中Startup目录下system_at32f4xx.c可以实现系统时钟的配置,当然,也可以在运行时调整。评测按照最高时钟设置。</span></span></span></span></span></li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:-6.95pt"></p>
<ol start="2">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">为了便于观察配置结果,设置一个RCC_ClockType 类型全局变量systemClock,在main启动中,可以通过RCC_GetClocksFreq(&systemClock)获得系统时钟的配置情况。</span></span></span></span></span></li>
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">启动调试断点停下后,在watch中观察变量systemClock</span></span></span></span></span></li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<ol start="4">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">确认时钟配置</span></span></span></span></span></li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:24.0pt"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">在datasheet的RCC的CFG寄存器描述时钟输出如下,寄存器与描述实际是一致,目前配置为外部8MHz时钟为PLL时钟源,PLL时钟作为系统时钟输出240MHz。需要注意的是,如果不修改上述配置,默认是系统时钟及APB等均为8MHz。</span></span></span></span></span></p>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"> </p>
<p align="left" style="text-align:left"></p>
<p align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">完全printf功能实现: </span></span></b></span></span></span></p>
<ol>
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">通过uart以DMA方式发送打印字符实现测评,基于上一篇评测(《at-start-f403a测评之一--freeRTOS系统搭建》)的三个任务,增加串口DMA打印功能,评测中命名为console功能。</span></span></span></span></span></li>
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">实现串口DMA打印,驱动分别对gpio,串口和DMA设备的初始化。</span></span></span></span></span>
<ol>
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">串口gpio设备初始化</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<ol>
<li style="list-style-type:none">
<ol start="2">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">串口设备初始化</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="text-align:left"></p>
<p align="left" style="text-align:left"> </p>
<p align="left" style="text-align:left"></p>
<ol>
<li style="list-style-type:none">
<ol start="3">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">dma</span></span><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">设备初始化</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="margin-left:28px; text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"> <span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">允许RCC及DMA中断配置。</span></span></span></span></span></p>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<ol>
<li style="list-style-type:none">
<ol start="4">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">console</span></span><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">功能初始化</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<ol>
<li style="list-style-type:none">
<ol start="5">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">DMA</span></span><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">发送</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<ol>
<li style="list-style-type:none">
<ol start="6">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">console</span></span><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">功能实现</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">在原有三个点灯任务中加入console功能实现</span></span></span></span></p>
<p style="margin-left:28px; text-indent:0cm; text-align:justify"></p>
<ol>
<li style="list-style-type:none">
<ol start="7">
<li align="left" style="text-align:left"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><span style="font-size:12.0pt"><span style="font-family:"微软雅黑","sans-serif"">功能结果示例</span></span></span></span></span></li>
</ol>
</li>
</ol>
<p align="left" style="margin-left:56px; text-align:left; text-indent:0cm"></p>
<p align="left" style="margin-left:28px; text-align:left; text-indent:0cm"></p>
<p>雅特力AT-START-F403A测评汇总</p>
<p><a href="https://bbs.eeworld.com.cn/thread-1143018-1-1.html" target="_blank">https://bbs.eeworld.com.cn/thread-1143018-1-1.html</a></p>
页:
[1]