LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading baud rate of VISA serial port opened by another application

Solved!
Go to solution

Good morning all you helpful forum-goers!

 

I have a LabVIEW application executable that uses the VISA serial port VIs to communicate at different baud rates depending on what hardware it is talking to.  It does this by sending a handshaking message at different baud rates; the hardware on the other side only responds when it sees an intelligible message at the baud rate it uses.  This works perfectly well.

 

I have a different LabVIEW application that emulates one of the hardware options that I use to test the first application works correctly.  I use virtual serial port driver (VSPD) software to run both on one computer.  This works perfectly well.

 

I now want to update the Emulator to emulate multiple different hardware that the software under test (SUT) can communicate with.  However, my VSPD software transmits data correctly even if the two applications configure their respective serial ports at different baud rates.  When I asked the VSPD company (Eltima) about this, they indicated that that was not a bug it was a feature, and that their software will throttle the rate at which the data is sent according to the baud rate setting.  Maybe a different VSPD software would correctly garble the data?  Anyone have any such experiences you can share?

 

So my problem is that I cannot verify that my SUT is setting the correct baud rates for its various hardware queries using my Emulator, because the Emulator sees a valid handshaking message regardless of what baud rate it opens its serial port with.

 

My first thought was to read the settings of the SUT's serial port using the VISA VIs.  However, this does not seem to be possible; I cannot get a "purple" VISA resource name with which to read the baud rate via a property node without using the VISA Open VI, and that VI returns error -1073807246 ("valid name but unable to open device").  In general this makes sense, as the SUT has that serial port open already.  I was hoping there was a read-only mode of some sort, but I cannot find it if there is.  I tried setting the "duplicate session" boolean input true, but that didn't help.  I have attached a screenshot of my little test VI illustrating this point; I ran it while the SUT was open.

 

My only other thought was to somehow measure how fast the data was coming into the Emulator, relying on the data speed throttling of the VSPD, but with only a 10 or so character handshaking message I'm not sure how to do that.

 

If you have any ideas on how to verify the baud rate another open program has configured their serial port to, I would very much appreciate the help!

 

Thank you,

 

-Joe

0 Kudos
Message 1 of 4
(1,608 Views)
Solution
Accepted by topic author jmorris

Hi,

 

what about using two real serial ports (maybe with two cheap USB-2-RS232 adapters), connected by a crosslink cable, for this test?

This will just take ~20€!

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 2 of 4
(1,597 Views)

Hi GerdW,

 

Thank you for the suggestion, and you may be right that using real hardware is the simplest solution.  I was hoping to find a software solution just because that is my existing setup, but this will definitely be my fall-back!

 

-Joe

0 Kudos
Message 3 of 4
(1,583 Views)

Just as a follow-up, I asked this same question to NI, and the technical engineers there could not come up with a software solution to this problem, either.  Hardware it is! Smiley Tongue

0 Kudos
Message 4 of 4
(1,422 Views)