LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

visa serial read buffer occasionally stops receiving bytes

Hello there fellow LabVIEW users!

 

I have been scratching my head on this one so any input would be greatly appreciated. Hopefully i'm overlooking something trivial and someone can point me in the right direction 🙂

 

So i have DUT(s) that i'm communicating with through a usb to to 16 port serial converter (Digi Edgeport/416, TI chip). In order to tell the unit that you want data, you send a "start continuous" hex command. Once that command is received and acknowledged by the DUT, it will return 90 bytes of data at a rate of once a second. It will continue to send data through the port every second until the "stop continuous" hex command is sent and acknowledged.

This issue i am having is that the unit starts communicating fine but then after some time (could be minutes, hours or days), my visa serial read buffer no longer gives me data. However, i know the unit is still sending data through the port because when i split my receive line into two separate COM ports, i can see the bytes show up in my terminal emulator (Tera Term). So it appears that the LabVIEW serial read buffer is getting blocked somehow? No one is touching the computer from the time the "start continuous" is sent so the issue is occurring with the computer just sitting there, collecting data and writing to a csv file. This issue seems to be irrelevant of number of units being tested because it has happened with one unit and with multiple. When testing with multiple units, not all of the units get into this mode, only a few, the others seem fine.

Thinking it might be a driver/converter problem, I tried changing to a different usb to serial converter (serial comm 4232, 4 port, ftdi chip) but that didn't help. I am currently running my program on a Windows 10/LabVIEW 2017 machine (also had this running earlier on Windows 7/LabVIEW 2011 computer with same problem).

 

I also tried running NI I/O trace to see if it would pick up any errors when this happens but didn't see anything there either.

 

I have attached a snippet of my code. The event loop monitor any operator activity (e.g. user click on "start continuous" button). The bottom loop is polling the serial port every 100 ms for any incoming data, the serial logic VI concatenates the incoming bytes until 90 bytes have been received and then parses it.

 

Kind regards,

 

Serge

 

 

Certified LabVIEW Developer

0 Kudos
Message 1 of 5
(2,546 Views)

First of all, do not use the Bytes At Port to determine how many bytes to read.  You can use it to determine if there is data available and then read the 90 bytes.  Or just completely get rid of the Bytes At Port and just read the 90 bytes.  This will greatly simplify that lower loop of yours.

 

Another thing to watch out is, starting with Windows 7, there is a "power saving feature" where Windows will randomly turn off USB hubs.  Go into your Device Manager and make sure all of the USB hubs have that turned off.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 2 of 5
(2,529 Views)

thanks crossrulz!

Those are some good suggestions. You are right, i am using a USB hub and that feature was enabled.  However, my usb to 16 port serial converter (which is used for talking to DUTs) is connected directly to the computer. I would think since data is always being transmitted every second, the port would never have a chance to go to sleep since it's always active? 

I also noticed in the power plan advanced setting, there is a usb selective suspend feature which was enabled. I disabled that as well.

I ran some units overnight with those changes and so far so good. Will update when i have more 🙂

 

Certified LabVIEW Developer

0 Kudos
Message 3 of 5
(2,483 Views)

So still having the same problem. What's interesting is that i ran 6 units and this time and my log indicated that all 6 of them "stopped talking" around the same time in the middle of the night. If i keep the port open and reinitialize each port through labview (VISA configure serial port), the unit(s) start talking again. i'll check my hardware, cabling and test setup for anything suspicious but i find it weird that all of them went out at the same time. Something happened at that time, I just don't know what.

 

Certified LabVIEW Developer

0 Kudos
Message 4 of 5
(2,464 Views)

Got an overrun error:

"VISA:  (Hex 0xBFFF006C) An overrun error occurred during transfer. A character was not read from the hardware before the next character arrived."

 

Will try to speed up my bottom loop to ensure that he read buffer can keep up with the data coming in. But at 1hz acquisition rate, that make a difference? Any other suggestions? Not familiar on how labview handles serial port and read buffers and the logic behind that. Tera term doesn't have this issue.

Certified LabVIEW Developer

0 Kudos
Message 5 of 5
(2,451 Views)