LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can't read console output of a remote Linux "screen" serial session using NI VISA

Solved!
Go to solution

Labview version:  21

 

Background:

I've written an application using the Labview VISA library to open a console to the NixOS (Linux) of the DUT's controller over UART TTL interface.  So far, I'm able to see the console output and navigate the terminal with both standard and SU prompts.  My problem is when I open a serial session to a peripheral device on the DUT using the Linux command "screen," my console output in Labview goes blank. 

 

Some troubleshooting:

However, when I do the same thing manually with PuTTY (for example) I'm able to navigate into the peripheral's serial prompt with no problem (the serial connection to the peripheral device shows up in the same console window).  I'm able to set/get what I need, and then I close the screen with Ctrl-a+k 

 

It would seem the VISA libraries may not be suitable for this application, but I'm a sophomore-level Labview user and would like to heed the wisdom of the grey-beards.  Also, maybe "screen" is not a suitable application for this use-case.  Any feedback is appreciated. 

0 Kudos
Message 1 of 6
(1,093 Views)

Could you clarify a few things? I did a quick sketch of what I understood your setup looks like - am I correct?

 

LLindenbauer_1-1700477231130.png

 

You use UART 1 to connect to the DUT, then you want to open the connection UART 2 to communicate with the peripheral?

 

Can you clarify what you mean by "using the Labview VISA library to open a console"? I am not aware of such a capability in VISA.

 

 

Why are you using GNU screen? Is this a requirement?

I would believe that the issue is with your usage of GNU screen. As I understood, it is geared toward interactive use in a terminal emulator. I believe that the "VISA library console" is unable to handle the terminal commands sent by GNU screen to draw its own overlay. My recommendation would be to use a different program for the connection UART 2.

0 Kudos
Message 2 of 6
(1,051 Views)

Thanks for the quick reply, LLindenbauer.

 

Your diagram is a correct representation of my application.

 

To clarify "using the Labview VISA library to open a console," I'm using the VISA Read and write to interact with the terminal, respectively, to the NixOS controller.  It does "work", however the VISA library encodes text output in ASCII whereas the terminal output is in ANSI (correct me if I'm wrong :P), so you'll be able to see the special formatting characters that the terminal uses.  it's not perfect, but it's gotten me through thus far :).

 

But, I think I agree with your assessment on the limitation of GNU screen.  Only reason we've been using it up to this point is, it worked for manual testing, so maybe I'll look into other GNU applications in the mean time.

 

Let me know if you need more info.

 

 

 

 

0 Kudos
Message 3 of 6
(1,031 Views)

@Bill_FoTW wrote:

Thanks for the quick reply, LLindenbauer.

 

Your diagram is a correct representation of my application.

 

To clarify "using the Labview VISA library to open a console," I'm using the VISA Read and write to interact with the terminal, respectively, to the NixOS controller.  It does "work", however the VISA library encodes text output in ASCII whereas the terminal output is in ANSI (correct me if I'm wrong :P), so you'll be able to see the special formatting characters that the terminal uses.  it's not perfect, but it's gotten me through thus far :).


ANSI and ASCII is in this context likely irrelevant. They are not the same but there is no reason why you could not enter the same text including ANSI escape codes in a normal VISA byte stream. What is likely the problem is that you have some sort of terminal emulation going on, either on the UART side of your NixOS or in GNU Screen or both, that you can enable in Putty but not in VISA. VISA is a simple byte stream pass-through without any special code interpretation other than the optional termination character handling. Anything else like terminal emulation, telnet option codes or whatever else you can think off you have to implement on top of VISA yourself.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 6
(1,001 Views)
Solution
Accepted by topic author Bill_FoTW

@Bill_FoTW wrote:
... the terminal output is in ANSI (correct me if I'm wrong :P), so you'll be able to see the special formatting characters that the terminal uses. 

These would be ANSI escape codes (which are unrelated to any ANSI character set). They are sent by the host to tell PuTTY to change colors, fonts, clear the screen etc. If you read them via VISA, they will be spread around in your output. You can probably set your NixOS serial console to not use them if you prefer.

 

But, I think I agree with your assessment on the limitation of GNU screen.  Only reason we've been using it up to this point is, it worked for manual testing, so maybe I'll look into other GNU applications in the mean time.

 

Let me know if you need more info.

I would not call it a limitation, in the same sense that I would not talk about limitations of a screwdriver when trying to hit a nail. Depending on what you are trying to do and how everything is set up, you might get away with just piping your commands to the stty for UART 2: https://stackoverflow.com/questions/8877269/writing-to-the-serial-port-from-the-linux-command-line

0 Kudos
Message 5 of 6
(987 Views)

Wow, thanks for all the feedback everyone! 

 

@LLindenbauer I like your idea of using the command line.  The most obvious answer in front of me, but I couldn't see it :P.  

0 Kudos
Message 6 of 6
(962 Views)