Code Composer 和实时数据交换:目标到主机通信中的问题
亲爱的程序员同胞们!
我真的很感激有关以下问题的一些答案或提示:
主题是数字信号处理 (DSP)、Code Composer Studio 3.1 和实时数据交换 (RTDX),如 本文。我很难理解这个主题,因为我是 DSP 和 C 新手。在我阅读了一些论文并完成了 Code Composer 帮助教程后,我终于取得了一些成功(是的,发生了一些事情!),尽管我在实现一个简单的目标到主机时仍然遇到一些我不明白的错误数据交换。
在目标 (TMS320C6713 DSK) 上运行的代码,必须一个接一个地发送 100 个整数:
RTDX_CreateOutputChannel( ochan );
void main()
{
int data = 0;
int status;
TARGET_INITIALIZE();
RTDX_enableOutput( &ochan );
puts( "Start writing!\n" );
while(data < 100){
data++;
/* send an integer to the host */
status = RTDX_write( &ochan, &data, sizeof(data) );
if ( status == 0 ) {
puts( "ERROR: RTDX_write failed!\n" );
exit( -1 );
}
}
while ( RTDX_writing != NULL ) {
#if RTDX_POLLING_IMPLEMENTATION
RTDX_Poll();
#endif
}
/* disable the output channel */
RTDX_disableOutput( &ochan );
puts( "Program Complete!\n" );
}
在主机上,我运行一个简单的 Java/Jacob 实现作为 OLE 自动化客户端,它将接收到的整数写入控制台。
到目前为止,一切顺利,程序运行正常,但是 ->仅直到大约 86 的整数,然后 RTDX_write 才会失败。
正如我提到的论文中所述,“目标应用程序调用用户库接口中的例程来缓冲数据并将其传递到通信接口。 “那么也许这是一个缓冲区问题?尽管如此,我没有找到任何处理缓冲区的可能性......
或者也许这只是一个菜鸟编程错误,正如我所说的我对 C 没有经验。
所以任何提示都是值得赞赏的。也许有人有使用 RTDX 的经验并且之前遇到过问题,或者也许有人可以告诉我如何找到有关该错误的更多信息。我还发现该主题非常具体,因此如果需要更多信息,我可以提供...
提前非常感谢您!
安迪
dear fellow programmers!
I'd really appreciate a few answers or hints concerning following problem:
The topic is Digital Signal Processing (DSP), Code Composer Studio 3.1 and Real Time Data Exchange (RTDX), as explained in this paper. I've had a hard time understanding the topic, since I'm a DSP and C - Noob. After I read some papers and worked through Code Composer Help-Tutorials, I finally had some success (Yay, SOMETHING happens!), though I'm still running in some errors I don't understand while implementing a simple Target-to-Host Data Exchange.
The Code thats running on the target (TMS320C6713 DSK), obliged to send 100 integers, one after the other:
RTDX_CreateOutputChannel( ochan );
void main()
{
int data = 0;
int status;
TARGET_INITIALIZE();
RTDX_enableOutput( &ochan );
puts( "Start writing!\n" );
while(data < 100){
data++;
/* send an integer to the host */
status = RTDX_write( &ochan, &data, sizeof(data) );
if ( status == 0 ) {
puts( "ERROR: RTDX_write failed!\n" );
exit( -1 );
}
}
while ( RTDX_writing != NULL ) {
#if RTDX_POLLING_IMPLEMENTATION
RTDX_Poll();
#endif
}
/* disable the output channel */
RTDX_disableOutput( &ochan );
puts( "Program Complete!\n" );
}
On the Host I run a simple Java/Jacob Implementation as OLE Automation Client that writes the received integers to the Console.
So far, so good, the program works, BUT -> only till integer about 86, then the RTDX_write fails.
As stated in the paper I referred to, "The target application calls routines in the User Library Interface that buffer the data and pass it to the Communications Interface." So maybe it's a buffer problem? Nonetheless I didn't find any possibilities to handle the buffer...
Or maybe it's just a nooby-programming-mistake, as I said I'm not experienced with C.
So any hints are appreciated. Maybe someone has experience with RTDX and had the problem before or maybe someone can tell me how I can find out more about that error. Also I see that the topic is a quite specific one, so if more information is needed I can give...
Thank you very much in advance!
Andy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为你用数据淹没通道的速度超出了通道的处理能力。请注意,在示例中,他们将写入包装在 while 循环中:
注释说:
。这个想法是,当 RTDX_Data_Write 返回 0 时,意味着客户端正忙,因此您只需重试,直到准备好接受数据。
在真正的嵌入式应用程序中,您的主循环可能不会以无限的速度运行,而是以某个固定的帧速率运行。因此,您可以将数据包设计为通道可以处理的大小。 此 TI 论坛帖子 建议最大数据速率约为 20KB/秒。
I think you are overwhelming the channel with data faster than it can handle. Note that in the example they have wrapped the write in a while loop:
The commentary says:
The idea is that when
RTDX_Data_Write
returns 0 it means the client was busy, so you just try again until it is ready to accept data.In a real embedded application, your main loop probably won't run at an unlimited speed, but at some fixed frame rate. So you can design your data packet with a size that the channel can handle. This TI forum post suggests that the maximum data rate is around 20Kbytes/sec.