Changes

User:Pau pajuelo

16,354 bytes removed, 15:28, 5 September 2014
m
DM3730: Decode an AAC audio file (OK)
= TODO: =
Update peripheral Categorize new tutorials, finish gpio example program<br>
Categorize new tutorials<brHow to manage the kernel modules on Linux How do I edit my kernel command line == AUDIO DSP-ARM== ===Included (IGEP GST DSP):==='''AACHEDEC -> DEC AACHE (OK)''' http://download.wavetlan.com/SVV/Media/HTTP/FAAC-HE-AAC.aac
Finish tutorials below<br> gst-launch --gst-debug-level=2 filesrc location=sampleaache.m4a ! TIAuddec1 codecName=aachedec engineName=codecServer ! volume volume=0.25 ! alsasink sync=false
Upgrade IGEP Technology Devices Guides outofthebox->ok
Link all development tools documentation when possible (do a diagram)----
Prove Log into IGEPv2 via Ethernet interface in new firmware'''MP3DEC -> DEC MP3 (AUDIO ERRORS)'''
How to manage - Followed README file from ISEE - IGEP DSP - GST + DMAI Support Package 3.40.00 http://www.stephaniequinn.com/Music/Canon.mp3 gst-launch --gst-debug-level=2 filesrc location=Canon.mp3 ! TIAuddec1 codecName=mp3dec engineName=codecServer ! volume volume=0.25 ! alsasink sync=false '''Random fatal bit error''' '''mp3-plugin doesn't resolve the kernel modules on Linuxerror''' ---- '''G711DEC -> DEC PCM uLAW (speech) (NOT TESTED)'''
How do I edit my kernel command line'''G711ENC -> ENC PCM uLAW (speech) (NOT TESTED)'''
Basic Software instructions===Not included (IGEP GST DSP):==='''ACCLCDEC -> DEC AACLE (NOT TESTED)'''
= Overview of How'''AACLDDEC -To => DEC AACLD (NOT TESTED)'''
This How'''WMA9 -To is meant to be a starting point for people to learn to use the RS-485 port on IGEP0020 board. > DEC WMA9 (COMPILING ISSUES)'''
Below this How'''ACCLCENC -To is a short .c file which describe how to setup and write data on the RS-485 port. > ENC AACLE (NOT TESTED)'''
== Feedback and Contributing =='''ACCHEENC -> ENC AACHE (NOT TESTED)'''
At any point, if you see a mistake you can contribute to this How'''AACLDENC -To. > ENC AACLD (NOT TESTED)'''
= Add RS'''WMA8 -485 support to Linux => ENC WMA8 (NOT TESTED)'''
=== Using kernel 2.6.35.13 ==='''Problems adding codecs into igep-gst-dsp'''
In this kernel is not necessary add RS-485 support== DM3730==
=== Using kernel 2.6.33 series DM3730: Decode a MP3 file (OK) (ADDED TO REPOSISTORIES)===
Follow http://www.igep.es/index.php?option=com_kunena&amp;Itemid=97&amp;func=view&amp;catid=13&amp;id=1195&amp;limit=6 '''under contruction'''
=== Using kernel 2.6.28 series ==='''does not have an accelerated audio decoder element'''
Tested on a 2.6.28.10-3 version kernel. Compiled gst-plugins-ugly using yocto tools
To use correctly the RS-485 interface chip we need to configure the serial port driver in the kernel to manage the RTS signal (Request To Send) to enable the TX section (DE pin) only when data are transmitted on TXD line (Transmit Data)rpm -igst-plugins-ugly-0. This is a software only solution, requiring no special hardware, but timing control for delays is only accurate to the next nearest jiffy*. rpm
First of all, download the latest stable kernel version - rpm -i libmad0-0.*.rpm
$ wget http://downloads.igep.es/sources/kernel/linux-omap-2.6.28.10-3.tar.gz $ tar xzf linuxrpm -omapi gst-2.6.28.10plugins-3.tar.gz $ cd linuxugly-omapmad-2.60.28*.10-3 $ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- igep0020_defconfigrpm
Next, enable the RS-485 supportgst-launch filesrc location=sample.mp3 ! mad ! volume volume=0. 25 ! alsasink
$ make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- menuconfig= DM3730: Decode a RA or RM audio file (ERRORS)===
Configure the kernel to enable RSgst-485 supportlaunch --gst-debug-level=3 filesrc location=sample.ra ! rmdemux ! volume volume=0. 25 ! alsasink
Device drivers ---&gt; Character devices ---&gt; Serial drivers ---&gt; *** serial port extensions *** [*] Allow hand shake line half duplex direction signalinghttp://www.superluminal.com/andalib/ra/listen.ra
Finally build kernel image with RSgst-485 support plugins-ugly-rmdemux-0.10.19-r1.armv7a.rpm
$ make ARCH=arm CROSS_COMPILE=armlibgstsdp-none0.10-linux0-gnueabi0.10.36- uImager3.armv7a.rpm:libgstsdp-0.10-0 libgstsdp-0.10.so.0
= Test RSlibgstrtsp-485 communication with two IGEP0020 boards =0.10-0-0.10.36-r3.armv7a.rpm:libgstrtsp-0.10-0 libgstrtsp-0.10.so.0
Connect two IGEP0020 boards using J940 connector like this'''Error: <pre> J940 J940 --- ---| 1 |---------- GND ----------| 1 || 2 |-X X-| 2 || 3 |-X X-| 3 || 4 |---------- A ----------| 4 || 5 |---------- B ----------| 5 | --- ---</pre> Setup a NFS-TFTP environment (poky-image-sato) for each board using kernel image with RS-485 support, and power up '''
Build the example for your target boards (485-example0:00:00.084839071 1550 0xa137b0 WARN rmdemux rmdemux.c at the end of this article):1012:gst_rmdemux_chain:<rmdemux0> Bogus looking header, unprintable FOURCC
$ cd linux-omap-2.6.280:00:00.10-3085052695 $ arm-none-linux-gnueabi-gcc 485-example1550 0xa137b0 WARN rmdemux rmdemux.c -o 485-example -Iinclude -Iarch/arm/include:1012:gst_rmdemux_chain:<rmdemux0> Bogus looking header, unprintable FOURCC
and copy to target rootfs0:00:00. 085540976 1550 0xa137b0 WARN rmdemux rmdemux.c:1057:gst_rmdemux_chain:<rmdemux0> Unknown object_id .ra4
Now0:00:00.085693564 1550 0xa137b0 WARN rmdemux rmdemux.c:1012:gst_rmdemux_chain:<rmdemux0> Bogus looking header, open a [[Using SSH to communicate|ssh console]] to the first board and execute the microcom command: unprintable FOURCC
0:00:00.085815634 root@igep00201550 0xa137b0 WARN rmdemux rmdemux.c:1012:gst_rmdemux_chain:~# microcom /dev/ttyS0 connected to '/dev/ttyS0' (9600 bps)<rmdemux0> Bogus looking header, exit with ctrl-X...unprintable FOURCC
On second board, open a ssh and execute the 485 example0: 00:00.085907187 1550 0xa137b0 WARN rmdemux rmdemux.c:1057:gst_rmdemux_chain:<rmdemux0> Unknown object_id RaTC
root@igep0020=== DM3730:~# ./485-exampleDecode an AAC audio file (OK)===
If all is okEXTRA_OECONF += "--disable-examples --disable-experimental --disable-sdl --disable-cdaudio --disable-directfb \ --with-plugins=musicbrainz, should appear "ABCwavpack,ivorbis,mpegvideoparse,'''faad2''' --disable-vdpau --disable-apexsink \ --disable-orc" in microcom console. Install:
root@igep0020:~# microcom /dev/ttyS0
connected to '/dev/ttyS0' (9600 bps), exit with ctrl-X...
ABC
= Appendix A: 485faad2-example2.c&nbsp;: Basic example of RS7-485 half duplex transmission =r2.armv7a.rpm<pre>/* 485libfaad2-example2.c&nbsp;: Basic example of RS485 half duplex transmission */#include &lt;stdio7-r2.h&gt;#include &lt;stringarmv7a.h&gt;rpm#include &lt;unistdgst-plugins-bad-faad-0.h&gt;#include &lt;fcntl10.h&gt;#include &lt;errno23-r2.h&gt;#include &lt;termiosarmv7a.h&gt;rpm
#include &lt;sys'''maybe there are necessary more packages, compare actual gst-bad-recipe and add changes. Necessary add faad2 recipe'''<pre>bitbake faad2 gst-plugins-bad</ioctlpre><pre> rpm -i faad2-2.7-r2.armv7a.rpmrpm -i libfaad2-2.7-r2.armv7a.rpmrpm -i gst-plugins-bad-faad-0.10.23-r2.1.armv7a.h&gt;rpm#include &lt;asm </ioctls.h&gt;pre>
#include &lt;linux/rs485gst-launch --gst-debug-level=3 filesrc location=sample.h&gt;aac ! faad ! volume volume=0.10 ! alsasink
int main==== DM3730: Decode an WMA audio file (voidOK){ char dev[] = "/dev/ttyS0"; char tosend[] = {'A', 'B', 'C'}; struct serial_rs485_settings ctrl485; int status; int fd;==
struct termios ti; speed_t speed;<pre>bitbake gst-ffmpeg</pre>
/* Open the port */ fd <pre>gst-launch -v filesrc location=sample.wma ! asfdemux ! decodebin ! audioconvert ! volume volume= open(dev, O_RDWR); if (fd &lt; 0) { printf("%s: Unable to open.\n", dev); return -1; }25 ! alsasink </pre>
/* Set the port in 485 mode */ ctrl485.flags = SER_RS485_MODE | SER_RS485_MODE_RTS | SER_RS485_RTS_TX_LOW; ctrl485.delay_before_send = 0; ctrl485.delay_after_send = 0;DM3730: Decode an OGG audio file (OK)===
status = ioctl'''Into repositories (fd, TIOCSRS485, &amp;ctrl485base plugins); if (status) { printf("%s: Unable to configure port in 485 mode, status (%i)\n", dev, status); return -1; }'''
http:/* Set the port speed */ speed = B9600; tcgetattr(fd, &amp;ti); cfsetospeed(&amp;ti, speed); cfsetispeed(&amp;ti, speed); tcsetattr(fd, TCSANOW, &amp;ti);upload.wikimedia.org/wikipedia/en/0/04/Rayman_2_music_sample.ogg
/* Send content to RS485 */ if (write(fd, tosend, sizeof(tosend))&nbsp;gst-launch -v filesrc location=sample.ogg !oggdemux ! vorbisdec ! audioconvert ! volume volume= sizeof(tosend)) { printf("%s: write() failed\n", dev); }0.25 ! alsasink
return 0;}== BASE0033 CONNECTOR SUMMARY TABLE==
</pre>== Configure a static IP using the same private network range ==
= References ='''under construction'''
*[http://markmail.org/message/hu4ydmvwa4g7xtec#query:Auto%20RS485%20direction%20control+page:1+mid:uyw4hqsipap5z4il+state:results PATCH/RFC Auto RS-485 direction control ]IGEP Firmware Yocto uses the following Ethernet network configuration (IP addresses)
*Discussions on RS-485 auto direction control seem to be split over a number of threadseth0 − 192. Here are some threads: **http://marc.info/?t=121805745200001&amp;r=1&amp;w=2 **http://marc.info/?t=121690034200007&amp;r=1&amp;w=2 **http://marc.info/?t=122821576400003&amp;r=1&amp;w=2 **http://marc168.info/?t=122822457300004&amp;r=1&amp;w=2 **http://marc5.info/?t=122954923400001&amp;r=1&amp;w=2 **httpeth0://marc0 − assigned via dhcp.info/?t=122964426200001&amp;r=1&amp;w=2 **http://marc.info/?t=121566595900001&amp;r=1&amp;w=2 **http://marc.info/?t=121805198200004&amp;r=1&amp;w=2
=== ISEE References ===This Ethernet network configuration is really useful when you work using a Linux operating system like IGEP SDK Virtual Machine. Because you use eth0 device to communicate easily with your board and eth0:0 device to get Internet acces using dhcp protocol.
Read the [httpBut some scenarios this network configuration is not useful, for example://igep.es/index.php?option=com_content&view=article&id=99&Itemid=129&dir=%2Fvar%2Fwww%2Fvhosts%2Figep.es%2Fhttpdocs%2Fdownloads%2F01if you use a non-ISEE_Products%2FIGEPv2%2FHW_User_Manuals&download_file=%2Fvar%2Fwww%2Fvhosts%2FigepLinux operating system, connect to two IP private range interfaces is not simple.es%2Fhttpdocs%2Fdownloads%2F01-ISEE_Products%2FIGEPv2%2FHW_User_Manuals%2FMAN-PR-IGEP.0020-001.23.HW_RC.pdf Official IGEP0020 Hardware Reference Manual] (chapter "5.3 CONNECTOR J940: POWER + RSThis How-485" )<br> to can be useful to
[[Category(Make diagram one:RS485]]IGEP and Linux defualt communication. Diagram 2 IGEP and other SO alternative configuration)
= igep.ini parameters =
| Only for base0010<br>=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 [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] with [[Linux Kernel 2.6.35.y|Kernel 2.6.35.y]], Ubuntu 10.04 with Linaro Toolchain, IGEP v2 RC5 and [http://downloads.igep.es/labs/gpio-driver.tar.bz2 GPIO driver].
 
There are more ways to use GPIOs in IGEP v2, but this one is very simple.<br>
 
== Feedback and Contributing ==
 
At any point, if you see a mistake you can contribute to this How-To.<br>
 
== Compile GPIO driver source code via Host<br> ==
 
Download [http://downloads.igep.es/labs/gpio-driver.tar.bz2 GPIO driver] and [[Linux Kernel 2.6.35.y|Kernel 2.6.35.y]] source code. Extract files.<br>
 
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&nbsp;type your Kernel 2.6.35.y path.<br>
 
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:
<pre>sudo apt-get install ncurses-dev
</pre>
-Go to kernel path and type:
<pre>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- igep00x0_defconfig
</pre>
Exit Linux Kernel Configuration an return to Bash. Type:
<pre>make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules_prepare
</pre>
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. <br>
 
== Install binaries via IGEP<br> ==
 
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:
<pre>insmod user-gpio-drv.ko
</pre>
Check that user-gpio-drv.ko is currently loaded with the following command:
<pre>lsmod</pre>
The result will be similar at that: <br>
<pre>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
</pre>
The module is loaded until system halt.
 
=== Install shared library ===
 
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:<br>
<pre>export LD_LIBRARY_PATH=/root/gpio-driver/lib/
</pre>
Check that libgpio.so is linked correctly. Go to:$/gpio-driver/app, gpio program is here. Type next command:
<pre>ldd gpio
</pre>
ldd command, print shared library dependencies. The result will be similar at that:
<pre>root@localhost:~/gpio-driver/app# ldd gpio
libgpio.so =&gt; /root/gpio-driver/lib/libgpio.so (0x40197000)
libc.so.6 =&gt; /lib/libc.so.6 (0x401a0000)
/lib/ld-linux.so.3 (0x4008a000)
</pre>
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: <br>
 
'''NOTE:''' For more information visit this [[Mux configuration|page]] (under construction). <br>
 
=== Configure Mux ===
 
Go to:/sys/kernel/debug/omap_mux, and change this mux configuration:
<pre>echo 0x104&gt;sdmmc2_dat4
echo 0x104&gt;sdmmc2_dat5
</pre>
Use cat command to check it:<br>
<pre>cat sdmmc2_dat4
cat sdmmc2_dat5
</pre>
The result will be similar at that:
<pre>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
</pre>
and
<pre>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
</pre>
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.<br>
 
=== 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:<br>
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[Image:Connector used readwrite test.JPG|center|350x230px]]
|
[[Image:All connected readwrite test.JPG|center|350x230px]]
 
|}
 
<br>
 
Now type next code:
<pre>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#
</pre>
The results (CMOS Voltages: 0V-1V8):
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[Image:GPIO value0 readwrite test.JPG|center|350x230px]]
|
[[Image:GPIO value1 readwrite test.JPG|center|350x230px]]
 
|}
 
<br> 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. <br> This driver have more options like IRQ, but is not explained here.
 
= How to use UARTs (update it)<br> =
 
== 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 [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] with [[Linux Kernel 2.6.35.y|Kernel 2.6.35.y]] and [http://labs.isee.biz/images/e/ee/Uart-test-beta2.tar.bz2 UART test program]
 
More information about [http://en.wikipedia.org/wiki/UART 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.
 
[[Frequently Asked Questions and Their Answers#How_many_UARTs_are_available.3F|More information]]
 
== 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 [[How to forge a local file system server with IGEP0020 board#Installing_Open_SSH_Server|here]].
 
By default, UART1 is used by RS485 driver, we need to disable it, edit igep.ini file: <br>
<pre>board.ei485= yes
</pre>
UART1 is configured in RS232 driver, when igep line is replaced by (or type in -Maybe you don't found this line-):<br>
<pre>board.ei485= no
</pre>
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>
=== Check UARTs devices ===
 
Make sure that Kernel detects UARTs, type:
<pre>dmesg | grep tty</pre>
The result will be similar at that:
<pre>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# </pre>
Get information about UARTs, type:
<pre>setserial -g /dev/ttyS[0123]</pre>
The result will be similar at that:
<pre>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# </pre>
If you don't have setserial installed type:
<pre>apt-get install setserial</pre>
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&nbsp;and log with root user:
 
Terminal 1:
<pre>minicom -D /dev/ttyS0</pre>
Terminal 2:
<pre>minicom -D /dev/ttyS2 </pre>
Type something in one terminal.
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| style="text-align: left;" | [[Image:Minicom screenshot.png|640x400px]]
|}
 
== Schematics ==
 
=== RS232 Schematic Igep V2 ===
 
{| align="center" cellspacing="1" cellpadding="1" border="1"
|-
| [[Image:RS232 Schematic Igep V2.png|800x531px]]
|}
 
<br>
 
=== Uart Schematic Igep Module ===
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[Image:Uart Schematic Igep Module.png|581x600px]]
|}
 
== Compile and run program ==
 
Download [http://labs.isee.biz/images/e/ee/Uart-test-beta2.tar.bz2 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 [[How to use GPIOs|here]] .
 
There are some interesting things to configure, before compiling the program. Open it, 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 136
#define GPIO2 137 </pre>
Constant SIZE: it determines the max number of char than can be sent<br>
 
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<br>
 
Once you have installed module. Compile program using your Cross Compiler, I used arm-linux-gnueabi-:
<pre>arm-linux-gnueabi-gcc uart-test-beta1.c -o uart-test-beta1 </pre>
== Testing UART ==
Some tests do it:
 
=== Decode Characters ===
 
Decoded with [http://www.asciitable.com/ ASCII table].
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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>
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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].
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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't a [http://en.wikipedia.org/wiki/Real-time_operating_system real-time operating system].&nbsp;
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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>
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[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.
 
{| align="center" cellspacing="1" cellpadding="1" border="1" width="200"
|-
| [[Image:Uart error test2.png|640x400px]]
|-
| Runs 16h without any transfer error (3000000 bauds)<br>
|}
 
<br>
 
[[Category:USB]] [[Category:How_to_forge]] [[Category:GPIO]] [[Category:UART]] [[Category:IGEP_Technology_Devices_Guides]]
4,199
edits