LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Automate CLI commands from a Linux Environment using RS232 Serail Port with the use of Basic Write and Read VISA functions.

I have to read the output of a Linux OS boot from a unit under test (via a serial RS232 prt), then trigger a write, based on a particular string being read from a buffer (read). There are 25 commands that I have to execute (write) where I have to read the responses of each command and compare the output to make sure the command(s) executed properly.

 

I am trying to use the Basic Read and Write VISA functions from the LabView tools and I am having no luck.

 

 

0 Kudos
Message 1 of 13
(2,982 Views)

Can you provide us with some details?  Any error messages?  A VI that we can look at?

 

Saying "I am having no luck" doesn't give us any clue as to where we can start to help you.

0 Kudos
Message 2 of 13
(2,978 Views)

I have attached a document on what I am trying to do. I am using the attached VI to try and get the just the login at this point. I am not very good at LabView so please forgive me for my ignorance. I am looking for an out line that I can try and get this working...

Download All
0 Kudos
Message 3 of 13
(2,973 Views)

The first thing I see is that your VI is all out of whack.  You took the Basic Serial example and swapped things around in a way that doesn't make sense and won't work.

 

1.  You configure and open the serial port.

2.  You check the # of bytes and read the port.  Well that is going to be zero because you just opened it.

3.  You write something to the port.

4.  You wait a bit.

5.  Then you close the port.  So if you did get any response from the command you wrote, you've just lost it.

 

Look at the Basic Read Write serial example again.

 

Then look at the Advanced Serial Read Write.  That is a better example in a lot of ways because it does a serial configuration before the loop.  Then it does read and write in a loop.  Then it only closes the port after you hit the stop button.

Message 4 of 13
(2,967 Views)

Besides what Ravens had to say, you have a long, long way to go. You have done nothing about the steps you have to run once the login prompt is detected.

 

I've done this numerous times for linux and RT OS's and what you need to implement is a basic state machine. There are shipping examples to help you get started.

0 Kudos
Message 5 of 13
(2,959 Views)

Hello,

 

Are you able to successfully use the basic serial read and write example code?  Try sending just the basic *IDN? command, and see if you can read that back.

If that works out for you, also take a look at the advanced read and write example.  We can incoporate that with a state machine to read and write a series of commands.  Here is a tutorial on state machines if you are unfamiliar with them.

 

Regards,

 

Lisa

Applications Engineer
National Instruments
0 Kudos
Message 6 of 13
(2,935 Views)
Sorry, but the *IDN? command has nothing at all to do with a linux os.
0 Kudos
Message 7 of 13
(2,928 Views)

I made my state machine and it works pretty good via the VI interface.

 

Now when inserting the VI (Read and Write) inbetween a Initialize VI and Close VI I get several errors that are enclosed. This is from a TestStand environment.

 

The other issue is that how do I go about searching the complete output Read String for a substring or parameter within the Read Back string? Can that be done in TestStand and if so how does one go about that?

0 Kudos
Message 8 of 13
(2,912 Views)

Hello Ealmeida,

 

Would you be able to provide the TestStand sequence and VI you are using; at the moment it is difficult to troubleshoot the issue from just the TestStand Report.

 

Eric

Eric Liauw
Senior AE Specialist - Automated Test | CLD | CTA
National Instruments
0 Kudos
Message 9 of 13
(2,890 Views)

Ok. I will zip this up for you and enclose it. I am at a dead end here and I have been trying everything imaginable to first find out what the Failed Flag is within the log file and secondly trying to figure out how to search the expected response for particular strings within it...

0 Kudos
Message 10 of 13
(2,887 Views)