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

取消
显示结果 
搜索替代 
您的意思是: 

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

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

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

1.png2.png

0 项奖励
1 条消息(共 8 条)
1,690 次查看

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

 

George Zou
0 项奖励
2 条消息(共 8 条)
1,636 次查看

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,611 次查看

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,568 次查看

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,551 次查看

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,533 次查看

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

0 项奖励
7 条消息(共 8 条)
1,510 次查看

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

谢谢您的提醒。

0 项奖励
8 条消息(共 8 条)
1,499 次查看