User:Pau pajuelo
From IGEP - ISEE Wiki
TODO:
Update peripheral tutorials, finish gpio example program
Categorize new tutorials
Finish tutorials below
Upgrade IGEP Technology Devices Guides
Link all development tools documentation when possible (do a diagram)
Prove Log into IGEPv2 via Ethernet interface in new firmware
How to manage the kernel modules on Linux
How do I edit my kernel command line
Getting started with IGEP COM MODULE
|
|
Contents
- 1 TODO:
- 2 Getting started with IGEP COM MODULE
- 3 Overview
- 4 Requirements
- 5 Getting started
- 6 What can I do with IGEP COM MODULE
- 7 Overview
- 8 What can I do
- 9 igep.ini parameters
- 10 How to use GPIOs (update it)
- 11 How to use UARTs (update it)
Overview
This is the 1/3 chapter of IGEP COM MODULE Tutorial Guide.
In this first chapter, we will learn how to connect IGEP COM MODULE, how to log into IGEP COM MODULE via USB and how to log into IGEPv2 via WIFI.
Requirements
In this tutorial we are going to use the following peripherals:
- IGEP COM MODULE
- An USB Cable mini-B
- USB Hub with external power supply
- A PC with Linux or Windows
Getting started
Power up IGEP COM MODULE
IGEP COM MODULE for standalone operation (without expansion boards) can be supplied using a 5V DC through USB 2.0 OTG connector. Use an USB Hub with external power supply.Log into IGEP COM MODULE via WIFI interface
Log into IGEP COM MODULE via USB Ethernet Gadget interface
You have successfully completed this chapter of the guide.
|
If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat |
|
|
What can I do with IGEP COM MODULE
|
|
Overview
What can I do
Handle the gpio-LED's
Send a file between your PC and IGEPv2 via SCP
Update your pre-installed software
Flash the latest software image
Basic instructions
Mount a MicroSD card
You have successfully completed this chapter of the guide.
|
If you have any question, don't ask to ask at the IGEP Community Forum or the IGEP Community Chat |
|
|
igep.ini parameters
The kernel command line syntax is name=value1. These next parameters are supported in igep.ini since IGEP-X_Loader 2.4.0-2:
[kernel]
Parameter Name | Description | Default value | Comments |
kaddress | Kernel copy address | =0x80008000 | Hex memory address |
rdaddress | Ram Disk location address | =0x81600000 | Hex memory address; disabled by default |
serial.low | Serial number (low part) | =00000001 | Numeric |
serial.high | Serial number (high part) | =00000000 | Numeric |
revision | Revision ID | =0003 | Numeric |
kImageName | Kernel, binary image name | =zImage | Kernel or binary image name |
kRdImageName | Kernel RAM Disk Image Name | - | Ram Disk image name |
MachineID | Machine ID (kernel ID) | ;IGEPv2 =2344 |
;Module =2717 ;Proton =3203 |
Mode | Boot Mode | ;Linux kernel =kernel |
;Other image (like uboot) [binary image] |
[kparams]
Parameter Name | Description | Default value | Comments |
buddy | Enable/disable expansion board support | ;IGEPv2 Expansion Board support =igep0022 |
;Berlin and Paris Expansion Board support =base0010 New York Expansion =ilms0015 |
console | Setup the kernel console parameters | =ttyO2,115200n8 | - |
earlyprintk | Enable early printk | - | - |
mem | Setup the Board Memory Configuration | =430M | - |
boot_delay | Setup the boot delay | =0 | - |
mpurate | Setup ARM Processor Speed | - | - |
loglevel | Setup the loglevel | - | - |
debug | Enable kernel debug output | - | - |
fixrtc | Fix RTC variable | - | - |
nocompcache | Configure nocompcache variable | =1 | - |
omapfb.mode | Configure frame bugger configuration | =dvi:hd720-16@50 | ;Other configuration =dvi:1280x720MR-16@60 |
vram | Configure Video RAM assigned to every frame buffer | - | - |
omapfb.vram | Configure Video RAM assigned to every frame buffer | - | - |
omapfb.debug | Configure frame buffer debug output | - | - |
omapdss.debug | Configure DSS Video debug output | - | - |
smsc911x.mac0 | Configure Board Ethernet Mac Address | =0xb2,0xb0,0x14,0xb5,0xcd,0xde | For IGEP BERLIN |
smsc911x.mac1 | Configure Board Ethernet Mac Address | =0xb2,0xb0,0x14,0xb5,0xcd,0xdf | For IGEP BERLIN (only with IGEP PROTON) |
smsc911x.mac | Configure Board Ethernet Mac Address | =0xb2,0xb0,0x14,0xb5,0xcd,0xde | For IGEPv2, IGEP PROTON, IGEP PARIS and IGEP BERLIN |
ubi.mtd | Fot UBI FS boot | - | - |
root | Configure root directory for MMC, NFS or UBI | ;For mmc memory =/dev/mmcblk0p2 rw rootwait |
;For flash memory =/dev/mtdblock2 |
nfsroot | For NFS boot | - | - |
rootfstype | For UBI FS boot | - | - |
ip | For NFS boot | - | - |
init | Assign init program | - | - |
musb_hdrc.debug | USB debug | - | - |
musb_hdrc.use_dma | USB over network | - | - |
libertas.libertas_debug | Configure libertas debug | - | - |
board.ei485 | Enable/disable RS485 | ;Enable RS485 =yes |
;Disable RS485 =no |
board.modem | Enable/disable GPRS modem | ;Enable modem (IGEPv2 Expansion) =no |
;Enable modem (IGEPv2 Expansion) =yes |
buddy.revision | Enable hardware buddy revision [A or B] | Only for base0010 =A |
Only for base0010 =B |
How to use GPIOs (update it)
Overview
This How-To is meant to be a starting point for people to learn use GPIOs for IGEP v2 devices as quickly and easily as possible. For this how-to i used Linaro Headless with Kernel 2.6.35.y, Ubuntu 10.04 with Linaro Toolchain, IGEP v2 RC5 and GPIO driver.
There are more ways to use GPIOs in IGEP v2, but this one is very simple.
Feedback and Contributing
At any point, if you see a mistake you can contribute to this How-To.
Compile GPIO driver source code via Host
Download GPIO driver and Kernel 2.6.35.y source code. Extract files.
Edit GPIO driver Makefile's:
-In files: $/app/Makefile and $/lib/Makefile, make sure that your CROSS_COMPILE path is correct.
-In file: $/modules/Makefile, make sure that your CROSS_COMPILE path is correct and type your Kernel 2.6.35.y path.
We will use the ncurses program for set up Kernel configuration, if you don't have this program installed then you must install it with this command:
sudo apt-get install ncurses-dev
-Go to kernel path and type:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep00x0_defconfig
Exit Linux Kernel Configuration an return to Bash. Type:
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_prepare
File $/include/generated/autoconf.h was created
Finally compile GPIO driver, go to main Makefile path and compile all source code using make command.
Send binaries created from Host to Igep v2.
Install binaries via IGEP
Log with root user to install binaries.
Install module
Go to:$/modules and insert user-gpio-drv.ko into linux kernel with the following command:
insmod user-gpio-drv.ko
Check that user-gpio-drv.ko is currently loaded with the following command:
lsmod
The result will be similar at that:
root@localhost:~/gpio-driver/module# lsmod Module Size Used by user_gpio_drv 1639 0 omap_wdt 3411 0 spidev 4198 0 iommu 8558 0 rtc_twl 4411 0 rtc_core 11187 1 rtc_twl twl4030_keypad 2970 0
The module is loaded until system halt.
Go to:$/lib. libgpio.so is here.
If a program is linked with shared libraries, Kernel seek in specific paths when program is executed. Now is necessary link the libgpio.so path to the environment variable LD_LIBRARY_PATH, use the following command:
export LD_LIBRARY_PATH=/root/gpio-driver/lib/
Check that libgpio.so is linked correctly. Go to:$/gpio-driver/app, gpio program is here. Type next command:
ldd gpio
ldd command, print shared library dependencies. The result will be similar at that:
root@localhost:~/gpio-driver/app# ldd gpio libgpio.so => /root/gpio-driver/lib/libgpio.so (0x40197000) libc.so.6 => /lib/libc.so.6 (0x401a0000) /lib/ld-linux.so.3 (0x4008a000)
The shared library is linked until system halt. Now you can execute gpio example program.
Testing driver
To make sure than driver works well, make the next test. I used GPIO_136(sdmmc2_dat4) and GPIO_137(sdmmc2_dat5) because IGEP v2 RC5(without WIFI) don't use them by default:
NOTE: For more information visit this page (under construction).
Configure Mux
Go to:/sys/kernel/debug/omap_mux, and change this mux configuration:
echo 0x104>sdmmc2_dat4 echo 0x104>sdmmc2_dat5
Use cat command to check it:
cat sdmmc2_dat4 cat sdmmc2_dat5
The result will be similar at that:
root@localhost:/sys/kernel/debug/omap_mux# cat sdmmc2_dat4 name: sdmmc2_dat4.gpio_136 (0x48002164/0x134 = 0x0104), b ae4, t NA mode: OMAP_PIN_INPUT | OMAP_MUX_MODE4 signals: sdmmc2_dat4 | sdmmc2_dir_dat0 | NA | sdmmc3_dat0 | gpio_136 | NA | NA | safe_mode
and
root@localhost:/sys/kernel/debug/omap_mux# cat sdmmc2_dat5 name: sdmmc2_dat5.gpio_137 (0x48002166/0x136 = 0x0104), b ah3, t NA mode: OMAP_PIN_INPUT | OMAP_MUX_MODE4 signals: sdmmc2_dat5 | sdmmc2_dir_dat1 | cam_global_reset | sdmmc3_dat1 | gpio_137 | hsusb3_tll_stp | mm3_rxdp | safe_mode
Note: OMAP_PIN_INPUT=Input/Output pin and OMAP_PIN_OUTPUT=Output pin, for Read/Write test you need the first one. GPIO is configured in mode 4.
Read/Write test
Link GPIO_136 and GPIO_137 with a wire, these pins are located in J990 connector with numbers 7 and 9. I use the next connector to join them:
Now type next code:
root@localhost:~/gpio-driver/app# ./gpio input 136 root@localhost:~/gpio-driver/app# ./gpio output 137 0 root@localhost:~/gpio-driver/app# ./gpio get 136 0 root@localhost:~/gpio-driver/app# ./gpio output 137 1 root@localhost:~/gpio-driver/app# ./gpio get 136 1 root@localhost:~/gpio-driver/app#
The results (CMOS Voltages: 0V-1V8):
The code above shows that driver works properly, GPIO_136 is configured like input and GPIO_137 is configured like output with value 0, when read GPIO_136 the result is 0. To make sure that works well, configure GPIO_137 with value 1, now GPIO_136 reads 1.
This driver have more options like IRQ, but is not explained here.
Other examples:What can I do with IGEP0020#How_to_handle_the_gpio-LED.27s
How to use UARTs (update it)
Overview
This How-To is meant to be a starting point for people to learn use UART for IGEPv2 devices as quickly and easily as possible. In this how-to, we use Linaro Headless with Kernel 2.6.35.y and UART test program
More information about UART.
Note: This program has a debug option using GPIOs to debug via oscilloscope, this option is useful to learnt about the Kernel latencies. Debug has set to "write" and "select" functions.
Feedback and Contributing
At any point, if you see a mistake you can contribute to this How-To.
Preparing IGEP
Configure UART1 and UART3 in IGEP with RS232 levels on J960 connector
To test UARTs we use UART1 (dev/ttyS0) and UART3 (dev/ttyS2) via J960 connector using RS232 standard.
NOTE: Make sure that you installed open SSH server. If you don't have it go here.
By default, UART1 is used by RS485 driver, we need to disable it, edit igep.ini file:
board.ei485= yes
UART1 is configured in RS232 driver, when igep line is replaced by (or type in -Maybe you don't found this line-):
board.ei485= no
By default, UART3 is used by Kernel serial console, we need to disable it, go to igep.ini file, comment next line:
console=ttyS2,115200n8
Check UARTs devices
Make sure that Kernel detects UARTs, type:
dmesg | grep tty
The result will be similar at that:
root@localhost:~/PROGRAM# dmesg | grep tty [ 0.000000] console [tty0] enabled [ 0.598999] serial8250.0: ttyS0 at MMIO 0x4806a000 (irq = 72) is a ST16654 [ 0.784057] serial8250.1: ttyS1 at MMIO 0x4806c000 (irq = 73) is a ST16654 [ 0.969085] serial8250.2: ttyS2 at MMIO 0x49020000 (irq = 74) is a ST16654 [ 1.153503] serial8250.3: ttyS3 at MMIO 0x49042000 (irq = 80) is a ST16654 root@localhost:~/PROGRAM#
Get information about UARTs, type:
setserial -g /dev/ttyS[0123]
The result will be similar at that:
root@localhost:~/PROGRAM# setserial -g /dev/ttyS* /dev/ttyS0, UART: 16654, Port: 0x0000, IRQ: 72 /dev/ttyS1, UART: 16654, Port: 0x0000, IRQ: 73 /dev/ttyS2, UART: 16654, Port: 0x0000, IRQ: 74 /dev/ttyS3, UART: 16654, Port: 0x0000, IRQ: 80 root@localhost:~/PROGRAM#
If you don't have setserial installed type:
apt-get install setserial
NOTE: Starting from Kernel 2.6.37.y, ttySx are named ttyOx. You need to edit source program.
Connect peripherals
Connect IGEPv2 board using J960 connector like this:
J960 ------ (Not used) x---| 1 2 |---o (Connect to 8) (Connect to 9) o---| 3 4 |---x (Not used) (GND)·|---| 5 6 |---|· (GND) (Not used)x---| 7 8 |---o (Connect to 2) (Connect to 3) o---| 9 10 |---x (Not used) ------
Send some data
Use minicom to prove it, open two terminals via SSH and log with root user:
Terminal 1:
minicom -D /dev/ttyS0
Terminal 2:
minicom -D /dev/ttyS2
Type something in one terminal.
Schematics
RS232 Schematic Igep V2
Uart Schematic Igep Module
Compile and run program
Download program source.
As explained above, the program uses GPIO for debug option via oscilloscope, it is necessary install user-gpio-drv.ko driver inside Linux Kernel, more information here .
There are some interesting things to configure, before compiling the program. Open it, seek next lines:
//Define Array char size #define SIZE 30 //Define Debug mode:0==Disable #define DEBUG 0 //Define wait select #define WAIT 5 //Set GPIO Debugger port //Be sure that mux is correctly configured and GPIOs are not used #define GPIO1 136 #define GPIO2 137
Constant SIZE: it determines the max number of char than can be sent
Constant DEBUG: it can break program infinite loop part, it can be useful to debug some errors, 0 (infinite loop) or positive number determine loop max entrances
Constant WAIT: it configurea select max time.
Constants GPIO1 and GPIO2: they configure GPIOs used for debug via oscilloscope. Take care to configure mux and don't use them for other purposes
Once you have installed module. Compile program using your Cross Compiler, I used arm-linux-gnueabi-:
arm-linux-gnueabi-gcc uart-test-beta1.c -o uart-test-beta1
Testing UART
Some tests do it:
Decode Characters
Decoded with ASCII table.
Decoding "1\n" | Decoding "0\n" | Decoding "100000\n" |
Click to enlarge image
select timeout
Program sends information via UART1 but don't receive response via UART3, because only a process is executed. This problem is repeated every 5 seconds (constant WAIT=5) until other process sends information via UART3 at the same speed. If "select" hasn't been implemented, process would have stayed blocked.
UART1=Blue and UART3=Green |
Click to enlarge image
RS232 Voltage params
More information here.
Vpp=11.8V aprox , Vmin=-5.6V aprox |
Click to enlarge image
Speed Overview
Note that wave is degraded when speed is higher
Click to enlarge image
Lag
You can see that RS232 have some lag between transmisions. This caused mainly by kernel process management. UART peripheral is controlled by Linux and It isn't a real-time operating system.
select: blocked until all data is available. | |
Lag between UART1 and UART3 (300 bauds) | Lag between UART3 and UART1 (300 bauds) |
Click to enlarge image
This program have three I/O functions that connect to UART driver via ioctl: (read(), write() and select()). But select() and write() change process stat to sleep mode until system don't receive or transmit all information via UART. "select" function is used to prevent that read function can be blocked when data aren't available.
The next images (program with debug_gpio enabled and 300 bauds speed) show when process is executed or is waiting. Blue=UART1, Violet="write" and Green="select". When GPIO has HIGH value, process is blocked.
select function time | Time between select and write | write function time | Time between write and select |
Click to enlarge image
In this case:
select: blocked until all data is available (LF char received).
write: blocked until all data is send to UART buffer.
Error test
Every full process the number is increased twice. Program checks that this condicion is true, if it isn't accomplished, process will be finish.
Runs 16h without any transfer error (3000000 bauds) |