<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[MCAL CddUart驱动使用DMA通信的问题分析]]></title><description><![CDATA[<p dir="auto">软件版本：MD2 0.9.1<br />
MC0 2.3.0<br />
1、同步发送缺帧问题</p>
<p dir="auto">使用UART硬件进行串口通信，使用DMA，连续调用同步发送，发现同步发送不完全。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/242/992d9560-bacc-4fa5-bbe6-7d4caf742150.png" alt="4e01cf3b-9346-4ce2-88d1-ad9c74908549-img_v3_0211h_ae0f27eb-07dd-4fe7-bc9e-2065a75d32eg.png" class=" img-fluid img-markdown" /><br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/242/e973ffbe-a696-4630-b3fd-1e4fb7a1a45d.png" alt="5203a91d-2794-4523-a65b-652eb4685e9e-img_v3_0211h_f8463101-d811-4334-a2ef-8ea1202e1e7g.png" class=" img-fluid img-markdown" /><br />
原因：<br />
同步发送内部依然使用DMA进行发送（新版本使用轮询的方式，DMA只作用于异步通信），当DMA将数据搬入FIFO完成时，在软件层面上被认为搬移完成，但其实硬件还未来得及将FIFO中的数据发送到总线上。此时立即再次调用同步发送就会导致发送不完全的问题。<br />
解决方案：<br />
调用完同步发送后稍加延时，让硬件将FIFO数据发送完成后再进行新的发送请求。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/242/c7c952e8-81a4-46ab-8559-53e9b0ad719d.png" alt="c7dc7885-a999-40f1-aa3c-4ec54cf3c25f-img_v3_0211h_f34c1946-6232-41c9-aa2b-b0fab4fe5a0g.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">2、UART IP使用DMA配置IDLE中断<br />
存在BUG，当UART使用DMA进行通信时，IDLE如果触发，没有及时清理标志位，导致一直进入中断。<br />
解决方案：<br />
在触发IDLE中断时结束通信的同时及时清除标志位。<br />
<img src="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/242/2d2ac6cd-8f36-49a3-afea-cf6ba94f65af.png" alt="21c8931b-44e1-4908-b148-921c852a3850-img_v3_0211h_e8f34736-c807-492a-af68-3dd7803c627g.png" class=" img-fluid img-markdown" /></p>
<p dir="auto">附上MCAL MD2 CddUart模块 DMA+IDLE中断参考DEMO<br />
<a href="https://yt-static-main.oss-cn-shanghai.aliyuncs.com/nodebb/242/310de403-439b-4eb0-be2a-244b81db7bff.zip" rel="nofollow ugc">CddUart_Idle_Demo.zip</a></p>
]]></description><link>https://forum.ytmicro.com/topic/1938/mcal-cdduart驱动使用dma通信的问题分析</link><generator>RSS for Node</generator><lastBuildDate>Sat, 09 May 2026 12:32:17 GMT</lastBuildDate><atom:link href="https://forum.ytmicro.com/topic/1938.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 09 May 2026 06:14:17 GMT</pubDate><ttl>60</ttl></channel></rss>