NI LabVIEW,CVI,数据采集等产品讨论区

キャンセル
次の結果を表示 
次の代わりに検索 
もしかして: 

Labview与USB通信时数据接收程序会突然停止

请教各位,我正在做一个Labview与USB通信的上位机,用于将FPGA输出的数据传输到电脑,每秒传输16个字节。USB芯片采用Cypress的CY7C68013A,传输固件是Bulk传输,利用NI-VISA驱动形成USB与Labview的通信。

当我将程序运行时,上位机在前面几个数据通信周期可以成功接收到数据,但之后数据接收会突然停止,且成功接收数据的次数不一定,有时能有十几个,有时只有一个,请问大家有没有遇到过相同的情况,这是什么原因造成的呢?

1.png2.png

0 件の賞賛
メッセージ1/8
2,016件の閲覧回数

Put VISA Open/Close outside the loop.  No need to open every iteration.  it slows down the program.

 

George Zou
0 件の賞賛
メッセージ2/8
1,962件の閲覧回数

Thank you for your reply. I changed my program as you said, but he still has the problem of running stopped and even some messy codes. My program is reading out 16-bit data as soon as the FPGA generates it. Is this because of a problem with my USB firmware, or is the driver for labview conflicting with the driver for cypress?3.png

4.png

0 件の賞賛
メッセージ3/8
1,937件の閲覧回数

Check VISA read error output in the loop.

Add a time delay in the loop (not for fix your problem, just a good practice.)

Your loop doesn't stop properly.  How do you know if the other end is still sending data?

 

George Zou
0 件の賞賛
メッセージ4/8
1,894件の閲覧回数

Thanks for your patience and suggestions, I will improve my program.
The other endpoint is sending data from the FPGA, which is continuously sending data.
After my test, I found that when the FPGA side sends 0 data, the labview is able to receive it, but when the FPGA sends non-0 data, its reception stops and garbled. I think the problem may be in the USB bulk transfer firmware.

0 件の賞賛
メッセージ5/8
1,877件の閲覧回数

I found that when I write data from the FPGA to the USB, a section of 0 data is written first and the subsequent transfer error goes away. Not sure why but it works anyway.
Thank you again.

0 件の賞賛
メッセージ6/8
1,859件の閲覧回数

FPGA 与labview的通信改成主从协议会不会好一点?每次由LV发送指令FPGA再回复数据。

0 件の賞賛
メッセージ7/8
1,836件の閲覧回数

您说的应该是指中断传输?这种方法应该时比较靠谱,但我目前没有找到可以用的固件😂我将FPGA中对USB传输数据的程序改了一下,目前程序暂时可以运行。倘若之后仍然出现问题,我再考虑使用中断传输进行通信。

谢谢您的提醒。

0 件の賞賛
メッセージ8/8
1,825件の閲覧回数