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.
= Preparing IGEP Schematics = === RS232 Schematic Igep V2 ===
{| cellspacing="1" cellpadding="1" border= Check UARTs =="1" align="center"|-| [[Image:RS232 Schematic Igep V2.png|800x531px]]|}
<br>
=== Wire connectors Uart Schematic Igep Module === {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart Schematic Igep Module.png|581x600px]]|} = Compile and run program = Download [http://labs.isee.biz/index.php/File:Uart-test-2-beta1.tar.bz2 program source] and extract it. Before compiling the program, there are some interesting things to configure. Open program and seek next lines: <pre>//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 158#define GPIO2 162<br/pre> Constant SIZE: it determines the max number of chars sended. Constant DEBUG: it can break program infinite loop part, useful to debug errors: 0 (infinite loop) or positive number determines loop max entrances. Constant WAIT: it configures select max time in seconds. Constants GPIO1 and GPIO2: they configure GPIOs used for debug via oscilloscope. By default, 158 and 162 values are not used in IGEPv2. Configure [[Mux configuration|mux]] properly if you use other GPIOs.
= Testing UART =
Some tests do it: === Decode Characters === Decoded with [http://www.asciitable.com/ ASCII table]. {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart decode1withlf.JPG|350x230px]] | [[Image:Uart decode0withlf.JPG|350x230px]] | [[Image:Uart decode100000withlf.JPG|350x230px]]|-| 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.<br> {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart select timeout9.JPG|350x230px]]|-| UART1=Blue and UART3=Green|} Click to enlarge image === RS232 Voltage params === More information [http://en.wikipedia.org/wiki/RS-232#Standard_details here]. {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart voltageparams8.JPG|350x230px]]|-| Vpp=11.8V aprox , Vmin=-5.6V aprox|} Click to enlarge image === Speed Overview === Note that wave is degraded when speed is higher {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart 300 o.JPG|260x172px]] | [[Image:Uart 4800 o.JPG|260x172px]] | [[Image:Uart 115200 o.JPG|260x172px]] | [[Image:Uart 3000000 o.JPG|260x172px]]|-| Overview signal to 300 bauds | Overview signal to 4800 bauds | Overview signal to 115200 bauds | Overview signal to 3000000 bauds|-| [[Image:Uart 300 s.JPG|260x172px]] | [[Image:Uart 4800 s.JPG|260x172px]] | [[Image:Uart 115200 s.JPG|260x172px]] | [[Image:Uart 3000000 s.JPG|260x172px]]|-| Specific wave to 300 bauds | Specific wave to 4800 bauds | Specific wave to 115200 bauds<br> | 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'Under Constructiont a [http://en.wikipedia.org/wiki/Real-time_operating_system real-time operating system]. {| cellspacing="1" cellpadding="1" width="200" 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) | 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. <br>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.<br> {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart select5.JPG|260x172px]] | [[Image:Uart select to write1.JPG|260x172px]] | [[Image:Uart write2.JPG|260x172px]] | [[Image:Uart write to select0.JPG|260x172px]]|-| select function time | Time between select and write | write function time | Time between write and select|} 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. {| cellspacing="1" cellpadding="1" width="200" border="1" align="center"|-| [[Image:Uart error test2.png|640x400px]]|-| Runs 16h without any transfer error (3000000 bauds)<br>|} <br>
[[Category:Communications]] [[Category:Work_in_progress]] [[Category:How_to_forgeUART]]