LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI visa writes when serial port closes

Solved!
Go to solution

Hi all,

 

Currently working with LV2011 and NI visa 2014.  In my application i have 7 serial ports open of which 4 i am writing to devices over, 3 are simply listening.  Now i write to 4 of these devices, alternating between them, the second time i try to write to a device, the write isnt received, but when i exit the application and close the port, the message is recieved. I have seen this on 2 similar devices and it is a bit random. Its possible this is an issue of the device, but when using tera term i dont see this issue.  Has anyone ever seen this before?

 

 

I can post code, but its a larger application and i am using the AMC add on.

 

Thank you,

 

Matt



-Matt
0 Kudos
Message 1 of 13
(4,245 Views)
Solution
Accepted by topic author Wolleee

Are you using native serial ports or USB-to-serial adapters?  The USB adapters often behave badly with LabVIEW in certain circumstances.

 

While it may be a bit of a workaround, is it possible you can close the reference in LabVIEW right after the visa write to "force" the message across, then re-open the serial port reference again?

Message 2 of 13
(4,222 Views)

@Kyle97330 wrote:

Are you using native serial ports or USB-to-serial adapters?  The USB adapters often behave badly with LabVIEW in certain circumstances.

 

While it may be a bit of a workaround, is it possible you can close the reference in LabVIEW right after the visa write to "force" the message across, then re-open the serial port reference again?


Hi kyle,

 

Youre absolutely correct, im using FTDI USB to RS232 converters and im using the FTDI chipset because ive had terrible experience with other converters and labview, but i havent seen a problem in labview with these converters and i have used them often.  But i did take the brute force method and i close and reopen the port every time, seems to be working for now.  The software on the device seems a bit shaky.

 

Thank you,

 

Matt



-Matt
0 Kudos
Message 3 of 13
(4,216 Views)

The FTDI-based USB to Serial converters are usually pretty good (beware that there are some imitation/fake chips out there). Having 7 of them on the same computer might be causing some USB conflicts or something like that.

 

Have you tried changing the I/O buffer size and/or tried using the Flush Buffer functions in the Serial palette? There is an option there for flushing the transmit buffer manually and you can also manually set the serial port buffer size.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 4 of 13
(4,182 Views)

Closing and re-opening VISA sessions constantly is a band-aid at best, bad form, and can cause memory leaks. 

 

Post your code and I bet a proper solution could be found.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 5 of 13
(4,159 Views)

With seven devices are you certain that you are not having a power problem?

 

Lynn

0 Kudos
Message 6 of 13
(4,139 Views)

@johnsold wrote:

With seven devices are you certain that you are not having a power problem?

 

Lynn


I am not entirely sure im not having a power problem, i dont know how to determine that i am. I orginally had them connected to the native USB's on the computer, but then moved them to a USB hub with external power and saw better results, but not good enough. I had 6 connected to a laptop at one point, i adjusted the power settings there for the USB's, ran it for weeks and never saw a problem. All that said  I have a PXI 1042 chassis with a PXI 8430/16 that im hooking up right now.  Its a rack mount and i had to move it into another lab, but nobetter time to do it than right now. 

 

If this doesnt fix it then im blaming the device.

 

Matt



-Matt
0 Kudos
Message 7 of 13
(4,135 Views)

Check that the combined current of the devices does not exceed the current rating of the USB hub with power supply.

 

Edit: I mean the current rating of the USB hub, not the current rating of the power supply.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 13
(4,123 Views)

While USB hubs are good for providing more power, they are not good for the reliability of the connection as you'd have all 7 devices essentially multiplexing through a single USB port for communications which could cause issues. The best solution would be to use a PCI or PCIe card with 8 serial ports, then either using a single usb to 8 serial port box or adding more USB ports via PCI/PCIe.

 

Did you try my suggestion about flushing the transmit buffer?


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 9 of 13
(4,099 Views)

@billko wrote:

Check that the combined current of the devices does not exceed the current rating of the USB hub with power supply.

 

Edit: I mean the current rating of the USB hub, not the current rating of the power supply.


Hi Bill,

 

I actually cant find the power ratings for the hub, its a rosewill RHUB-500, some off the shelf thing I thought might work better than the native ports.  I would agree it could definitely be either power issues or enumeration issues with all the adaptors and then the hub.  I have an NI chassis with a PXI 8430/16. Im going to charge my devices for a few hours and then give that a try.  If the problem is fixed then it is either the adaptors or the hub. I ran a test similar to this with a lot more data transfer going on and 6 USB converters and didnt see an issue for around 3 weeks. 



-Matt
0 Kudos
Message 10 of 13
(4,069 Views)