10-07-2022 08:47 PM
请教各位,我正在做一个Labview与USB通信的上位机,用于将FPGA输出的数据传输到电脑,每秒传输16个字节。USB芯片采用Cypress的CY7C68013A,传输固件是Bulk传输,利用NI-VISA驱动形成USB与Labview的通信。
当我将程序运行时,上位机在前面几个数据通信周期可以成功接收到数据,但之后数据接收会突然停止,且成功接收数据的次数不一定,有时能有十几个,有时只有一个,请问大家有没有遇到过相同的情况,这是什么原因造成的呢?
10-08-2022 01:20 PM
Put VISA Open/Close outside the loop. No need to open every iteration. it slows down the program.
10-08-2022 10:24 PM
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?
10-09-2022 10:28 AM
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?
10-09-2022 07:53 PM
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.
10-10-2022 04:26 AM
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.
10-12-2022 01:11 AM
10-12-2022 02:46 AM
您说的应该是指中断传输?这种方法应该时比较靠谱,但我目前没有找到可以用的固件😂我将FPGA中对USB传输数据的程序改了一下,目前程序暂时可以运行。倘若之后仍然出现问题,我再考虑使用中断传输进行通信。
谢谢您的提醒。