Working with NI LRT over SSH and SFTP - mahilab/MEL GitHub Wiki
Since the NI LRT device is a remote system, we will interact with it over the Secure Shell (SSH) protocol. We will also transfer binaries and other files to it using the SSH File Transfer Protocol (SFTP). To get started, you must first determine the network IP address of your NI LRT device.
Ensure your host PC and NI device are on the same local network. This can be accomplished by connecting via Ethernet, WiFi, or USB (which will appear as emulated Ethernet). Open NI Measurement and Automation Explorer (MAX), find your device under Remote Systems
, and obtain your devices IP address.
Note: If you connected your device over USB, NI software will establish an emulated Ethernet connection between your PC and the device. The host address is always 172.22.11.1, and remote device IP is usually 172.22.11.2.
You should more than likely already have a SFTP client available through your command line interface (git installations are bundled with one, and Windows 10 now has SFTP build in).
Picking back up in the same terminal as before (you should be in MEL/build/
):
> sftp [email protected] # username@address
NI Linux Real-Time (run mode)
Log in with your NI-Auth credentials.
Password: # enter your password when prompted
Connected to [email protected].
You should now be logged into the device over SFTP. You may wish to familiarize yourself with the available commands before continuing.
First we transfer the examples:
sftp> cd /home/admin # change to remote home directory (replace admin if needed)
sftp> mkdir MEL # make remote directory
sftp> cd MEL # change remote directory
sftp> mkdir examples # make remote directory
sftp> cd examples # change remote directory
sftp> lcd examples # change local directory
sftp> put ./* # transfers all examples
sftp> chmod 777 ./* # elevate permissions on all examples
Finally, we must transfer the device's target FPGA bitfile. If you are using a myRIO, MEL implements the NI provided shipping personality and expects to find the bitfiles in /var/local/natinst/bitfiles/
.
sftp> cd /var/local/natinst
sftp> mkdir bitfiles
sftp> cd bitfiles
sftp> lcd ../../misc
sftp> put NiFpga_MyRio1900Fpga60.lvbitx
sftp> chmod 777 NiFpga_MyRio1900Fpga60.lvbitx
Another option for transferring files is to use a GUI SFTP client like WinSCP.
Click to Expand
Open WinSCP and login into the device over SSH:
You should now be able to see the folders and files on the device in the right hand-side of WinSCP:
In WinSCP, go to Options > Preferences > Transfer
. With Default
selected, click Edit...
. Under Upload options
, check Set permissions:
and click the ...
button. Check all Read (R), Write (W), and Execute (X) boxes. The octal should change to 0777
. This will ensure anything we upload to the device over WinSCP can be read, written, and executed.
Navigate to /home/[username]/
and create a folder named MEL
and a sub-folder named examples
, then copy over each example binary.
Note: For myRIO, you must also copy the default FPGA personality bitfile to the correct location on the device. Upload NiFpga_MyRio1900Fpga60.lvbitx to
/var/local/natinst/bitfiles/
.
Like SFTP, you should have an SSH client available through your command prompt (if you don't, you can download and install PuTTY instead).
> ssh [email protected] # username@address
NI Linux Real-Time (run mode)
Log in with your NI-Auth credentials.
Password: # enter your password when prompted
Last login: Thu Feb 17 02:12:03 2019 from 172.22.11.1
You are now logged into the device and can run the examples:
> cd ~/MEL/examples # change location to MEL examples directory
> ./hello_world # runs MEL hello_world example, prints "Hello, World!"
Hello, World!
Proceed to run any other examples you wish.