Difference between revisions of "How to use UARTs"

From IGEP - ISEE Wiki

Jump to: navigation, search
Line 12: Line 12:
  
 
= Preparing IGEP  =
 
= Preparing IGEP  =
 +
 
=== Configure IGEP  ===
 
=== Configure IGEP  ===
  
Line 18: Line 19:
 
NOTE: Make sure that you installed open SSH server. If you don't have it go [[How to forge a local file system server with IGEP0020 board#Installing_Open_SSH_Server|here]].  
 
NOTE: Make sure that you installed open SSH server. If you don't have it go [[How to forge a local file system server with IGEP0020 board#Installing_Open_SSH_Server|here]].  
  
By default, UART0 is used by RS485 driver, we need to disable RS485 support, edit igep.ini file: <br>
+
By default, UART0 is used by RS485 driver, we need to disable RS485 support, edit igep.ini file: <br>  
 
<pre>board.ei485= yes
 
<pre>board.ei485= yes
 
</pre>  
 
</pre>  
Maybe you don't found this line, replaced by or type this:<br>
+
Maybe you don't found this line, replaced by or type this:<br>  
 
<pre>board.ei485= no
 
<pre>board.ei485= no
 
</pre>  
 
</pre>  
By default, UART3 is used by Kernel serial console, we need to disable it, go to igep.ini file, comment next line: <br>
+
By default, UART3 is used by Kernel serial console, we need to disable it, go to igep.ini file, comment next line: <br>  
<pre>console=ttyS2,115200n8</pre>
+
<pre>console=ttyS2,115200n8</pre>  
 
 
 
=== Check UARTs devices  ===
 
=== Check UARTs devices  ===
  
Line 40: Line 40:
 
root@localhost:~/PROGRAM# </pre>  
 
root@localhost:~/PROGRAM# </pre>  
 
Get information about UARTs, type:  
 
Get information about UARTs, type:  
<pre>setserial -g /dev/ttyS[0123]</pre>
+
<pre>setserial -g /dev/ttyS[0123]</pre>  
 
The result will be similar at that:  
 
The result will be similar at that:  
 
<pre>root@localhost:~/PROGRAM# setserial -g /dev/ttyS[0123]
 
<pre>root@localhost:~/PROGRAM# setserial -g /dev/ttyS[0123]
Line 47: Line 47:
 
/dev/ttyS2, UART: 16654, Port: 0x0000, IRQ: 74
 
/dev/ttyS2, UART: 16654, Port: 0x0000, IRQ: 74
 
/dev/ttyS3, UART: 16654, Port: 0x0000, IRQ: 80
 
/dev/ttyS3, UART: 16654, Port: 0x0000, IRQ: 80
root@localhost:~/PROGRAM# </pre>
+
root@localhost:~/PROGRAM# </pre>  
If you don't have setserial installed type:
+
If you don't have setserial installed type:  
<pre>apt-get install setserial</pre>
+
<pre>apt-get install setserial</pre>  
 
 
 
=== Wire connectors  ===
 
=== Wire connectors  ===
  
Wire connector like:
+
Wire connector like:  
 
<pre> J960     
 
<pre> J960     
 
                     ------   
 
                     ------   
Line 63: Line 62:
 
                     ------   
 
                     ------   
 
</pre>
 
</pre>
 +
 +
=== Send some data  ===
 +
p
  
 
= Compile and run program =
 
= Compile and run program =

Revision as of 12:25, 19 January 2012

Overview

This How-To is meant to be a starting point for people to learn use UART for IGEP v2 devices as quickly and easily as possible. In this how-to, we use a program (upload source code), executed twice, at the same time inside the same IGEP.  Its function is get a number via UART, increase it and send result to other UART, the result will be a infinite loop between 2 UARTs. This program was testedin Linaro Headless with Kernel 2.6.35.y.

More information about UART.

Note: This program have a debug option using GPIOs to debug via oscilloscope, this option is useful to learnt about the Kernel latencies and IRQ. 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 IGEP

To test UARTs we use UART0 (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, UART0 is used by RS485 driver, we need to disable RS485 support, edit igep.ini file:

board.ei485= yes

Maybe you don't found this line, replaced by or type this:

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[0123]
/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

Wire connectors

Wire connector like:

 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

p

Compile and run program


Testing UART

Under Construction