uuxz99 发表于 2020-11-9 07:47

【AT-START-F403A测评】之七freeRTOS系统基于IAR弹性DMA定量输出PWM脉冲评测

本帖最后由 uuxz99 于 2020-11-9 07:47 编辑

<p><b><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;"><span style="color:#444444"><span style="letter-spacing:.75pt">【</span></span></span></span></span><span lang="EN-US" style="font-size:14.0pt"><span style="background:white"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;"><span style="color:#444444"><span style="letter-spacing:.75pt">AT-START-F403A</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;"><span style="color:#444444"><span style="letter-spacing:.75pt">测评】</span></span></span></span></span><span style="font-size:14.0pt"><span style="background:white"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;"><span style="color:#333333">之七freeRTOS系统基于IAR弹性DMA定量输出PWM脉冲评测</span></span></span></span></b></p>

<p><span style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">本次测评在之前建立的安全库项目中实现,通过弹性DMA实现定量化PWM脉冲输出,实现了系统控制最后一公里的目标,为后续在slib中实现有关PWM参数生成算法打下基础。此次评测使用定时器TMR1_CH1和TMR4_CH2,作为两路PWM输出端口。输出频率均为1KHz,占空比50%。以下为评测过程。</span></span></p>

<p style="margin-left:28px; text-align:justify"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">1.</span></span></b><b><span style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">串口DMA通道升级</span></span></b></span></span></span></p>

<p align="left" style="text-align:left; text-indent:33.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:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在以前评测中采用了固定DMA通道的方式,为了不再为DMA通道资源分配而烦恼,更改采用DMA的弹性通道机制。</span></span></span></span></span></p>

<p align="left" style="text-align:left; text-indent:33.0pt"><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">2. </span></span></b><b><span style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">定时器配置</span></span></b></span></span></span></p>

<ol>
        <li style="list-style-type:none">&nbsp;</li>
</ol>

<p style="text-align:left"><span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">2.1 GPIO</span></span><span style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">配置</span></span></span></span></p>

<p>2.2&nbsp;<span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">dma</span></span><span style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">配置</span></span></span></span></p>

<p>2.3 tmr配置</p>

<p>2.4&nbsp;<span style="font-size:10.5pt"><span style="font-family:Calibri,sans-serif"><span lang="EN-US" style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">PWM</span></span><span style="font-size:12.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">功能整体实现</span></span></span></span></p>

<p></p>

<p><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">3.</span></span></b><b><span style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">在任务中测试</span></span></b></span></span></span></p>

<p><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:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">改写之前点亮红色led任务作为控制定量脉冲输出任务,两个定时器各自每次定量输出和10个和5个脉冲。</span></span></span></span></span></p>

<p><span style="font-size:10.5pt"><span style="layout-grid-mode:char"><span style="font-family:Calibri,sans-serif"><b><span lang="EN-US" style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">4.</span></span></b><b><span style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">结论</span></span></b></span></span></span></p>

<p><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:&quot;微软雅黑&quot;,&quot;sans-serif&quot;">通过灵活的弹性DMA机制,提高了DMA外围设备的利用率,节省了大量CPU时间,大量精力集中于应用实现。本测评通过调整DMA数据传送方式可实现频率和占空比可变。</span></span></span></span></span><b><span lang="EN-US" style="font-size:14.0pt"><span style="font-family:&quot;微软雅黑&quot;,&quot;sans-serif&quot;"> </span></span></b></p>

<p>&nbsp;</p>

<p align="left" style="text-align:left; text-indent:33.0pt">&nbsp;</p>

w494143467 发表于 2020-11-9 15:48

<p>好久没用IAR了,我也申请了这个板子,先参考一下哈。</p>

易水寒宅客 发表于 2020-11-9 17:21

这个板子居然申请到了,不容易

freebsder 发表于 2020-11-9 23:01

<p>dma输出pwm?呃,学习一下、</p>

uuxz99 发表于 2020-11-11 20:11

freebsder 发表于 2020-11-9 23:01
dma输出pwm?呃,学习一下、

<p>dma传输两个数字,一个字节就是on时间,另一个字节就是off时间,每两个字节确定一个pwm周期。呼吸灯实现就是把所有周期都做成一个表让dma一个接一个送,基本就是这个实现原理</p>

freebsder 发表于 2020-11-11 22:36

uuxz99 发表于 2020-11-11 20:11
dma传输两个数字,一个字节就是on时间,另一个字节就是off时间,每两个字节确定一个pwm周期。呼吸灯实现 ...

<p>没用过dma搞pwm,,,感觉很神奇。</p>
页: [1]
查看完整版本: 【AT-START-F403A测评】之七freeRTOS系统基于IAR弹性DMA定量输出PWM脉冲评测