LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Scanning known serial ports for a specific response

Solved!
Go to solution

I need to build a test fixture for a device that uses a Silicon Labs Dual CP2105 chipset that talks to two different sections of the board to be tested. Since it's USB it will be somewhat random which port enumerates as what when a new DUT gets put in place. 

 

I have a VI that can identify the ports, attached below. I need to take the resulting serial ports found and send an ASCII "??" to them. If in the first line of the response contains  "FPGA" that means I have found the right port and I will want to be using that for the rest of my communications. 

 

And idea how to do this? Serial communication is new to me for labview. 

0 Kudos
Message 1 of 12
(3,029 Views)

You would need to cycle through each port.

 

  1. Open each port.
  2. Set Serial settings, baud rate, parity, etc.
  3. Query with ??.
  4. Look at response.

See below:

 

Snap15.png

The above can be improved, just a sketch of what is possible.

 

mcduff

0 Kudos
Message 2 of 12
(3,020 Views)

I had a similar project that I had to enumerate through the serial ports as well as enumerate through each of the BAUD settings.

Doing what mcduff provided is exactly what I did to achieve my goal.

0 Kudos
Message 3 of 12
(2,989 Views)

Thanks! That pushed me in the right direction. Attached what I ended up with. 

0 Kudos
Message 4 of 12
(2,967 Views)

You can eliminate that first For Loop. It's not needed since your using aliases.

0 Kudos
Message 5 of 12
(2,958 Views)
Solution
Accepted by lumonic

Here's a one loop suggestion to try. (I assume you only have one FPGA port attached, otherwise then make an array and get rid of the conditional stop.)

 

mcduff

 

snip.png

0 Kudos
Message 6 of 12
(2,957 Views)

OK, that works.

 

Thanks!

 

0 Kudos
Message 7 of 12
(2,942 Views)

I would also advise using the "expression" input on the Find VISA Resource.  With it, you can easily filter out all of the TCP and GPIB resources.  For my reuse, I also filter out the COM ports that I know are not what I am looking for (I know are used by other devices, were previously detected and looking for a new port due to USB connection, etc).


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 8 of 12
(2,885 Views)

oops, wrong login account of mine, see the next message

0 Kudos
Message 9 of 12
(1,418 Views)

Does anyone else find that the VISA Find Resource function used

Peter_John_0-1679747800407.png

takes a long time (8 seconds for me) to execute ?   Even when the list is empty it still takes that long to excute which seems unusually long.

 

Peter

Peter
0 Kudos
Message 10 of 12
(1,411 Views)