0
edits
Changes
no edit summary
= Overview=<brsection 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 How-To, 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 How-To was tested in: *[[IGEP firmware Yocto|IGEP firmware Yocto]] and [[Linux_Kernel_2.6.37.y|Kernel 2.6.37.y]] with IGEPv2.
= Feedback == Configure UART1 and Contributing UART3 in IGEP with RS232 levels on J960 connector ===
=== Check UARTs devices ===
<pre>dmesg | grep tty</pre>
The result will be similar at that:
<pre>root@localhostigep00x0:~/PROGRAM# dmesg | grep tty
[ 0.000000] console [tty0] enabled
[ 0.598999485198] serial8250omap_uart.0: ttyS0 ttyO0 at MMIO 0x4806a000 (irq = 72) is a ST16654OMAP UART0[ 0.784057485565] serial8250omap_uart.1: ttyS1 ttyO1 at MMIO 0x4806c000 (irq = 73) is a ST16654OMAP UART1[ 0.969085485931] serial8250omap_uart.2: ttyS2 ttyO2 at MMIO 0x49020000 (irq = 74) is a ST16654OMAP UART2[ 10.153503486267] serial8250omap_uart.3: ttyS3 ttyO3 at MMIO 0x49042000 (irq = 80) is a ST16654root@localhost:~/PROGRAM# </pre> Get information about UARTs, type: <pre>setserial -g /dev/ttyS[0123]</pre> The result will be similar at that: OMAP UART3<pre>root@localhostigep00x0:~/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: 80root@localhost:~/PROGRAM# </pre> If you don't have setserial installed type: <pre>apt-get install setserial</pre>
=== Connect peripherals ===
Connect IGEPv2 board using J960 connector like this:
<pre> J960
(Not used) x---| 1 2 |---o (Connect to 8)
(Connect to 9) o---| 3 4 |---x (Not used)
(Not used)x---| 7 8 |---o (Connect to 2)
(Connect to 3) o---| 9 10 |---x (Not used)
=== Send some data ===
Use minicom microcom to prove it, open two terminals via SSH and log with root user:
Terminal 1:
<pre>minicom -D microcom /dev/ttyS0ttyO0</pre>
Terminal 2:
<pre>minicom -D microcom /dev/ttyS2 ttyO2 </pre> Type something in one terminal.
= Schematics = === RS232 Schematic Igep V2 === {| cellspacing="1" cellpadding="1" border="1" align="center" width="200"
|-
| style[[Image:RS232 Schematic Igep V2.png|800x531px]]|} <br> === Uart Schematic Igep Module === {| cellspacing="text-1" cellpadding="1" width="200" border="1" align: left;="center" |-| [[Image:Minicom screenshotUart Schematic Igep Module.png|640x400px581x600px]]
|}
= Compile and run program =
<pre>//Define Array char size
#define SIZE 30
//Define Debug mode:0==Disable
#define DEBUG 0
//Set GPIO Debugger port
//Be sure that mux is correctly configured and GPIOs are not used
#define GPIO1 136158#define GPIO2 137 162</pre> Constant SIZE: it determine 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 like (infinite loop ) or positive number determine determines loop max entrances<br>.
Constant WAIT: configure it 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 this GPIO for other purposes<br>GPIOs.
= Testing UART =
Some tests do it:
=== Decode Characters ===
Decoded with [http://www.asciitable.com/ ASCII table]. {| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart decode1withlf.JPG|350x230px]]
=== select timeout ===
{| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart select timeout9.JPG|350x230px]]
=== RS232 Voltage params ===
More information [http://en.wikipedia.org/wiki/RS-232#Standard_details here]. {| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart voltageparams8.JPG|350x230px]]
=== Speed Overview ===
Note that wave is degraded when speed is higher {| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart 300 o.JPG|260x172px]]
| Specific wave to 3000000 bauds<br>
|}
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 [http://en.wikipedia.org/wiki/Real-time_operating_system real-time operating system]. {| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart lag left6.JPG|350x230px]]
| [[Image:Uart lag right7.JPG|350x230px]]select: blocked until all data is available.
|-
| Lag between UART1 and UART3 (300 bauds)
Click to enlarge image
{| widthcellspacing="2001" cellspacingcellpadding="1" cellpaddingwidth="1200" border="1" align="center"
|-
| [[Image:Uart select5.JPG|260x172px]]
|}
Click to enlarge image <br> 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.
<br> '''Under Construction'''
[[Category:Communications]] [[Category:Work_in_progress]] [[Category:How_to_forgeUART]]