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

From IGEP - ISEE Wiki

Jump to: navigation, search
m (Update your pre-installed software)
m (Flash the latest software image)
Line 23: Line 23:
 
== Handle the gpio-LED's ==
 
== Handle the gpio-LED's ==
 
{{#lst:How to handle the gpio-LED|IGEPv2}}
 
{{#lst:How to handle the gpio-LED|IGEPv2}}
 
== Flash the latest software image ==
 
 
{{:How to flash the latest software image}}
 
 
 
''' Know more '''
 
 
IGEPv2 can run many other software distributions. Check the [[:Category:Software distributions]] to learn how to install other distributions.
 
  
 
== Basic instructions ==
 
== Basic instructions ==

Revision as of 16:10, 28 August 2012



Overview

This is the 2/3 chapter of IGEPv2 Tutorial Guide.

We will learn some basic tasks such to send a file between IGEPv2 and your PC , handle the IGEPv2 Leds, update the pre-installed software to the latest release, etc.


What can I do

Handle the gpio-LED's

Basic

Log into IGEPv2 (for example via SSH, as shown in the previous chapter), 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'.


Know more

IGEPv2 LED's are controlled with it's platform device at /sys/devices/platform/leds-gpio/leds/

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.


Basic instructions

IGEP Boards are compatible with many Linux distributions. In this tutorial we are using IGEP firmware Yocto, 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 IGEP 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)

Bash Useful Instructions

Once you are logged in IGEP, 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 IGEP.

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


Mount a MicroSD card

Basic

Log into IGEPv2 and run any of the following commands:

  • 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

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


Get sound in (audio in)

Basic

External Audio input devices, such as a powered microphone or the audio output of a PC or MP3 player, can be connected to the via a 3.5mm jack (Audio IN).

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


Get sound out (audio out)

Basic

Connect an external output audio device to the 3.5mm jack Audio Out connector in IGEPv2, such as external stereo powered speakers.

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 audio-in.wav


Connect to the Serial Debug interface

Basic

AT/Everex Cable connected to the 10-pin serial header on IGEPv2

In the preinstalled software, the serial port is configured as a Debug interface.

Therefore, if you connect an external device to the serial port you will be able to see the Linux Kernel traces, as the system boots.


Follow these steps:

  • Connect an AT/Everex Cable to the 10-pin serial header on IGEPv2 and a null modem DB9 male-male serial cable between the board and your host machine.
  • You can also use a Serial port in your host machine you might need a USB to Serial converter to communicate via this port.
  • Run a serial console, or any program that can interact with the serial port in your host machine, such Minicom, PuTTy (Linux, Windows), Terminal (Windows), etc.


Now, as you are connected to the serial debug port, you will see the system traces as the board is starting up.

Finally you will see the boot prompt asking for login.


IGEPv2 Serial Debug interface prompt




You have successfully completed this chapter of the guide.


Continue this tutorial guide: 3/3 - Start developing under IGEP Technology
Igep forum.png If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat Irc.png