Personal tools

Log in

Changes

From IGEP - ISEE Wiki

Jump to: navigation, search

How to use UARTs

241 bytes added, 11:41, 12 November 2014
no edit summary
'''UNDER MAINTENANCE'''
__TOC__
= Overview =
<section begin=overview />
This How-To is meant to be a starting point for people to learn use UART for IGEP devices as quickly and easily as possible. In this howHow-toTo, we use [http://labs.isee.biz/index.php/Pre-installed_software_on_IGEP_Processor_Boards IGEP Firmware] and a program that use UART peripherals. This program How-To was tested in: *[[IGEP firmware Yocto|IGEP firmware Yocto]] with and [[Linux_Kernel_2.6.37.y|Kernel 2.6.37.y]]with IGEPv2.
These example Example program has a debug option using GPIOs to debug via oscilloscope, this method is useful to learn about the Kernel latencies. Debug has set to "write" and "select" functions. [[Peripherals Summary#UART|More information]].
<section end=overview />
= Preparing IGEP =
IGEP Uart devices have the following names in Kernel [[Linux Kernel 2.6.35.y|2.6.35.y]]:
*UART1: /dev/ttyS0
*UART2: /dev/ttyS1
*UART3: /dev/ttyS2
*UART4: /dev/ttyS3
IGEP Uart devices have the following names in Kernel [[Linux Kernel 2.6.37.y|2.6.37.y]]:
*UART1: /dev/ttyO0
*UART2: /dev/ttyO1
*UART3: /dev/ttyO2
*UART4: /dev/ttyO3
 
=== Configure UART1 and UART3 in IGEP with RS232 levels on J960 connector ===
;console=ttyO</pre>
==== Edit inittab file ====
Getty program uses /dev/ttyO2 in IGEP Firmware, disable it modifying /devetc/inittab file:
*Comment next line:
<pre> #S:2345:respawn:/sbin/getty 115200 ttyO2</pre>
= Compile and run program =
Download [http://labs.isee.biz/index.php/File:Uart-test-2-beta1.tar.bz2 program source] and extract it. There Before compiling the program, there are some interesting things to configure, before compiling the program. Open program and seek next lines:
<pre>//Define Array char size
#define SIZE 30
//Buffer lenght#define MAX_BUF 64
//Define Debug mode:0==Disable
#define DEBUG 0
//User interface default path
#define SYSFS_GPIO_DIR "/sys/class/gpio"
//Define wait select
#define GPIO1 158
#define GPIO2 162</pre>
Constant SIZE: it determines the max number of char than can be sent<br> chars sended.
Constant DEBUG: it can break program infinite loop part, it can be useful to debug some errors, : 0 (infinite loop) or positive number determine determines loop max entrances .
Constant WAIT: it configurea configures select max timein seconds.
Constants GPIO1 and GPIO2: they configure GPIOs used for debug via oscilloscope. Take care to configure By default, 158 and 162 values are not used in IGEPv2. Configure [[Mux configuration|mux and don't ]] properly if you use them for other purposes<br> GPIOs.
Once you have installed module. Compile program source code using your Cross Compiler, I used arm-linux-gnueabi-a [[How to setup a cross compiler|cross compiler]] for example IGEP SDK: <pre>arm-poky-linux-gnueabi-gcc uart-test-2-beta1.c -o uart-test-beta1 </pre>
= Testing UART =
0
edits