LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial problem with LabWindows/CVI 8.0.1

The race condition I mentioned in the previous post exists when a port is opened with a non-negative output queue length, and the code flushes the output queue while there is still data being written.  This issue has been isolated and fixed for the next release.  If and when other reproducible issues are reported, we will address them.  Unfortunately, our testing can not always catch issues that may arrise under certain setups or with certain pieces of hardware.  Most users probably will not see a difference between the 8.0.x RS-232 library and the 8.1.x version, but some may, and in those cases we will do what we can to resolve the particular issue.

Mert A.
National Instruments
Message 11 of 33
(4,164 Views)
Does the race condition occur only as a result of calling FlushOutQ() at the application level?






0 Kudos
Message 12 of 33
(4,161 Views)
Yes -- not as a result of an internal call.

Mert A.
National Instruments
Message 13 of 33
(4,158 Views)
Thanks Mert.


0 Kudos
Message 14 of 33
(4,164 Views)
We are doing a FlushOutQ call on some of our serial instruments, but they also have the outqueue size == -1 Smiley Surprised.    The flush call is meaningless I would think in this case.

We don't seem to have trouble with CVI 8.1 RTE on these commercial instruments (five different instruments from five different manufacturers) but we haven't used them a lot under 8.1 because the devices designed in-house have trouble.

We have three different devices using a Xilinx FPGA implementing a serial port using the UartLite IP Core.  These stopped dead in their tracks with CVI 8.1, and they have a 512 byte output Q but FlushOutQ is not being called on these.

We run at 57,000bps, 19,200bps, and 115,200 bps on these.  All quit working with CVI 8.1.  All work with CVI 7.1.1.  All are doing volumnuous, full duplex i/o, mostly ooutput from the PC to the device.

We had trouble with these when using a USB - rs-232 converter as well.  I suspect something's just not quite right with the Xilinx implementation.  Why it would show up so dramatically on 8.1 is still a mystery to me.

Menchar
0 Kudos
Message 15 of 33
(4,145 Views)
This sounds like a pretty concrete problem, and if it is indeed a matter only of CVI runtime engine 7.1.1 (or presumably 8.0.x) vs 8.1.x, I'd like to find out what the problem is.  When you say that they "stopped dead in their tracks" and they "quit working", what exactly is the behavior that you experience?  Are there certain functions that return errors, or are there crashes, or do you get invalid/unexpected data, or something else?  I agree with you that if the implementation has caused certain devices/setups to fail when they previously worked correctly, it is a step backwards.  Unfortunately, I can't reproduce your setup, since I don't have the same hardware, so I probably can't reproduce your problem(s).  One thing I would suggest (which I admit is not trivial), is to try using the Windows SDK directly (using a file handle for the serial port) to do your communication.  If you can get the Windows SDK to work directly, it may be a great help in determining what our RS-232 library may be doing differently.

Mert A.
National Instruments
0 Kudos
Message 16 of 33
(4,109 Views)

Probably not related but we had an experience with some third party gate array hardware which gave us intermittant problems with RS232 communications (not CVI). Detailed investigation revealed they were using illegal stop bit widths under certain circumstances, with a width of about 50% of what it should have been. Some UARTS/drivers could cope with this, some couldn't. Luckily we managed to identify the circumstances when this occurred and operated the system in such a way as to avoid them.

Maybe the 8.1 driver is a bit more fussy when it comes to checking for framing errors?

JR

0 Kudos
Message 17 of 33
(4,110 Views)
Well, the CVI RS-232 library is written on top of the Windows SDK, so driver-level behaviors like stop bit handling are below its scope and should not be affected by an upgrade from 8.0.x to 8.1.x.

Mert A.
National Instruments
0 Kudos
Message 18 of 33
(4,089 Views)
Exactly.  The NI library can't directly affect any of the low level behavior of the port - that's controlled by the driver.

That's what makes me think that inter-frame timing may have been shortened up (this is an effect that the 8.1 CVI library could conceivably have induced), and if the UartLite IP Core is, for example, shortening up the stop bit, then this could explain the situation - it's unable to detect the framing if not given some extra time at the end of a frame (effectively stretching the stop bit).  Bit clock differences can creep across the frame and are at the greatest variance when sampling the stop bit as well I imagine.    PC com ports are supposedly quite tolerant of bit clock errors.

We can send an extra stop bit to the device, that might help it on receive - sending an extra stop bit is always benign according to how I understand serial framing. 

I'm not in control of the deployed systems - I can't easily set up a debugging scenario - and since we know that 7.1.1 doesn't show the problem, it's no longer a hot issue, especially since the individuals who implemented the Xilinx don't want me to be able to prove they've screwed up Smiley Wink

Thanks for hanging in here with me on this.

menchar
0 Kudos
Message 19 of 33
(4,077 Views)
More info - I didn't fully respond to Mert's questions.

The effect is that the serial link to the Xilinx-based device breaks.  They don't do a good job with error handling, so they're really not sure just what's gone wrong - whether it's an error returned from a serial library call, or whether a CRC doesn't match, or whether a command wasn't ACK'd - they don't know.

I could resolve this most likely simply by putting a scope on the serial port and looking at frames.  They could add error handling also to resolve this but they don't really want to and I'm not going to do it for free Smiley Mad

But - I don't want to get frozen at CVI 8.0 from now on out because some goober mis-implemented a serial port in an FPGA.  We are telling the world it's an rs-232 / rs-422 serial port too - sooner or later one of our customers will be calling and asking why the serial com doesn't work.

As far as the FlushOutQ() race, I guess I'm curious how that manifests.  If you've got data in the outqueue, and you flush it before it's been emitted (or more likely, handed off to the serial driver) I don't know what you would expect to happen, other than some of the data may get flushed.  Maybe if the flush isn't fully effective - some data squeaks out after the flush.

Menchar


0 Kudos
Message 20 of 33
(4,058 Views)