LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

connecting to compact RIO with self-made software

Hi,

 

I am thinking about writing a software in Microsofts Visual Studio which has the following features:

 

  • connect to a NI Compact RIO Controller via TCP/IP
  • transfer/delete Files on Compact RIO controller, via FTP
  • software is able to send commands like reboot to the controller

I am looking for documentation of the interfaces, protocols, that the CRIO controller supports.

For example, can I establish a telnet connection and send commands? Any other interfaces?

 

 

 

 

0 Kudos
Message 1 of 16
(4,873 Views)

The communications protocols between CompactRIOs and is proprietary and owned by NI - I don't think they've published or made that information available (for Intellectual Property reasons?). Within LabVIEW you can use the System Configuration API to perform most of the actions you have mentioned. I'm not sure if there's a non-LabVIEW version of the API available.

 

Of course, FTP is an open protocol which will allow you to transfer files across easily. Some of the cRIOs have serial ports which allows you to access the console and some of the newer cRIOs that run Linux RT allow you to communicate over SSH (Telnet) & SFTP.

 

Apart from that, you could possibly investigate the protocol yourself using a network sniffer like Wireshark, but I wouldn't know NI's stance on that.


LabVIEW Champion, CLA, CLED, CTD
(blog)
0 Kudos
Message 2 of 16
(4,860 Views)

@Simorgh wrote:
  • connect to a NI Compact RIO Controller via TCP/IP

LabVIEW provides functions for opening, reading, writing, and closing TCP connections. You'll need to implement your desired protocol on top of TCP in the code you write that runs on the cRIO.


Simorgh wrote:
  • transfer/delete Files on Compact RIO controller, via FTP

The cRIO includes an FTP server.


Simorgh wrote:
  • software is able to send commands like reboot to the controller

What sort of commands other than reboot? You'll want to implement most of these in your TCP-based protocol. However, specifically for rebooting a cRIO, you might check out this thread: http://forums.ni.com/t5/LabVIEW/RT-Restart-Target-vi-what-is-the-communication-protocol/td-p/1713908


@Simorgh wrote:

I am looking for documentation of the interfaces, protocols, that the CRIO controller supports.

For example, can I establish a telnet connection and send commands? Any other interfaces?


The newest cRIOs run Linux. I don't have any experience with them, but I expect you can enable many of the typical Linux services on them. The older ones run a minimal real-time operating system (VxWorks or PharLap ETS) that offers no externally-accessible services (so far as I'm aware), other than a very limited shell through a serial connection. LabVIEW runs as an application on top of that, and provides services specifically for the development environment. There's also the previously-mentioned FTP server.

Message 3 of 16
(4,829 Views)

Thank you nathand and also Sam_Sharp. I got some ideas how I could continue.

 

To make things more clear on what I have in mind:

I want to write a software that runs on a remote laptop.

The software connects to a NI CRIO controller via ethernet tcp/ip, deletes/replaces/copies files for a software update (update of user applications).

Then reboots the controller.

We don't wan't to use LabVIEW to write this software!


nathand wrote:

What sort of commands other than reboot? You'll want to implement most of these in your TCP-based protocol. However, specifically for rebooting a cRIO, you might check out this thread: http://forums.ni.com/t5/LabVIEW/RT-Restart-Target-vi-what-is-the-communication-protocol/td-p/1713908



The newest cRIOs run Linux. I don't have any experience with them, but I expect you can enable many of the typical Linux services on them. The older ones run a minimal real-time operating system (VxWorks or PharLap ETS) that offers no externally-accessible services (so far as I'm aware), other than a very limited shell through a serial connection. LabVIEW runs as an application on top of that, and provides services specifically for the development environment. There's also the previously-mentioned FTP server.


Another command would be "stop user application x".

 

I have some experience with bachmann controllers which use VxWorks real time operating system. The Bachmann modified VxWorks supports telnet, so I hope that will work for the CRIO as well. Going to investigate the OS of our CRIOs ....

 

Thanks for the link about the reboot command. Definitely helpful.

0 Kudos
Message 4 of 16
(4,796 Views)

@Simorgh wrote:

 

The software connects to a NI CRIO controller via ethernet tcp/ip, deletes/replaces/copies files for a software update (update of user applications).

Then reboots the controller.

We don't wan't to use LabVIEW to write this software!


You must know there is some confusion here since you are the LabVIEW subforum.  You may get better help from the Real-Time Measurement and Control subforum, since this is a cRIO question.

 

You can telnet into the newer cRIOs running Linux.

0 Kudos
Message 5 of 16
(4,767 Views)

Simorgh wrote:

Going to investigate the OS of our CRIOs ....


http://digital.ni.com/public.nsf/allkb/35F1FD98520D6E0E8625783A005AF557

 

What will be running on the cRIO? A cRIO with no application running on it isn't very useful. If you don't want to write that application in LabVIEW, then a cRIO is probably the wrong hardware.

 

Again, I have no experience with the Linux-based cRIOs, but on the VxWorks/PharLap ones, you can run only a single user application at a time. That application can be a sophisticated program that handles multiple tasks that you can start and stop independently, but you'll need to write your own TCP code to handle the commands. If you want to stop one task and update it while others continue to run, that's more complicated, maybe impossible if those tasks also use custom FPGA logic (because you can only have one FPGA image loaded at a time). What are you actually trying to do here?

 

If you don't need that level of complexity, you can upload a new application (written in LabVIEW) over FTP, then send a reboot command over TCP as demonstrated in the Python script in the other thread. At my last job my coworker wrote C# code to "update the firmware" on the cRIO this way, it worked fine. That was the ONLY command handled outside the cRIO's application; every other command was handled by the compiled LabVIEW application running on the cRIO (which I wrote). My coworker's C# code communicated with that application over TCP.

 

EDIT:


@Simorgh wrote:

I have some experience with bachmann controllers which use VxWorks real time operating system. The Bachmann modified VxWorks supports telnet, so I hope that will work for the CRIO as well.


It won't. There's no telnet server on the cRIO, and even if there was, there's no shell or other command-line environment that would run once you connect.

0 Kudos
Message 6 of 16
(4,758 Views)

@nathand wrote:

It won't. There's no telnet server on the cRIO, and even if there was, there's no shell or other command-line environment that would run once you connect.


Are you sure about this?  I haven't done it personally, but in several NI demos they showed being able to telnet into a cRIO running Linux.  The last time I remember seeing this was at NI Week last year during some indepth cRIO demo session.

0 Kudos
Message 7 of 16
(4,719 Views)
Oops, I guess it wasn't clear that I was still referring to the non-Linux cRIOs in that comment about not supporting telnet. I'm sure that you can telnet into the Linux-based ones.
0 Kudos
Message 8 of 16
(4,711 Views)

Update:

 

Ok, thank you for your support.

 

I used the information in the thread http://forums.ni.com/t5/LabVIEW/RT-Restart-Target-vi-what-is-the-communication-protocol/td-p/1713908 that was posted here.

 

I'm successfully deploying the algorithm with a C# .NET 4.5 programm now.

 

Regarding the use of some kind console, I couldn't find anything.

We are currently researching the Replication and Deployment Tool Open Source VI to extract the "deploy image function" and rebooting the cRIO in a mode that doesn't start the user applications.

0 Kudos
Message 9 of 16
(4,678 Views)

@Simorgh wrote:

We are currently researching the Replication and Deployment Tool Open Source VI to extract the "deploy image function" and rebooting the cRIO in a mode that doesn't start the user applications.


You can upload a new application by ftp'ing the new exe to the correct directory (you might need to rename the old one first; you may not be able to delete or overwrite a running application). You can set whether the application runs on startup from the ni-rt.ini file, so you could ftp a new copy of that file as well with the desired settings. Maybe that's easier than pulling apart the Replication and Deployment Tool.

 

Out of curiousity, though, why would you want to install the new application, but not start it running? How will you launch it?

0 Kudos
Message 10 of 16
(4,663 Views)