10-03-2023 01:37 AM
Hello,
I'm working on a project where I need to read data from an STM32 (Nucleo-h743zi2 board) using LabVIEW's VISA through USB OTG_FS, configured as a Virtual Comport (VCP). The STM32 is sending data at a high speed of 2MBps to the VCP. However, I'm experiencing data loss in LabVIEW. I'm uncertain about the maximum speed at which I can configure LabVIEW's VISA for reliable data reception. Please suggest any good way to extract data using VISA for my application without data loss.
Thank you for your assistance.
10-03-2023 06:50 AM
With this data rate, you are definitely going to need to use a Producer/Consumer setup. One loop should be dedicated to reading from the port and use a queue to send the data to another loop for processing.
Could you give more details on the messaging protocol the STM32 is using? There might be something we can use there to help the process.
10-03-2023 09:37 AM
On top of what Crossrulz said about using a Producer/Consumer architecture.
Most serial communication issues can be solved by watching this video: VIWeek 2020/Proper way to communicate over serial
10-03-2023 10:15 AM
2 MBit should be fine as long as your physical hardware supports it. VCP devices don't really have a "baud rate" since there isn't ever actually data transmitted via the UART protocol. (USB to Serial devices do have that, but not all VCP's are USB to Serial devices).
I use actual 1 MBit USB to serial devices all the time and it's not an issue. You'll just need to properly architect your system, and do things like make sure your buffers are big enough (VISA Configure Buffer) and that you open the com port once before you use it, then do all your reading, then close it once at the end.
And definitely watch the linked video, it's critical to getting high speed serial right.