User:Pau pajuelo

From IGEP - ISEE Wiki

Revision as of 16:02, 8 August 2012 by Pau (talk | contribs)

Jump to: navigation, search

TODO:

Update peripheral tutorials

Categorize new tutorials

Upgrade ethernet gadget tutorial for new IGEP firmware and VM

Finish tutorials below

NOTES: Qt, Codeblocks and Eclipse are linked to main page:

Eclipse -> How to develop under Eclipse (copy manual) (refers at beginning VM and option to install Eclipse(under construction))

Qt -> How to develop under Qt (refers at begginin VM and option to install Qt (under construction))

Codeblocks (do it)


Adapt IGEPv2 to IGEPv2 Expansion

How to use SPI (prove with new firmware, under construction)

Overview

This How-To is meant to be a starting point for people to learn use SPI for IGEP devices as quickly and easily as possible. In this how-to, we run an example program that reads and writes registers from 3-axis accelerometer (LIS3DH) included on the board IGEP New York.

Requirements

There are some requisites to follow this guide:

  • IGEP SDK VM: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 2.3 "Setting up and running the VM")
  • IGEP Firmware: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 6.1 "Create IGEP firmware bootable micro-sd card")
  • IGEP COM MODULE and IGEP NEW YORK
  • SPI example program (link program)
  • MicroSD Card (at least 2Gbytes)

How Works

LIS3DH accelerometer: It is the accelerometer mounted in IGEP New York.

Omap3 SPI Peripheral: It is the hardware used to communicated with accelerometer and other SPI devices.

Omap2_mcspi: It is a bus driver than controls Omap3 SPI Peripheral.

Spi: It is a protocol driver that defines functions and strucs used in SPI bus.

Spidev: It is a device driver that export spi driver functionalities to userspace.

Lis3lv02d_spi: SPI glue layer for lis3lv02d

Lis31v02d: Device driver for LIS3DH accelerometer.

Exp_ilms0015: It is a startup program for IGEP New York. It attach lis31v02d with Spi driver.

Spi linux schematic.png


More information about Linux Kernel SPI at:

Prepare Micro SD Card

Generate Micro SD Card

Open a terminal and use the following steps to download and generate a Micro SD card.

wget http://downloads.isee.biz/denzil/binary/igep_firmware-yocto-1.2.1-1.tar.bz2 
tar jxf igep_firmware-yocto-*.tar.bz2
cd igep_firmware-yocto-* 

Insert a SD-Card media and use the igep-media-create script to copy the firmware.

./igep-media-create -–mmc <mmc> --image demo-image-sato-igep00x0.tar.bz2 --machine igep0030

where <mmc> - is the SD-Card device of your computer. For example, assuming the SD-card device takes '/dev/sdb' type:

./igep-media-create --mmc /dev/sdb --machine igep0030 --image demo-image-sato-igep00x0.tar.bz2 

This should give you a bootable SD-card with IGEP COM MODULE support.

NOTE: Use the following tutorial (upgrade it) to connect via Ethernet Gadget with IGEP COM MODULE

Custom Micro SD Card

"Include clone git commands"

Modify Linux Kernel Sources to attach Spidev to SPI driver

To read accelerometer registers from spidev, we need to attach spidev driver to spi driver at start up. So it is necessary to modify spi_board.

Go to $(Kernel path)/arch/arm/mach-omap2/exp-ilms0015.c and edit the next fields in bold words.

static struct spi_board_info lis3lv02d_spi_board_info __initdata = {

    .modalias = "spidev",

    //.modalias    = "lis3lv02d_spi",

    .bus_num    = -EINVAL,

    .chip_select    = -EINVAL,

    .max_speed_hz    = 1*1000*1000,

    .irq        = -EINVAL,

    .mode        = SPI_MODE_0,

   //.platform_data    = &lis3lv02d_pdata,

};

inline void __init ilms0015_lis3lv02d_init(int bus_num, int cs, int irq)

{

    struct spi_board_info *spi = &lis3lv02d_spi_board_info;

    if ((gpio_request(irq, "LIS3LV02D IRQ") == 0)

        && (gpio_direction_input(irq) == 0))

        gpio_export(irq, 0);

    else {

        pr_err("IGEP: Could not obtain gpio LIS3LV02D IRQ\n");

        return;

    }

    spi->bus_num = bus_num;

    spi->chip_select = cs;

    spi->irq = OMAP_GPIO_IRQ(irq),

    spi_register_board_info(&lis3lv02d_spi_board_info, 1);

}

...

void __init ilms0015_init(void)

{

    mux_partition = omap_mux_get("core");

    /* Mux initialitzation for ilms0015 */

    omap_mux_write_array(mux_partition, ilms0015_mux);

    /* 3-axis accelerometer */

    ilms0015_lis3lv02d_init(1, 2, 174);

    /* Export some GPIO */

    ilms0015_gpio_init();

}

Now spi_register_board_info has all information necessary to attach spidev driver instead lis3lv02d_spi.

Once we edit code, compile your modified Kernel, you can follow this tutorial for this purpose.

Enable ilms0015 support

“ilms0015” is the technical name of IGEP New York.

By default, poky-media-create (See: Poky firmware with Kernel 2.6.37.y) configured as igep0030, gives support only for IGEP Expansions Paris and Berlin. We need to configure igep.ini and gives support to IGEP New York:

 ; Machine configuration

    ;buddy=base0010 buddy.revision=B

    buddy=ilms0015

Test changes

Once you copy your new Kernel binaries and edit igep.ini. Power up your board, log in and check your changes:

root@igep00x0:/dev# lsmod

Module                  Size    Used by

rfcomm                48522   0

hidp                    13311   0

l2cap                   49001   4 rfcomm,hidp

bluetooth             67643   3 rfcomm,hidp,l2cap

libertas_sdio         13887   0

libertas                99318   1 libertas_sdio

option                 13044   0

usb_wwan              7196   1 option

usbserial              23870   2 option,usb_wwan

spidev                  4898   0 

root@igep00x0:/dev# ls /dev/spidev1.2

/dev/spidev1.2

“spidev1.2”: refers at McSPI1 bus 2. Now we can communicate to accelerometer using spi driver functions.

SPI Test program

Overview

This program is based in spidev_test and it was edited to run with LIS3DH accelerometer, program can be explained in four parts:

Connection properties: program lets change via parameters SPI configurations like: device, max speed, delay, bits per word, clock phase, clock polarity, etc. If you don't use any of this parameters program will use default options for LIS3DH communication.

Read mode: Reads a word from a register.

Write mode: Writes a word in a register.

Test mode: Reads X, Y and Z axes from accelerometer.

We recommend to read peripheral datasheet before use or modify program.

Compile program

The program source was compiled with Poky SDK but you can use other compilers like Linaro Toolchain:

arm-poky-linux-gnueabi-gcc spiexamplebeta2.c -o spiexampleb2  

Copy your final binary to rootfs.

Test program

Read WHO_AM_I register(0Fh)

LIS3DH has this dummy register (See 8.6 chapter) as a device identification. Its value is 0x33:

root@igep00x0:~# ./spiexampleb2 -R 0F 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 0F is: 33 
root@igep00x0:~#  

Read and Write CTRL_REG1 (20h)

This register is used to enable/disable: accelerometer and XYZ axes (See 8.8 chapter). The default value at startup is:

root@igep00x0:~# ./spiexampleb2 -R 20 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 20 is: 07 
root@igep00x0:~#  

It means that accelerometer was disabled and X, Y and Z axes was enabled. For example we can disable X axe typing:

root@igep00x0:~# ./spiexampleb2 -W 20 -V 06 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Register to write 20 with value 06 
root@igep00x0:~# ./spiexampleb2 -R 20      
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 20 is: 06 
root@igep00x0:~# 

Read accelerometer axes

Finally we are going to read gravity force: LIS3DH has ±2g/±4g/±8g/±16g dynamically selectable full scale (See chapter 8.11). The axes values are expressed in two’s complement in 16 bits (See chapters 8.16, 8.17 and 8.18). Lis3dhxyzaxes.png
root@igep00x0:~# ./spiexampleb2 -T 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Accelerometer TEST 
Values from X -64, Values from Y -15872 and Values from Z -256 
root@igep00x0:~# 

The next table shows results at different positions:

Position ±2g scale ±4g scale ±8g scale ±16g scale
NYtopimagetest.png
X = 832

Y = 1024

Z = 15680

X = 256

Y = 128

Z = 7872

X = 128

Y = 128

Z = 4032

X = 64

Y = 128

Z = 1280

NYbotimagetest.png

X = 256

Y = 704

Z = -17216

X = 256

Y = 256

Z = -8320

X = 64

Y = 128

Z = -4096

X = 128

Y = 128

Z = -1344

NYtophoritzontalimagetest.png

X = -15872

Y = 64

Z = -320

X = -7936

Y = 64

Z = -512

X = -3968

Y = 128

Z = -192

X = -1280

Y = 64

Z = -128

NYbothoritzontalimagetest.png

X = 16448

Y = 640

Z = 640

X = 8128

Y = 192

Z = 384

X = 4032

Y = 64

Z = 64

X = 1344

Y = 64

Z = 192

NYtopverticalimagetest.png

X = 896

Y = 16512

Z = -576

X = 320

Y = 8128

Z = -128

X = 192

Y = 4096

Z = -64

X = 128

Y = 1344

Z = -128

NYbotverticalimagetest.png

X = -64

Y = -15872

Z = -256

X = -512

Y = -7808

Z = -384

X = -64

>Y = -3840

Z = -384

X = -128

Y = -1216

Z = -128

BACKUP How to use SPI (prove with new firmware, under construction)

Overview

This How-To is meant to be a starting point for people to learn use SPI for IGEP devices as quickly and easily as possible. In this how-to, we run an example program that reads and writes registers from 3-axis accelerometer (LIS3DH) included on the board IGEP New York.

Requirements

There are some requisites to follow this guide:

  • IGEP SDK VM: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 2.3 "Setting up and running the VM")
  • IGEP Firmware: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 6.1 "Create IGEP firmware bootable micro-sd card")
  • IGEP COM MODULE and IGEP NEW YORK
  • SPI example program (link program)
  • MicroSD Card (at least 2Gbytes)

How Works

LIS3DH accelerometer: It is the accelerometer mounted in IGEP New York.

Omap3 SPI Peripheral: It is the hardware used to communicated with accelerometer and other SPI devices.

Omap2_mcspi: It is a bus driver than controls Omap3 SPI Peripheral.

Spi: It is a protocol driver that defines functions and strucs used in SPI bus.

Spidev: It is a device driver that export spi driver functionalities to userspace.

Lis3lv02d_spi: SPI glue layer for lis3lv02d

Lis31v02d: Device driver for LIS3DH accelerometer.

Exp_ilms0015: It is a startup program for IGEP New York. It attach lis31v02d with Spi driver.

Spi linux schematic.png


More information about Linux Kernel SPI at:

Attach Spidev to SPI driver

Modify Linux Kernel Sources

To read accelerometer registers from spidev, we need to attach spidev driver to spi driver at start up. So it is necessary to modify spi_board.

Go to $(Kernel path)/arch/arm/mach-omap2/exp-ilms0015.c and edit the next fields in bold words.

static struct spi_board_info lis3lv02d_spi_board_info __initdata = {

    .modalias = "spidev",

    //.modalias    = "lis3lv02d_spi",

    .bus_num    = -EINVAL,

    .chip_select    = -EINVAL,

    .max_speed_hz    = 1*1000*1000,

    .irq        = -EINVAL,

    .mode        = SPI_MODE_0,

   //.platform_data    = &lis3lv02d_pdata,

};

inline void __init ilms0015_lis3lv02d_init(int bus_num, int cs, int irq)

{

    struct spi_board_info *spi = &lis3lv02d_spi_board_info;

    if ((gpio_request(irq, "LIS3LV02D IRQ") == 0)

        && (gpio_direction_input(irq) == 0))

        gpio_export(irq, 0);

    else {

        pr_err("IGEP: Could not obtain gpio LIS3LV02D IRQ\n");

        return;

    }

    spi->bus_num = bus_num;

    spi->chip_select = cs;

    spi->irq = OMAP_GPIO_IRQ(irq),

    spi_register_board_info(&lis3lv02d_spi_board_info, 1);

}

...

void __init ilms0015_init(void)

{

    mux_partition = omap_mux_get("core");

    /* Mux initialitzation for ilms0015 */

    omap_mux_write_array(mux_partition, ilms0015_mux);

    /* 3-axis accelerometer */

    ilms0015_lis3lv02d_init(1, 2, 174);

    /* Export some GPIO */

    ilms0015_gpio_init();

}

Now spi_register_board_info has all information necessary to attach spidev driver instead lis3lv02d_spi.

Once we edit code, compile your modified Kernel, you can follow this tutorial for this purpose.

Enable ilms0015 support

“ilms0015” is the technical name of IGEP New York.

By default, poky-media-create (See: Poky firmware with Kernel 2.6.37.y) configured as igep0030, gives support only for IGEP Expansions Paris and Berlin. We need to configure igep.ini and gives support to IGEP New York:

 ; Machine configuration

    ;buddy=base0010 buddy.revision=B

    buddy=ilms0015

Test changes

Once you copy your new Kernel binaries and edit igep.ini. Power up your board, log in and check your changes:

root@igep00x0:/dev# lsmod

Module                  Size    Used by

rfcomm                48522   0

hidp                    13311   0

l2cap                   49001   4 rfcomm,hidp

bluetooth             67643   3 rfcomm,hidp,l2cap

libertas_sdio         13887   0

libertas                99318   1 libertas_sdio

option                 13044   0

usb_wwan              7196   1 option

usbserial              23870   2 option,usb_wwan

spidev                  4898   0 

root@igep00x0:/dev# ls /dev/spidev1.2

/dev/spidev1.2

“spidev1.2”: refers at McSPI1 bus 2. Now we can communicate to accelerometer using spi driver functions.

SPI Test program

Overview

This program is based in spidev_test and it was edited to run with LIS3DH accelerometer, program can be explained in four parts:

Connection properties: program lets change via parameters SPI configurations like: device, max speed, delay, bits per word, clock phase, clock polarity, etc. If you don't use any of this parameters program will use default options for LIS3DH communication.

Read mode: Reads a word from a register.

Write mode: Writes a word in a register.

Test mode: Reads X, Y and Z axes from accelerometer.

We recommend to read peripheral datasheet before use or modify program.

Compile program

The program source was compiled with Poky SDK but you can use other compilers like Linaro Toolchain:

arm-poky-linux-gnueabi-gcc spiexamplebeta2.c -o spiexampleb2  

Copy your final binary to rootfs.

Test program

Read WHO_AM_I register(0Fh)

LIS3DH has this dummy register (See 8.6 chapter) as a device identification. Its value is 0x33:

root@igep00x0:~# ./spiexampleb2 -R 0F 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 0F is: 33 
root@igep00x0:~#  

Read and Write CTRL_REG1 (20h)

This register is used to enable/disable: accelerometer and XYZ axes (See 8.8 chapter). The default value at startup is:

root@igep00x0:~# ./spiexampleb2 -R 20 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 20 is: 07 
root@igep00x0:~#  

It means that accelerometer was disabled and X, Y and Z axes was enabled. For example we can disable X axe typing:

root@igep00x0:~# ./spiexampleb2 -W 20 -V 06 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Register to write 20 with value 06 
root@igep00x0:~# ./spiexampleb2 -R 20      
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Value from 20 is: 06 
root@igep00x0:~# 

Read accelerometer axes

Finally we are going to read gravity force: LIS3DH has ±2g/±4g/±8g/±16g dynamically selectable full scale (See chapter 8.11). The axes values are expressed in two’s complement in 16 bits (See chapters 8.16, 8.17 and 8.18). Lis3dhxyzaxes.png
root@igep00x0:~# ./spiexampleb2 -T 
spi mode: 0 
bits per word: 8 
max speed: 1000000 Hz (1000 KHz) 
Accelerometer TEST 
Values from X -64, Values from Y -15872 and Values from Z -256 
root@igep00x0:~# 

The next table shows results at different positions:

Position ±2g scale ±4g scale ±8g scale ±16g scale
NYtopimagetest.png
X = 832

Y = 1024

Z = 15680

X = 256

Y = 128

Z = 7872

X = 128

Y = 128

Z = 4032

X = 64

Y = 128

Z = 1280

NYbotimagetest.png

X = 256

Y = 704

Z = -17216

X = 256

Y = 256

Z = -8320

X = 64

Y = 128

Z = -4096

X = 128

Y = 128

Z = -1344

NYtophoritzontalimagetest.png

X = -15872

Y = 64

Z = -320

X = -7936

Y = 64

Z = -512

X = -3968

Y = 128

Z = -192

X = -1280

Y = 64

Z = -128

NYbothoritzontalimagetest.png

X = 16448

Y = 640

Z = 640

X = 8128

Y = 192

Z = 384

X = 4032

Y = 64

Z = 64

X = 1344

Y = 64

Z = 192

NYtopverticalimagetest.png

X = 896

Y = 16512

Z = -576

X = 320

Y = 8128

Z = -128

X = 192

Y = 4096

Z = -64

X = 128

Y = 1344

Z = -128

NYbotverticalimagetest.png

X = -64

Y = -15872

Z = -256

X = -512

Y = -7808

Z = -384

X = -64

>Y = -3840

Z = -384

X = -128

Y = -1216

Z = -128

How to install Qt Creator (under construction)

How to install Eclipse (under construction)

Getting started with IGEPv2 Expansion


Contents

Overview

This is the 1/3 chapter of IGEPv2 Expansion Tutorial Guide.

In this first chapter, we will learn how to connect some expansion peripherals.

Requirements

In this tutorial we are going to use the following peripherals:

  • IGEPv2, +5V DC power supply, Ethernet cable and a PC with Linux or Windows.
  • Powertrip 4.3" or Seiko 7" screen if you need a touch screen.
  • DB9 connector and USB serial conversor to follow serial communication tutorial
  • 4 pin connector for CAN Bus with another IGEPv2 and Expansion to follow CAN Bus communication tutorial
  • SIM card with an optional Antenna to follow Telit model tutorial
  • Composite video cable with a composite video output (PAL or NTSC) peripheral to follow TVP5151 tutorial

Getting started

Connect IGEPv2 Expansion with IGEPv2 Board

Basic

The IGEPv2 Expansion connects to the IGEPv2 Board through J990, JA41, JA42, JC30 and J960 connectors. Some IGEPv2 Expansion may include three jumpers, you should remove it because they are designed for test and lab purposes. Just take a look on the figure below to mount it:

Igepv2expconnectoigepv2.PNG
Igepv2expconnectoigepv2 2.PNG

TFT and Touchscreen

Basic

IGEP0022 PROTO RA DSC 0142.JPG
IGEPv2 Expansion integrates a LCD backlight driver (Texas instruments TPS61081) and touch screen controller (Texas instruments TSC2046), 4-wire touch screen controller which supports a low-voltage I/O interface which can be directly connected to a SEIKO 7” LCD or to a POWERTIP 4.3” LCD. Use J301 connector for POWERTRIP 4.3" or use J302, J303 and J304 connector for SEIKO 7".

Know more

IGEPv2 Expansion integrates LCD backlight driver (TPS61081) and touch screen controller (TSC2046), a 4-wire touch screen controller which supports a low voltage I/O interface from 1.5V to 5.25V.

Serial port

Basic
Igepv2expdb9connector.PNG

IGEPv2 Expansion integrates a DB9 RS232 connector. Plug a DB9 cable.

Know more

This peripheral (UART1) can be used to debug system using kernel traces, getting a remote prompt, etc.


VGA monitor

Basic 

Igepv2expconnecttovga.jpg Igepv2expvgaconnector.PNG

IGEPv2 Expansion integrates a VGA connector, the output VGA signal is equal to HDMI connector. Plug a monitor with VGA input.


Know more

This output is controled by ADV7125KSTZ140 Integrated Circuit.




CAN bus

Basic

Igepv2expcanconnector.PNG
IGEPv2 Expansion integrates a CAN peripheral. Connect any CAN bus device or network to the CAN bus connector (J703).

Know more

This output is controled by MICROCHIP MCP2515. J703 is a 3.5 mm pitch terminal blocks 4 Positions:

Signal Name Pin #
Description
VDD_CAN J703:1 Supply Voltage (+5V DC)
CANL J703:2 CAN Low-Level Voltage I/O
GND J703:3 Ground
CANH J703:4 CAN High-Level Voltage I/O

GSM/GPRS modem

Basic

IGEPv2 Expansion integrates a GSM/GPRS modem to make phone calls or to send SMS or to write and read data from it, etc. This peripheral needs:

Igepv2expcardreader.PNG
IGEP0022 Modem with antenna.png
SIM card GSM-GPRS antenna (optional)

Know more Modem chip Telit GE865 is a small GSM/GPRS Ball-Grid-Array BGA module with next main features:

  • Quad-band EGSM 850 / 900 / 1800 / 1900 MHz
  • Power consumption (typical values)

    - Power off: ‹ 62 uA
    - Idle (registered, power saving): 1.6 mA @ DRX=9

Composite Video Decoder

Basic

Igepv2expvideocompositeconnector.PNG
IGEPv2 Expansion integrates two composite video connectors to decode analog input signal. Plug some peripheral with video composite output.

Know more

Analog input is decoded by TVP5151.


----


You have successfully completed this chapter of the guide.


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


What can i do with igepv2 expansion



Overview

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

We will learn some basic tasks such add support to IGEPv2 Expansion, control some peripherals, etc.


What can I do

How to use Serial communication (DB9 connector)

Basic

RS232 link for UART1 (/dev/ttyO2) can be obtained through J502 DB9 connector. You can use PuTTy to get a shell prompt to IGEP:

  • Power up IGEPv2
  • Open PuTTy.
  • Choose Serial line. If you are running PuTTy on Windows, the Serial line will be like (COM1 or COM2 or COM3, etc.). If you are running PuTTy on Ubuntu, the Serial line will be like (/dev/ttyS0 or /dev/ttyS1 or /dev/ttyS3, etc.). Note that if you are using a USB->Serial converter, the Serial line will be like /dev/ttyUSB0
  • Configure Speed to 115200
  • Select Serial Connection type
  • Press on Open button
  • You will successfully started the console.
IGEPV2EXPCHMDB9.png Remoteshellpromptdb9putty.jpg

Know more

Read this tutorial to learn about UARTs.

How to use TFT and Touchscreen

Seiko 7.0 inch WVGA (800 x RGB x 480) TFT:

Add the following line to igep.ini

omapdss.def_disp=lcd-70

Powertip 4.3 inch (480 x RGB x 272) TFT:

Add the following line to igep.ini

omapdss.def_disp=lcd-43


You should reboot your IGEP Device to enable a new resolution configuration.


To configure the touchscreen, add "Configured Touchscreen" in "ServerLayout" section and remove "Configured Mouse" in /etc/X11/xorg.conf

Section "ServerLayout"
Identifier    "Default Layout"
Screen        "Default Screen"
InputDevice    "Generic Keyboard"
#   InputDevice    "Configured Mouse"
InputDevice    "Configured Touchscreen"
Option         "AllowEmptyInput" "no"
EndSection

calibrate it yourself until you are happy with the result, for example:

/etc/init.d/xserver-nodm stop
TSLIB_CALIBFILE=/etc/pointercal TSLIB_TSDEVICE=/dev/input/touchscreen0 TSLIB_CONSOLEDEVICE=none ts_calibrate
/etc/init.d/xserver-nodm start

How to use Telit Modem

The IGEP0022 expansion board provides a Telit GE865 GSM/GPRS modem which is connected to the OMAP via some GPIO pins and UART 2.

Here you have the official manuals from the manufacturer's webpage:


Here there are a few instructions in order to introduce the Telit modem.

If this is your first time accessing Telit Modem, check J402 and J403 jumpers are not connected before follow this tutorial. If you don't have these jumpers, don't worry because their functions are only for testing.

Insert a valid SIM card to the SIM card reader of your IGEP0022.

Now, you must add the following line at the kernel file (igep.ini) in order to enable GE865 support:

buddy.modem=yes


Now its time to power up your modem. You may read the Official manufacturer Hardware User Guide, where there is a complete explanation about the sequence.

In IGEP0022, the modem is connected to 3 GPIO pins from the OMAP, which are: <omap_pin_name (modem_function)>

  • GPIO_140 (Reset)
  • GPIO_141 (On_Off)
  • GPIO_156 (PWRMON)

You can power up your modem using the following sequence:

(Note: the following instructions are correctly 'toggled' do to pull-up resistors. Refer to schematics at the Official IGEP0022 Hardware Manual from ISEE)

echo 0 > /sys/class/gpio/gpio140/value
echo 1 > /sys/class/gpio/gpio141/value
sleep 1
echo 0 > /sys/class/gpio/gpio141/value

Once the modem is on, you can interact with it via UART 2. You can use Microcom to comunicate with it from the serial debug console:

microcom -s 115200 /dev/ttyS1

(Note: GE865 has auto baud rate detection, so you can use a different speed)

To check the modem status use the command:

at

Answer should be OK.

Note: correcting syntax with 'backspace' may cause error in a serial command if you are not writing the command at first take. Don't type <> when use the following commands

In order to use your GSM/GPRS you should connect the antenna as it is explained in the Getting Started with IGEP0022 article.

Now unlock it by inserting your SIM card PIN number. Use the command:

at+cpin=<PIN>

If you correctly inserted the PIN number, the answer should be OK.

(Note: If you fail more than 3 times, your SIM card will lock and you will have to insert PUK number.)

Now you are ready to use the GSM/GPS modem.

Examples

If you successfully followed the the previous instructions, you are ready to test the GSM/GPRS modem. Here are some examples of simple commands:

You can check the complete list of AT commands at the Official manufacturer Software User Guide.

Test received signal strength

Use the instruction:

at+csq

The answer should be: +CSQ: X,0, where X is the signal strenght. For example 6 is poor and 15 is good. If the answer is +CSQ:99,99 you should check the antenna.

Making a phone call

Use the instruction:

atd <number_to_call>

Press any key to end call

Sending a SMS

First of all, you need to configure the SMS format type. Telit GE865 GSM/GPRS supports PDU format and Text format. We use Text format. Type the following command:

AT+CMGF=1

There are so many ways in this modem to send a message. Here you have a simple example. Use the instruction:

at+cmgs="<destination_number>"
> <insert_here_your_text_message>

When you are ready to send your message use Ctrl+Z to send it.

If you want to cancel or restart the message press ESC.

How to use TVP5151 Video Decoder (update to kernel 37)

Requirements




There are two modules that you will use that are not inserted into the kernel: iommu2 (tvp5151) and isp.

You have to load these kernel modules before start:

modprobe iommu2
modprobe omap3-isp

(Note: The first load order must be the iommu2 and then the omap3-isp)



Now, use the program media-ctl. This program is useful to configure the ISP. You can download it from here. Then you have to transfer it to your IGEP0022 (for example via SCP command).

Now you have to configure the ISP and TVP5151:

./media-ctl -r -l '"tvp5150 2-005c":0->"OMAP3 ISP CCDC":0[1], "OMAP3 ISP CCDC":1->"OMAP3 ISP CCDC output":0[1]'

Configure the video capture setup:

./media-ctl --set-format '"tvp5150 2-005c":0 [UYVY 720x628]'

Connect a video camera or any device with PAL output to the Composite Video RCA input connector of the IGEP0022.

Use gstreamer as live stream to capture video from your video source.

Now setup the gstreamer pipeline:

gst-launch-0.10 -v v4l2src device=/dev/video2 queue-size=1 ! video/x-raw-yuv,format=\(fourcc\)UYVY,width=720,height=628 ! omapfbsink

If everything was fine you will see the live video at the screen.

TVP5151 video decoder.jpg
See also: How to setup tvp5151 video decoder

How to use EEPROM

The IGEP0022 expansion board provides an AT24C01B serial EEPROM memory which is connected to the OMAP via I2C.

You can use easily simple reads/writes to access to the eeprom:

echo "hello world!" > /sys/devices/platform/i2c_omap.2/i2c-2/2-0050/eeprom
cat /sys/devices/platform/i2c_omap.2/i2c-2/2-0050/eeprom

Or read/write from userspace using i2c-tools:

i2cget <bus> <chip> <register>
i2cset <bus> <chip> <register> <value>

For example, the following writes the value 0x22 to register 0x10 of device 0x50 on i2c bus 2:

i2cset -f -y 2 0x50 0x10 0x22
i2cget -f -y 2 0x50 0x10

See also: i2dump(8), i2cget(8) and i2cset(8) man page

How to use CAN bus

a

Handle the gpio-LED's

Basic

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 (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.


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

DSC 0177.JPG

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.


Poky-prompt-screenshot.png


a


You have to connect the two boards like this:

IGEPv2 1             IGEPv2 2
.---                 .---
| 1 |-X            X-| 1 |
| 2 |------------------| 2 | 
| 3 |------------------| 3 |
| 4 |------------------| 4 |
.---                 .---

If this is your first time accessing CAN bus, check J702 jumper is not connected before follow this tutorial. If you don't have this jumper, don't worry because its function is only for testing.

Now you can set up the interface (on all boards when using multiple IGEPv2 EXPANSION connected to a CAN network simultaneously):

/bin/ip link set can0 up type can bitrate 125000

If you want to receive CAN data, use:

candump can0

If you want to send CAN data, use:

cansend can0 -i 0x123 0xaa 0xbb 0xcc 0xdd

On the receiver side, you must see the following messages:

can0  123  [4] aa bb cc dd

Switch roles and try it again




----


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