请教各位,我正在做一个Labview与USB通信的上位机,用于将FPGA输出的数据传输到电脑,每秒传输16个字节。USB芯片采用Cypress的CY7C68013A,传输固件是Bulk传输,利用NI-VISA驱动形成USB与Labview的通信。
当我将程序运行时,上位机在前面几个数据通信周期可以成功接收到数据,但之后数据接收会突然停止,且成功接收数据的次数不一定,有时能有十几个,有时只有一个,请问大家有没有遇到过相同的情况,这是什么原因造成的呢?
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?
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?
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.
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.