Difference between revisions of "What can I do with IGEPv2"

From IGEP - ISEE Wiki

Jump to: navigation, search
m
Line 1: Line 1:
 
{| cellspacing="0" cellpadding="5" border="1" align="center" width="100%" style="text-align: left;"
 
{| cellspacing="0" cellpadding="5" border="1" align="center" width="100%" style="text-align: left;"
 
|-
 
|-
| bgcolor="#cccccc" |'''What can I do with IGEP0020'''
+
| bgcolor="#cccccc" |''''''IGEPv2 - Part 2/3''''''
 
|-
 
|-
| If you have '''successfully completed the [[Getting Started with IGEP0020 board|first chapter of this guide]]''', you can continue with this tutorial guide about IGEP0020.
+
| It is recommended that you '''follow the [[{{#lst:Template:Links|IGEPv2_Community_Guides_1}}|previous chapters]]''' of this guide before continuing with this tutorial.
 
|}
 
|}
  
Line 20: Line 20:
 
{| cellspacing="0" cellpadding="5" border="1" align="center" style="text-align: left;"
 
{| cellspacing="0" cellpadding="5" border="1" align="center" style="text-align: left;"
 
|-
 
|-
| bgcolor="#cccccc" colspan="3" | '''Overview'''
+
| bgcolor="#cccccc" colspan="3" | '''IGEP Technology Devices Guides - Part 2/3 - Summary'''
 
|-
 
|-
| [[Image:Igep0020.jpg|250px|center|link=Category:IGEP0020]]  
+
| [[Image:{{#lst:Template:Links|IGEPv2_Image}}|250px|center|link={{#lst:Template:Links|IGEPv2_Community_MainPage}}]]  
 
|-
 
|-
|'''1) [[What can I do with IGEP0020#Booting and setting up|Booting up IGEP0020]]'''
+
|'''1) [[#Booting and setting up|Booting up IGEPv2]]'''
 
|-
 
|-
|'''2) [[What can I do with IGEP0020#Updating the pre-installed software|Updating the pre-installed software]]'''
+
|'''2) [[#Updating the pre-installed software|Updating the pre-installed software]]'''
 
|-
 
|-
|'''3) [[What can I do with IGEP0020#Flashing the software image|Flashing the latest firmware to the IGEP0020 flash memory]]'''
+
|'''3) [[#Flashing the software image|Flashing the latest firmware to the IGEPv2 flash memory]]'''
 
|-
 
|-
|'''4) [[What can I do with IGEP0020#Connect to IGEP0020 via network interfaces|Connect to IGEP0020 via network interfaces]]'''
+
|'''4) [[#Connect to IGEPv2 via network interfaces|Connect to IGEPv2 via network interfaces]]'''
 
|-
 
|-
|'''5) [[What can I do with IGEP0020#Basic instructions|Basic instructions]]'''
+
|'''5) [[#Basic instructions|Basic instructions]]'''
 
|-
 
|-
|'''6) [[What can I do with IGEP0020#Send a file between a PC and IGEP0020|Send a file between a PC and IGEP0020]]'''
+
|'''6) [[#Send a file between a PC and IGEPv2|Send a file between a PC and IGEPv2]]'''
 
|-
 
|-
|'''7) [[What can I do with IGEP0020#How to handle the gpio-LED's|Handle IGEP0020 LED's]]'''
+
|'''7) [[#How to handle the gpio-LED's|Handle IGEPv2's]]'''
 
|-
 
|-
|'''8) [[What can I do with IGEP0020#Mount a MicroSD card|Mount a MicroSD card]]'''
+
|'''8) [[#Mount a MicroSD card|Mount a MicroSD card]]'''
 
|-
 
|-
 
|}
 
|}
Line 59: Line 59:
 
This distribution consists on a '''minimal Linux-based distribution''' with a lite X Window System and GNOME Mobile based applications created with '''Poky Platform Builder'''.
 
This distribution consists on a '''minimal Linux-based distribution''' with a lite X Window System and GNOME Mobile based applications created with '''Poky Platform Builder'''.
  
In the previous chapter of this tutorial, we have booted IGEP0020 with its pre-installed software.
+
In the previous chapter of this tutorial, we have booted IGEPv2 with its pre-installed software.
  
Once the board has booted up, it asks for a login in the serial debug port. You can log in into IGEP0020 via the serial interface.
+
Once the board has booted up, it asks for a login in the serial debug port. You can log in into IGEPv2 via the serial interface.
  
  
Line 70: Line 70:
 
'''Boot priority'''
 
'''Boot priority'''
  
In fact, IGEP0020 can boot from many other devices (listed by priority):  
+
In fact, IGEPv2 can boot from many other devices (listed by priority):  
  
 
# from USB
 
# from USB
Line 78: Line 78:
  
  
As we haven't set any other boot device rather than the oneNAND (the IGEP0020 flash memory) the system boots from it.
+
As we haven't set any other boot device rather than the oneNAND (the IGEPv2 flash memory) the system boots from it.
  
  
But, as '''the MicroSD card has an upper priority than the flash''', if you plug a MicroSD card (with the right configuration on it) to the MicroSD card reader, IGEP0020 will boot from it and won't boot from the flash memory.
+
But, as '''the MicroSD card has an upper priority than the flash''', if you plug a MicroSD card (with the right configuration on it) to the MicroSD card reader, IGEPv2 will boot from it and won't boot from the flash memory.
  
  
Line 107: Line 107:
 
3) '''Create a MicroSD card''' in your external computer.
 
3) '''Create a MicroSD card''' in your external computer.
  
4) '''Plug the MicroSD card''' to IGEP0020 and boot from it.
+
4) '''Plug the MicroSD card''' to IGEPv2 and boot from it.
 
|}
 
|}
  
Line 131: Line 131:
 
Now you have downloaded a compressed file with the latest official firmware into the current directory (.tar.gz).
 
Now you have downloaded a compressed file with the latest official firmware into the current directory (.tar.gz).
  
Next, we will use the application 'tar' to untar (uncompress) the donwloaded file. In the same Terminal session, type:
+
Next, we will use the application 'tar' to untar (uncompress) the downloaded file. In the same Terminal session, type:
  
 
  tar xzf poky-firmware-3.3.1-10.tar.gz
 
  tar xzf poky-firmware-3.3.1-10.tar.gz
Line 171: Line 171:
 
4) '''Plug the MicroSD card'''
 
4) '''Plug the MicroSD card'''
  
Therefore, you are ready to try it. '''Plug the MicroSD card into IGEP0020''' and '''power up your board'''.
+
Therefore, you are ready to try it. '''Plug the MicroSD card into IGEPv2''' and '''power up your board'''.
  
 
=== Flashing the software image ===
 
=== Flashing the software image ===
 
----
 
----
  
Now your IGEP0020 has the latest firmware '''running from MicroSD card'''.
+
Now your IGEPv2 has the latest firmware '''running from MicroSD card'''.
  
 
But you might want to write the firmware to the flash memory, so '''you won't need the MicroSD card when booting''' the board. So let's do it.
 
But you might want to write the firmware to the flash memory, so '''you won't need the MicroSD card when booting''' the board. So let's do it.
  
  
''Note: The following process is assuming that your host PC is connected to IGEP0020 via the Serial Debug port. If not, read the Serial Port instructions in the [[Getting Started with IGEP0020 board|previous chapter of this tutorial]].''
+
''Note: The following process is assuming that your host PC is connected to IGEPv2 via the Serial Debug port. If not, read the Serial Port instructions in the [[Getting Started with IGEPv2 board|previous chapter of this tutorial]].''
  
  
Enter to IGEP0020 using:
+
Enter to IGEPv2 using:
  
 
  * root as login name  
 
  * root as login name  
 
  * an empty password
 
  * an empty password
  
The software provided by ISEE has a script that flashes the content of your MicroSD Card to the flash memory in your IGEP0020.
+
The software provided by ISEE has a script that flashes the content of your MicroSD Card to the flash memory in your IGEPv2.
  
 
You have to run this script, that is located at /opt/firmware directory. Open a Terminal and run:
 
You have to run this script, that is located at /opt/firmware directory. Open a Terminal and run:
Line 196: Line 196:
 
  ./flash.sh
 
  ./flash.sh
  
This will last a few minutes. When it is ready, unplug the SD card from IGEP0020 and reboot the board:
+
This will last a few minutes. When it is ready, unplug the SD card from IGEPv2 and reboot the board:
  
 
  reboot
 
  reboot
Line 205: Line 205:
  
  
=== Connect to IGEP0020 via network interfaces ===
+
=== Connect to IGEPv2 via network interfaces ===
 
----
 
----
  
Line 212: Line 212:
 
| bgcolor="#cccccc" |'''Overview'''
 
| bgcolor="#cccccc" |'''Overview'''
 
|-
 
|-
| 1) '''Plug an ethernet cable to IGEP0020
+
| 1) '''Plug an ethernet cable to IGEPv2
  
 
2) '''Connect via ethernet network''', SSH: root@192.168.x.x
 
2) '''Connect via ethernet network''', SSH: root@192.168.x.x
Line 219: Line 219:
 
|}
 
|}
  
You can log into IGEP0020 via many '''interfaces with network connectivity''', such ethernet, wifi, usb-ethernet gadget, etc.
+
You can log into IGEPv2 via many '''interfaces with network connectivity''', such ethernet, wifi, usb-ethernet gadget, etc.
  
In this tutorial we are going to connect via an ethernet cable. To to that, you need to set an IP in IGEP0020 (host) and start a SSH session in your PC (client). Let's do it.
+
In this tutorial we are going to connect via an ethernet cable. To to that, you need to set an IP in IGEPv2 (host) and start a SSH session in your PC (client). Let's do it.
  
 
First of all, you will need:
 
First of all, you will need:
Line 229: Line 229:
  
  
Log into IGEP0020 via the '''serial cable to the serial debug port in IGEP0020''', as you have done in the previous chapter of this tutorial guide.
+
Log into IGEPv2 via the '''serial cable to the serial debug port in IGEPv2''', as you have done in the previous chapter of this tutorial guide.
  
 
Once you are logged in, run the following command:
 
Once you are logged in, run the following command:
Line 235: Line 235:
 
  ifconfig
 
  ifconfig
  
This will '''list all the enabled network interfaces''' in your IGEP0020.
+
This will '''list all the enabled network interfaces''' in your IGEPv2.
  
We are going to '''focus on 'eth0''''. This is the ethernet interface in your IGEP0020, which is the interface we will '''connect to from our host PC'''.
+
We are going to '''focus on 'eth0''''. This is the ethernet interface in your IGEPv2, which is the interface we will '''connect to from our host PC'''.
  
Connect the ethernet cable between your host PC and IGEP0020 (or through any wired network such switch).
+
Connect the ethernet cable between your host PC and IGEPv2 (or through any wired network such switch).
  
Now, let's '''set an static IP''' to this interface in IGEP0020, so we will be able to reach the target from the PC.
+
Now, let's '''set an static IP''' to this interface in IGEPv2, so we will be able to reach the target from the PC.
  
 
Type the following command in your serial console:
 
Type the following command in your serial console:
Line 259: Line 259:
  
 
# Select the '''SSH''' at connection type.
 
# Select the '''SSH''' at connection type.
# Next insert the '''IP address of the target'''. In this case, the IGEP0020 IP you have already set (192.168.6.3).
+
# Next insert the '''IP address of the target'''. In this case, the IGEPv2 IP you have already set (192.168.6.3).
 
# Ensure that the port is set to '''22''', the default for SSH communications.
 
# Ensure that the port is set to '''22''', the default for SSH communications.
 
# Finally, push the '''Open button''' to start the SSH session.
 
# Finally, push the '''Open button''' to start the SSH session.
  
  
If everything goes right, you will be able to access to an IGEP0020 console from your PC via ethernet.
+
If everything goes right, you will be able to access to an IGEPv2 console from your PC via ethernet.
  
 
=== Basic instructions ===
 
=== Basic instructions ===
Line 280: Line 280:
 
|}
 
|}
  
IGEP0020 is '''compatible with many Linux distributions'''. In this tutorial we are using Poky Linux, which is the pre-installed software from ISEE.
+
IGEPv2 is '''compatible with many Linux distributions'''. In this tutorial we are using Poky Linux, which is the pre-installed software from ISEE.
  
 
In case you are not familiar with Bash instructions, here comes some basic instructions to help you startup with the board.
 
In case you are not familiar with Bash instructions, here comes some basic instructions to help you startup with the board.
  
First of all, '''log in to IGEP0020''' with a console from your host PC (via serial port or via SSH), as shown previous sections in this article. Remember the default settings:
+
First of all, '''log in to IGEPv2''' with a console from your host PC (via serial port or via SSH), as shown previous sections in this article. Remember the default settings:
  
 
  login: root
 
  login: root
 
  password: (none: press return)
 
  password: (none: press return)
  
Once you are logged in IGEP0020, run the following commands:
+
Once you are logged in IGEPv2, run the following commands:
  
 
  cd /
 
  cd /
Line 350: Line 350:
 
  ./example.sh
 
  ./example.sh
  
You can edit this file (example.sh) with 'vi', the pre-installed text editor in IGEP0020.
+
You can edit this file (example.sh) with 'vi', the pre-installed text editor in IGEPv2.
  
 
  vi example.sh
 
  vi example.sh
Line 371: Line 371:
  
  
=== Send a file between a PC and IGEP0020 ===
+
=== Send a file between a PC and IGEPv2 ===
 
----
 
----
  
In a Linux host PC, you can use SCP (secure copy) via SSH to transfer files between IGEP0020 and your host PC.
+
In a Linux host PC, you can use SCP (secure copy) via SSH to transfer files between IGEPv2 and your host PC.
  
First of all, set an static IP to your Linux Host (for example, 192.168.6.3) and another IP within the subnet for IGEP0020 (for example, 192.168.6.2).
+
First of all, set an static IP to your Linux Host (for example, 192.168.6.3) and another IP within the subnet for IGEPv2 (for example, 192.168.6.2).
  
First of all, you check the connectivity (From IGEP0020 console):
+
First of all, you check the connectivity (From IGEPv2 console):
  
 
  ping 192.168.6.3
 
  ping 192.168.6.3
Line 384: Line 384:
 
Press CTRL-C to stop the command.
 
Press CTRL-C to stop the command.
  
Now let's transfer a file called original.file in your host PC to IGEP0020 in /home/root/
+
Now let's transfer a file called original.file in your host PC to IGEPv2 in /home/root/
  
 
In your Host PC open Terminal and type:
 
In your Host PC open Terminal and type:
Line 390: Line 390:
 
  scp -r original.file root@192.168.6.2:/home/root/destination.file
 
  scp -r original.file root@192.168.6.2:/home/root/destination.file
  
You can repeat the process from the IGEP0020 console, and transfer a file from IGEP0020 to your Host PC.
+
You can repeat the process from the IGEPv2 console, and transfer a file from IGEPv2 to your Host PC.
  
 
=== How to handle the gpio-LED's ===
 
=== How to handle the gpio-LED's ===
Line 399: Line 399:
 
| bgcolor="#cccccc" |'''Overview'''
 
| bgcolor="#cccccc" |'''Overview'''
 
|-
 
|-
| Using IGEP0020 LED's with the associated platform device at /sys/devices/platform/leds-gpio/leds/
+
| Using IGEPv2 LED's with the associated platform device at /sys/devices/platform/leds-gpio/leds/
 
|}
 
|}
  
IGEP0020 has many devices that can be controlled using '''simple instructions'''.
+
IGEPv2 has many devices that can be controlled using '''simple instructions'''.
  
 
In this tutorial, we are going to use the '''4 LED's available in the board''', which probably is the most simple feature in the board, but sometimes you may want LED's to be a way of checking the status of some of your applications.  
 
In this tutorial, we are going to use the '''4 LED's available in the board''', which probably is the most simple feature in the board, but sometimes you may want LED's to be a way of checking the status of some of your applications.  
Line 408: Line 408:
 
You can easily '''turn LED's on and off''' using the 'echo' instruction.
 
You can easily '''turn LED's on and off''' using the 'echo' instruction.
  
Log into IGEP0020 (via serial port or via SSH, as shown before), and run the following commands to turn LED's on:
+
Log into IGEPv2 (via serial port or via SSH, as shown before), and run the following commands to turn LED's on:
  
 
<pre>echo 1 &gt; /sys/devices/platform/leds-gpio/leds/d240\:green/brightness
 
<pre>echo 1 &gt; /sys/devices/platform/leds-gpio/leds/d240\:green/brightness
Line 473: Line 473:
 
| bgcolor="#cccccc" |'''Overview'''
 
| bgcolor="#cccccc" |'''Overview'''
 
|-
 
|-
| Follow the link to the extensive article: [[How_to_use_RS485_on_IGEP0020_board|How to use RS-485 on IGEP0020 board]]
+
| Follow the link to the extensive article: [[How_to_use_RS485_on_IGEP0020_board|How to use RS-485 on IGEPv2 board]]
 
|}
 
|}
  
Line 540: Line 540:
 
When ever you think you want to stop recording just press CTRL+C  
 
When ever you think you want to stop recording just press CTRL+C  
  
{{Navigation/IGEP Technology Guides/What can I do/Ending|device=IGEP0020}}
+
{{Navigation/IGEP Technology Devices Guides/Next Step
 +
|Name={{#lst:Template:Links|IGEPv2_Name}}
 +
|Community_MainPage={{#lst:Template:Links|IGEPv2_Community_MainPage}}
 +
|Next_Step=[[Start developing under IGEP Technology]]
 +
}}
  
 
[[Category:IGEP Technology Devices Guides]]
 
[[Category:IGEP Technology Devices Guides]]
 
[[Category:IGEP0020]]
 
[[Category:IGEP0020]]
 
[[Category:Work in progress]]
 
[[Category:Work in progress]]

Revision as of 19:08, 23 April 2012

'IGEPv2 - Part 2/3'
It is recommended that you follow the [[Getting started with IGEPv2|previous chapters]] of this guide before continuing with this tutorial.


link=IGEPv2
IGEPv2

  • IGEPv2 guides:
  1. [[Getting started with IGEPv2|Getting started]]
  2. [[What can I do with IGEPv2|What can I do with IGEPv2]]
  3. Start developing


IGEP Technology Devices Guides - Part 2/3 - Summary
link=IGEPv2
1) Booting up IGEPv2
2) Updating the pre-installed software
3) Flashing the latest firmware to the IGEPv2 flash memory
4) Connect to IGEPv2 via network interfaces
5) Basic instructions
6) Send a file between a PC and IGEPv2
7) Handle IGEPv2's
8) Mount a MicroSD card


Booting and setting up


Pre-installed software
By default, all brand new IGEP Processor Boards have a firmware installed on its flash memory.

That means that if you power up your board it will run a Linux distribution provided and installed by ISEE.


This distribution consists on a minimal Linux-based distribution with a lite X Window System and GNOME Mobile based applications created with Poky Platform Builder.

In the previous chapter of this tutorial, we have booted IGEPv2 with its pre-installed software.

Once the board has booted up, it asks for a login in the serial debug port. You can log in into IGEPv2 via the serial interface.


*The default login user is: root 
*There is no password for this user. 


Boot priority

In fact, IGEPv2 can boot from many other devices (listed by priority):

  1. from USB
  2. from UART3
  3. from a MMC/MicroSD card
  4. from OneNAND memory


As we haven't set any other boot device rather than the oneNAND (the IGEPv2 flash memory) the system boots from it.


But, as the MicroSD card has an upper priority than the flash, if you plug a MicroSD card (with the right configuration on it) to the MicroSD card reader, IGEPv2 will boot from it and won't boot from the flash memory.


Now, We are going to use this functionality to update your pre-installed software.


Updating the pre-installed software


Requirements - Overview
For this purpose, you will need:
  • a microSD card
  • a computer with microSD card reader (or with adapter)
  • a GNU/Linux distribution installed on the computer (a Linux partition or a virtual machine on Windows)
    • the main reason is that Windows does not detect multiple partitions on a microSD card
1) Download the latest firmware into an external computer.

2) Uncompress the downloaded file.

3) Create a MicroSD card in your external computer.

4) Plug the MicroSD card to IGEPv2 and boot from it.


We are now going to update the pre-installed software to the latest version.

(if you are familiar with Linux, there might be some instructions and comments you can ignore, as they are for Linux newbies)


1) Downloading the latest firmware

The first thing you'll need to do is to download the latest firwmare from ISEE.

At your Linux host PC you should open Terminal and type the following command:

wget http://downloads.igep.es/binaries/firmware/poky-firmware-3.3.1-10.tar.gz


2) Uncompressing the downloaded file

Now you have downloaded a compressed file with the latest official firmware into the current directory (.tar.gz).

Next, we will use the application 'tar' to untar (uncompress) the downloaded file. In the same Terminal session, type:

tar xzf poky-firmware-3.3.1-10.tar.gz

Next, you can go into the extracted directory with the system 'cd' instruction:

cd poky-firmware-3.3.1-10/


3) Create a MicroSD card

We are going to create the MicroSD card with the latest firmware. Before it, you have to know which 'device' is the MicroSD listed in the /dev/ directory, a directory where the detected devices are listed by the Linux system.

To know the device name, follow this instructions:

Insert your MicroSD card into the Linux host machine (the machine where you have downloaded the firmware).

In your Terminal session, run the following system command:

dmesg

This instruction will prompt all the system traces. If your MicroSD card has actually been detected by the system, the last lines of that prompt will correspond to the MicroSD card detection and mounting.

Check the MicroSD name and path, for example: /dev/sdb and remember it.

Now you can run the following script in the folder you have just extracted, and you will have to add some parameters. In your Terminal session, type:


./poky-media-create --mmc [device] --binary poky-image-sato-igep00x0-[timestamp].tar.gz --machine igep0020

where:

  • [device] is the SD card device name, for example: /dev/sdb
  • [timestamp] the parameter --binary is actually the name of another .tar.gz compressed file that you have already extracted in the previous steps. If you want to auto-complete the [timestamp] parameter, press TAB in the timestamp when writing the instruction and the system will write the name of the file automatically.


This instruction will last a few minutes. When the process ends, you will have a MicroSD card with the latest software on it.


4) Plug the MicroSD card

Therefore, you are ready to try it. Plug the MicroSD card into IGEPv2 and power up your board.

Flashing the software image


Now your IGEPv2 has the latest firmware running from MicroSD card.

But you might want to write the firmware to the flash memory, so you won't need the MicroSD card when booting the board. So let's do it.


Note: The following process is assuming that your host PC is connected to IGEPv2 via the Serial Debug port. If not, read the Serial Port instructions in the previous chapter of this tutorial.


Enter to IGEPv2 using:

* root as login name 
* an empty password

The software provided by ISEE has a script that flashes the content of your MicroSD Card to the flash memory in your IGEPv2.

You have to run this script, that is located at /opt/firmware directory. Open a Terminal and run:

cd /opt/firmware
./flash.sh

This will last a few minutes. When it is ready, unplug the SD card from IGEPv2 and reboot the board:

reboot

Enjoy the new firmware running from flash memory.

Other references: update your pre-installed software image


Connect to IGEPv2 via network interfaces


Overview
1) Plug an ethernet cable to IGEPv2

2) Connect via ethernet network, SSH: root@192.168.x.x

3) Connect via wireless network, SSH: IGEP_WLAN at root@192.168.x.x

You can log into IGEPv2 via many interfaces with network connectivity, such ethernet, wifi, usb-ethernet gadget, etc.

In this tutorial we are going to connect via an ethernet cable. To to that, you need to set an IP in IGEPv2 (host) and start a SSH session in your PC (client). Let's do it.

First of all, you will need:

  • an Ethernet cable
  • a Linux or a Windows host PC


Log into IGEPv2 via the serial cable to the serial debug port in IGEPv2, as you have done in the previous chapter of this tutorial guide.

Once you are logged in, run the following command:

ifconfig

This will list all the enabled network interfaces in your IGEPv2.

We are going to focus on 'eth0'. This is the ethernet interface in your IGEPv2, which is the interface we will connect to from our host PC.

Connect the ethernet cable between your host PC and IGEPv2 (or through any wired network such switch).

Now, let's set an static IP to this interface in IGEPv2, so we will be able to reach the target from the PC.

Type the following command in your serial console:

ifconfig eth0 192.168.6.2


Next, set an IP within the subnet in your host PC, for example: 192.168.6.3

Then, run a SSH client such Putty and start a SSH session to the target from your host PC.

You can download it from its official page at: http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html

Install and run Putty. It will look like this:

Putty ssh.png
  1. Select the SSH at connection type.
  2. Next insert the IP address of the target. In this case, the IGEPv2 IP you have already set (192.168.6.3).
  3. Ensure that the port is set to 22, the default for SSH communications.
  4. Finally, push the Open button to start the SSH session.


If everything goes right, you will be able to access to an IGEPv2 console from your PC via ethernet.

Basic instructions


Overview
Learn some Bash basic instructions in Linux (for newbies).

1) Create, edit, move and delete files

2) Run a simple script

IGEPv2 is compatible with many Linux distributions. In this tutorial we are using Poky Linux, which is the pre-installed software from ISEE.

In case you are not familiar with Bash instructions, here comes some basic instructions to help you startup with the board.

First of all, log in to IGEPv2 with a console from your host PC (via serial port or via SSH), as shown previous sections in this article. Remember the default settings:

login: root
password: (none: press return)

Once you are logged in IGEPv2, run the following commands:

cd /
ls

You have moved to the root directory, that is "/". The instruction "ls" lists all the existing files and directories in the current "path".

Now let's go to the directory /home/root/ with:

cd /home/root/

You can always check at which directory you are with the instruction:

pwd

Most instructions include a 'help' option that can be accessed by inserting the parameter --help. Check out the help page of 'echo' instruction, for example:

echo --help

You can try the instruction by yourself and type:

echo Hello

You have sent the text "Hello" to the standard output, that is the console you are interacting with.

But you can change and 'redirect' the output by using the character '>' :

echo Hello world! > /home/root/name.file

Now notice you have redirected the output to a file called name.file :

ls

You can append any file using '>>' instead of '>'. You can print the content of the file to the standard output:

cat /home/root/name.file

Building a basic script

You can create a script that can run any instruction you want to use in Bash. The main advantage is that you do not have to compile the code, as is auto-interpereted by the system.

We are going to create a basic 'Hello World' script that is going to run the same command you have actually used before:

echo "echo > Hello world!" > /home/root/example.sh
cat example.sh

Now you have created a file called example.sh, but by default it has no execute permissions (x):

ls -la

We are going to add permission to the file by:

chmod a+x example.sh
ls -la

Now you can run the script:

./example.sh

You can edit this file (example.sh) with 'vi', the pre-installed text editor in IGEPv2.

vi example.sh

Press ESC and:

  •  :q! , to exit without saving
  •  :w , to save
  •  :wq , to quit and save
  • i , to insert text

Other simple & useful instructions

  • mkdir
  • rmdir
  • find
  • grep

You can stop any instruction by pressing CTRL+C


Send a file between a PC and IGEPv2


In a Linux host PC, you can use SCP (secure copy) via SSH to transfer files between IGEPv2 and your host PC.

First of all, set an static IP to your Linux Host (for example, 192.168.6.3) and another IP within the subnet for IGEPv2 (for example, 192.168.6.2).

First of all, you check the connectivity (From IGEPv2 console):

ping 192.168.6.3

Press CTRL-C to stop the command.

Now let's transfer a file called original.file in your host PC to IGEPv2 in /home/root/

In your Host PC open Terminal and type:

scp -r original.file root@192.168.6.2:/home/root/destination.file

You can repeat the process from the IGEPv2 console, and transfer a file from IGEPv2 to your Host PC.

How to handle the gpio-LED's


Overview
Using IGEPv2 LED's with the associated platform device at /sys/devices/platform/leds-gpio/leds/

IGEPv2 has many devices that can be controlled using simple instructions.

In this tutorial, we are going to use the 4 LED's available in the board, which probably is the most simple feature in the board, but sometimes you may want LED's to be a way of checking the status of some of your applications.

You can easily turn LED's on and off using the 'echo' instruction.

Log into IGEPv2 (via serial port or via SSH, as shown before), and run the following commands to turn LED's on:

echo 1 > /sys/devices/platform/leds-gpio/leds/d240\:green/brightness
echo 1 > /sys/devices/platform/leds-gpio/leds/d240\:red/brightness
echo 1 > /sys/devices/platform/leds-gpio/leds/d440\:green/brightness
echo 1 > /sys/devices/platform/leds-gpio/leds/d440\:red/brightness

You can turn them down using the same command and write '0' instead of '1'.

Other functionalities

If you want to trigger the leds you can enable this mode and select the trigger source (none by default) to: mmc0, mmc1, timer, heartbeat and default-on.

To enable any of this modes you just have to change a parameter in the directory of the led you want to control. You can see all the possibilities using the instruction 'cat':

$   cat /sys/devices/platform/leds-gpio/leds/d240\:green/trigger

[none] mmc0 mmc1 timer heartbeat default-on

In the example above, we have checked the status of the trigger in led D240:green. Mode 'none' is selected.

To change it, for example, to the timer mode you can use 'echo':

echo timer > /sys/devices/platform/leds-gpio/leds/d240\:green/trigger

In this case, we have set the trigger to the 'timer' mode. Now you can set the time for what the led is ON and the time it is OFF using:

echo 250 > /sys/devices/platform/leds-gpio/leds/d240\:green/delay_on
echo 750 > /sys/devices/platform/leds-gpio/leds/d240\:green/delay_off

Now the selected led is configured with a timer consisting of 250 miliseconds ON and 750 miliseconds OFF.


Mount a MicroSD card


(Work in progress section!)

Access to Generic FAT32 microSD

mount -t vfat /dev/mmcblk0 /mnt/tmp/

Access to Generic USB Flash disk

mount -t vfat /dev/sda1 /mnt/tmp/

Safety Remove microSD

umount /mnt/tmp

Access to IGEP demo microSD

mount -t jffs2 /dev/mmcblk0 /mnt/tmp/

How to use RS-485


Overview
Follow the link to the extensive article: How to use RS-485 on IGEPv2 board


How to get sound out (audio out)


Overview
Use: aplay

The amplifiers for the headset output are disabled by default, so the first thing you'll do is enable these amplifiers with:

amixer set -D hw:0 'Headset' 0dB
amixer set -D hw:0 'HeadsetL Mixer AudioL2' on
amixer set -D hw:0 'HeadsetR Mixer AudioR2' on

Then you can easily play a *.wav sound with the application Aplay, for example:

aplay sample.wav

How to get sound in (audio in)

Overview
Use: arecord

You can record audio in with the application Arecord, for example:

arecord -t wav -c 2 -r 44100 -f S16_LE -v audio-in.wav

Following output is expected on console:

Recording WAVE 'audio-in.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Plug PCM: Hardware PCM card 0 'TWL4030' device 0 subdevice 0
Its setup is:
stream       : CAPTURE
access       : RW_INTERLEAVED
format       : S16_LE
subformat    : STD
channels     : 2
rate         : 44100
exact rate   : 44100 (44100/1)
msbits       : 16
buffer_size  : 32768
period_size  : 2048
period_time  : 46439
tick_time    : 7812
tstamp_mode  : NONE
period_step  : 1
sleep_min    : 0
avail_min    : 2048
xfer_align   : 2048
start_threshold  : 1
stop_threshold   : 32768
silence_threshold: 0
silence_size : 0
boundary     : 1073741824

When ever you think you want to stop recording just press CTRL+C

Continue with this tutorial at: [[Start developing under IGEP Technology]]