Changes

How to use I2C

1,025 bytes added, 11:45, 31 December 2013
m
Requirements
= Overview =
This How-To is meant to be a starting point for people to learn use I2C for IGEP v2 devices as quickly and easily as possible. In this how-to, we use a program that reads and decodes EDID information from display. This program was tested in [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 [[How to get the Poky Linux distribution|Poky Linux distribution]].<br>
*[http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] and [[How to get the Poky Linux distribution|Poky Linux distribution]] with [[Linux Kernel 2.6.35.y|Kernel 2.6.35.y]] <br> *[[IGEP firmware Yocto|IGEP firmware Yocto]] with [[Linux_Kernel_2.6.37.y|Kernel 2.6.37.y]] NOTE: This program is a beta version, it decodes EDID following E-EDID Standard Release A-1 from VESA using i2c-dev driver. There are some functionalities that are not implemented (see code comments) and other new ones that appear in other revisions. Besides, this program only parses the first EDID 128 bytes block. But this code is only a sample enough to learn to learnt use I2C.<br>
More information about [http://en.wikipedia.org/wiki/Extended_display_identification_data EDID].<br>
= Feedback and Contributing Requirements There are some requisites to follow this guide:
At any point*[https://www.isee.biz/support/downloads/item/igep-virtual-machine-sdk IGEP SDK VM]: follow the [http://isee.biz/component/zoo/item/igep-sdk-software-user-manual IGEP&nbsp;SDK&nbsp;SOFTWARE&nbsp;USER&nbsp;MANUAL] (chapter 2.3 "Setting up and running the VM") or install [http://labs.isee.biz/index.php/How_to_setup_a_cross_compiler#Download.2FInstall_IGEP_SDK IGEP&nbsp;SDK] in your host computer<br> *[http://www.isee.biz/products/processor-boards/igepv2-board IGEPv2], if you see a mistake you can contribute to [https://www.isee.biz/products/igep-expansion-boards/igep-berlin IGEP BERLIN] or [https://www.isee.biz/products/igep-expansion-boards/igep-paris IGEP PARIS] (in this Howguide is used I2C located at HDMI connector) *[http://labs.isee.biz/images/8/8c/Parse-Toedid-beta3.tar.bz2 parse-edid-beta3.tar. bz2]<br>
= Check I2C Devices =
 
'''NOTE:''' use these steps with [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless] .
In this How-to, I used pre-compiled modules, because: it's quick and it works. All versions of Linux are supported, as long as I2C support is included in the kernel. <br>
To make sure that I2C driver works well, follow the next steps (tested in [http://releases.linaro.org/platform/linaro-m/headless/final/linaro-m-headless-tar-20101108-2.tar.gz Linaro Headless]), to install i2c-tools:
<pre>sudo apt-get install i2c-tools
</pre>
= Compile and Run<br> =
Download '''(upload source code)''' [http://labs.isee.biz/images/8/8c/Parse-edid-beta3.tar.bz2 parse-edid-beta3.tar.bz2] and extract it.
There are some things that is interesting learn, before compiling the program. Open '''(main program)''' it and seek next lines:<br>
<pre>//1==enabled 0==disable
#define FORCE 1
//Address DVI Standard: 0x50
#define ADDRESS 0x50</pre>
Constant FORCE is defined to allow this program access to I2c, although other programs use it at the same time. It can be dangerous in writing operations but in this case, read operations, don't have sense use itproblems.<br>
Constant ADDRESS is defined to acces in specific I2C address. In DVI devices, 0x50 is default address, that means that other peripherals can be connected to same buswith other 7 bit address.
See the code below:<br>
More information about [[Peripherals Summary#I2C|I2C]].<br>
Compile program using your Cross Compiler, i used arm-linux-gnueabi-IGEP SDK: <pre>arm-poky-linux-gnueabi-gcc parse-edid-beta2beta3.c -o parse-edid-beta2beta3</pre> Export binary to IGEP using [[Transfer files via SCP|scp]]: <pre>scp parse-edid-beta3 root@&lt;IGEP IP address&gt;:/home/root </pre>
Run program as root. Pass the i2c number that you want to parse:
<pre>./parse-edid-beta2 beta3 -d 23</pre>
= Results =
This is the result from a Samsung SyncMaster B2030HD display, you can contribute to this How-To adding your display information:<br> <pre>root@localhost:~/I2CPROGRAM# ./decodeedid128 parse-edid-beta3 -d 3
256-byte EDID successfully retrieved from i2c bus 3
Decode EDID information:
Monitor name: SMB2030HD
</pre> [[Category:Communications]] [[Category:Work_in_progress]]
4,199
edits