This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
大家好、我正在使用 TMS570LS3137 HDK、并需要对 SCI2/Lin 端口使用多缓冲区。
我已经将我的项目与一些简单的测试代码相关联。
如果我 在 scilinREG->GCR1中设置 mbuf_mode、则不会发送字符。
如果我没有设置 mbuf_mode、则传输字符。
scilinREG->GCR1 |=(UINT32)((UINT32) 1U <<10U);// mbuf_mode,这行代码使事情停止工作
在项目中、我添加了该行、
scilinREG->GCR1 |=(UINT32)((UINT32) 1U << 10U);
到 sci.c 中的 sciInit()。
在 sci.c scilinREG->format = 0x00030007;// length = 4中,buffer length 设置为4。
下面是我的测试代码:
sciInit();
///初始化后等待空闲--这是在 sciInit ()后需要的,以使事情工作
while (sciIsIdleDetected (scilinREG));
//观察 CCS 终端上的字符
while (!sciIsTxReady (scilinREG));
scilinREG->TD =(uint32)'a';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(uint32)'b';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(uint32)'c';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(UINT32)'d';
while (!sciIsTxReady (scilinREG));
scilinREG->TD =(uint32)'e';
项目当前设置为传输 CCS 终端、但我也尝试了设置环回位并进行 SCI 读取、但结果是相同的:如果 mbuf_mode=0、则没问题、如果 mbuf_mode=1、则不会传输任何内容 。
我很确定我错过了一些简单的东西、但我在论坛中的搜索并没有显示任何内容。
非常感谢您的帮助、
此致、
您好、Joe!
我使用 DMA 为 SCI 多缓冲创建了一个示例项目。 您可以在下面的链接中找到该内容、
(+)[常见问题解答] RM48L952:如何使用 DMA 在 SCI 多缓冲模式下执行8字节传输-基于 Arm 的微控制器论坛-基于 Arm 的微控制器- TI E2E 支持论坛
这里、我还解释了 SCI 多缓冲模式的一个问题、因此我在这里的请求是首先验证上面的示例、并尝试进行相应的修改。
如果您无法解决您的问题、即使在引用上述线程之后、我也会自行进行必要的调试。
--
谢谢。此致、
Jagadish。
Jagadish、您好!
感谢示例项目。 使用它、我能够弄清楚我做错了什么。
现在似乎显而易见、但是为了写入要在多缓冲模式下发送的数据、必须写入 LIN 发送 缓冲寄存器(LINTD0和 LINTD01)、而不是写入 发送数据缓冲寄存器(SCITD)、例如: linREG->TDx[0]='"A";
我已经复制了下面的工作代码、供其他读者先在非缓冲模式下写入、然后在缓冲模式下写入。
请注意、必须添加#include "reg_lin.h"才能访问 LIN 多缓冲寄存器。
谢谢。
-乔
__________________________________
#include "sci.h"
#include "reg_lin.h"
sciInit();
while (!sciIsTxReady (scilinREG));
scilinREG->TD =(uint32)'a';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(uint32)'b';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(uint32)'c';
while (!sciIsTxReady (scilinREG));
scilinREG->td =(UINT32)'d';
while (!sciIsTxReady (scilinREG));
scilinREG->TD =(uint32)'e';
//启用多缓冲
scilinREG->GCR1 |=(UINT32)((UINT32) 1U <<10U);// mbuf_mode,这行代码使事情停止工作
//设置传输长度
scilinREG->format = 0x00070007;// length=8
//写入多缓冲寄存器
linREG->TDx[0]='A';//直接写入多缓冲器
linREG->TDx[1]="B";//直接写入多缓冲区
linREG->TDx[2]='C';//直接写入多缓冲区
linREG->TDx[3]='D';//直接写入多缓冲区
linREG->TDx[4]='E';//直接写入多缓冲区
linREG->TDx[5]='F';//直接写入多缓冲区
linREG->TDx[6]="G";//直接写入多缓冲区
linREG->TDx[7]='H';//直接写入多缓冲区
__________________________________
输出: