Outils pour utilisateurs

Outils du site


wiki:tutoriels:intel_galileo_linux

Ceci est une ancienne révision du document !


Part 1 :Serial Terminal Introduction

The purpose of this section is to propose a protocol for a new user to be able to create a serial connection to their Intel Galileo Gen 2 using a “terminal emulator”. A “terminal emulator” is a program that will allow us to communicate with the Galileo via command line. Note The command line communication in and of itself offers no benefit to a newbie user. However, it is the only way to take advantage of a whole host of tools to better exploit our Galileo Gen 2.

The reader should already have read through the previous sections and should be familiar with the basic Terminal Connection Vocabulary. Just as importantly all drivers and firmware should be up to date. The reader should equally have already installed the Arduino IDE and have successfully tested the communication with the Galileo using the "Blink" example.

Intel's IoT devellopement kit

To start we must first download a larger version of linux than what is already found within the galieo's flash drive. We must also download a software that will allow us to write this software onto a microSD card. I will be using Win32 The software can be downloaded from the “Galileo Basic's section” of this tutorial or can be found here:

Intel's IoT Dev Kit

Win32 Disk Imager

  • After downloading Win32 Disk Imager install as you would any other program
  • After downloading Intel's Iot dev kit:
    • Create a new folder “IoT” in the C:/Galileo/ folder
    • Unzip into C:/Galileo/IoT
    • You should have a filenamed “iot-devkit-prof-dev… .direct”
  • Place your MicroSD (1gb-32gb) into a card reader and connect it to your PC
    • Many PC's have an integrated SD card reader
    • If yours does not you will need a USB to SD card converter
  • Open Win32 Disk Imager

  • Select the blue folder next to the large blank space

  • Enable “search all file types” in the bottom right corner of the search menu
  • Search within C:/galileo/IoT
  • Select the “iot-dev-… .direct” file

  • The large blank space is now “iot-dev-… .direct'
  • Verify that the selected “write drive” next to the blue folder is the drive that corresponds with your SD card
    • You can easily test this by connecting then disconnecting your SD card reader and noting the drive that no longer appears. This is your SD card.
  • Select Write

  • You will br promoted to confirm the operation
  • Select Yes
  • The file transfer will require 3-5 minutes
  • DO NOT DISCONNECT THE SD CARD DURING THIS OPERATION
  • When complete you will be prompted that the file transfer has been successful

Accessing the Linux Shell

I will be using PuTTY for this tutorial which can be downloaded here:

PuTTY. This is a well known software for Windows that will enable SSH and serial communication with the Galileo.

There are multiple methods to establish serial communication with the Galileo. In this tutorial we will be using just an Ethernet Cable and a pre-made Arduino Script. Other methods require special FTID cables which I do not currently have.

<note>

void setup() {

Serial.begin(9600);
//It’ll not continue until you send an ‘a’ through the serial monitor
while(Serial.read()!='a'){
  Serial.println("hello");
  delay(1000);
}
//Display ifconfig result to serial monitor
system("ifconfig > /dev/ttyGS0");

}

void loop() { } </note>

  • First we will copy/paste this code into the Arduino IDE
    • The command “system(“ifconfig > /dev/ttyGS0”);” will ask for, then transmit the Galileo's Ethernet IP address and send it to the Arduino Serial monitor

  • Before transfering the sketch verify the the COM#
  • Now that linux is being ran from the SD card, arduino MAY recognise the arduino under a different COM#
  • You can verify the COM# using start>run>devmgmt.msc>Ports(COM & LPT) mine is now COM5
    • Verify connection with “Blink Example”
  • Transfer the sketch, after succesful tranfer, open the Serial Monitor

  • The serial monitor (at 9600 baud) will be transmitting “hello”
  • Type “a” into the serial monitor in the top bar
  • You will now have this list of IP addresses and other information
    • We need the IP address that has been highlighted in blue
    • Copy this IP address

  • run PuTTY
  • Within “Host address” Paste the IP address previously Copied
  • Select Open

  • You are presented with a security alert
  • Select Yes
  • It may take a moment to connect

  • You will now be asked to login into Linux that has been installed onto the Galileo
  • Use the login “root”
  • When ” root@galileo:~# “ appears, you are succesfully signed into the Linux shell

  • We can see that Python can be easily invoked using this interface
  • We simply type “Python” into the command line and we have Python now running on our galileo.
  • Yes; 2+3 does equal 5

Part 1 Conclusion

After reading the first part of the Linux Terminal Communication, you should now have the Intel IoT devellopement kit installed onto your Galileo Gen 2. We have introduced only 1 means of serial communication; using an ethernet cable and an arduino sketch. We hope to explore the pros/cons of this choice over an alternative method. To test a second method, we will need an FTDI cable.

It should be noted that there exist multiple terminal emulators, each with pros & cons. It may interest certain users to consider:

Part 2: SSH for Newbies

Secure Shell is a cryptographic network protocol for operating network services securely over an unsecured network. It is the method that we must use in order to communicate with the Intel Galileo. In order to help new users, we have compiled a short list of helpful commands to get jump started.

For all of these examples:

  • Hit enter/return after every command unless specified otherwise
  • All commands are lowercase and case sensitive
  • All commands will be presented with first their SSH defintion
    • Then a more casual term to help us understand what it does
    • Finally a brief explanation of what it does

Where am I

  • print working directory
  • pwd
  • It will identify what file you are currently in.
    • In this case /home/root

What is in here

  • list command - all files in long format (date/size/ect) h (display setting)
  • ls -alh?
  • It will give a full list of all folders and files within the current directory
    • In this case I have node_history, python_history, ect

Run a Program

  • Type the name (case sensitive) of the file we want to execute
  • In this example we will use “python”
    • Python 2.7.3 is now operating on our Galileo

Terminate a running program

  • Ctrl-d will terminate a running program
  • Ctrl-d will terminate the terminal session if no program is running

Create a new folder

  • make directory
  • mkdir “directory name” or mkdir “dir/file/path”
  • We will create a folder named dirTest
    • mkdir dirTest
    • use ls -alh to verify it exists

Change directory

  • change directory
  • cd “directory name” or cd “dir/file/path”
    • allows you to open other folders
    • we will go into dirTest
      • cd dirTest
      • Use pwd to verify that we are in the new directory
  • type cd
    • this takes us back 1 directory
    • use pwd to verify that you are in /home/root
    • type ls -alh to view the contents

delete directory

  • remove folder
  • rm -rf 'folder name”
    • be careful because this command will delete ALL files within a directory
  • We will delete dirTest
    • rm -rf dirTest
    • use ls -alh to verify that it has been deleted

SSH conclusion

We have only offered a small selection of basics SSH commands just to get started. For a more in depth understanding of SSH i would advise that you read through:

Being able to master SSH will only empower a user to exploit the Galileo Gen 2 at it's best. This skill should not be neglected, and it's as good as time as any to learn SSH!

Part 3 : File Sharing

When using the Galileo GEN2 it is best practice to write all of your scripts/programs on you main PC and then transfer them to the Intel Galileo Gen 2. We do this for 2 main reasons:

  • It is far easier to compile code using our screen and proper developement tools on our pc. The galileo can not exploit a graphic interface
  • If for what ever reason your SD card/galileo fail, you will have all of your backup work on your PC. (which should also be backed up!)

You may also find it interesting to send files back and forth between the Galileo and a server (or personal pc). This may be interesting when the data recovered by the Galileo must be transformed or shared with other nodes in a greater network. This tutorial will show the simplest case where a Master PC will send a file to a Slave galileo.

When accessing the shell through SSH (so all the methods above except UART connection), files can be copied between the computer and Intel® Galileo Gen 2 with the utility scp.

If using Linux or Mac OS, scp should be there already. In Windows you can get pscp.

  • Once downloaded place PSCP onto your desktop for the sake of this tutorial
  • goto the start menu> run>cmd (open command prompt)

  • we want to navigate to our desktop
    • cd desktop
    • note Not all commands used in command prompt are not identical to SSH although some are the same.
LDAP: couldn't connect to LDAP server
wiki/tutoriels/intel_galileo_linux.1482201033.txt.gz · Dernière modification: 2016/12/20 02:30 de royce