Difference between revisions of "How to use I2C"
From IGEP - ISEE Wiki
m (→Requirements) |
|||
Line 14: | Line 14: | ||
There are some requisites to follow this guide: | There are some requisites to follow this guide: | ||
− | *[ | + | *[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 SDK SOFTWARE USER 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 SDK] in your host computer<br> |
− | *[http://www.isee.biz/products/processor-boards/igepv2-board IGEPv2], [ | + | *[http://www.isee.biz/products/processor-boards/igepv2-board IGEPv2], [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 guide is used I2C located at HDMI connector) |
*[http://labs.isee.biz/images/8/8c/Parse-edid-beta3.tar.bz2 parse-edid-beta3.tar.bz2]<br> | *[http://labs.isee.biz/images/8/8c/Parse-edid-beta3.tar.bz2 parse-edid-beta3.tar.bz2]<br> | ||
Latest revision as of 11:45, 31 December 2013
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:
- Linaro Headless and Poky Linux distribution with Kernel 2.6.35.y
- IGEP firmware Yocto with 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 enough to learn to use I2C.
More information about EDID.
Requirements
There are some requisites to follow this guide:
- IGEP SDK VM: follow the IGEP SDK SOFTWARE USER MANUAL (chapter 2.3 "Setting up and running the VM") or install IGEP SDK in your host computer
- IGEPv2, IGEP BERLIN or IGEP PARIS (in this guide is used I2C located at HDMI connector)
- parse-edid-beta3.tar.bz2
Check I2C Devices
NOTE: use these steps with 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.
To make sure that I2C driver works well, follow the next steps to install i2c-tools:
sudo apt-get install i2c-tools
Parse I2C busses:
i2cdetect -l
The result will be similar at that:
i2c-1 i2c OMAP I2C adapter I2C adapter i2c-3 i2c OMAP I2C adapter I2C adapter
It's important than i2c-3 was enabled, because it connects to DVI-D by default.
Compile and Run
Download parse-edid-beta3.tar.bz2 and extract it.
There are some things that is interesting learn, before compiling the program. Open it and seek next lines:
//1==enabled 0==disable #define FORCE 1 //Address DVI Standard: 0x50 #define ADDRESS 0x50
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 read operations don't have problems.
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 bus with other 7 bit address.
See the code below:
for (i=0;i<=255;i++) { edidint[i]=i2c_smbus_read_byte_data(fd,i); if (edidint[i]<0) { printf("Error:read failed\n"); return -1; } }
The program uses i2c_smbus_read_byte_data function to get information from display, "i" variable is the EEPROM address. EEPROM (Slave) reads address from Omap (Master), after, EEPROM sends the address value to Omap (Master).
More information about I2C.
Compile program using IGEP SDK:
arm-poky-linux-gnueabi-gcc parse-edid-beta3.c -o parse-edid-beta3
Export binary to IGEP using scp:
scp parse-edid-beta3 root@<IGEP IP address>:/home/root
Run program as root. Pass the i2c number that you want to parse:
./parse-edid-beta3 -d 3
Results
This is the result from a Samsung SyncMaster B2030HD display, you can contribute to this How-To adding your display information:
root@localhost:~/I2CPROGRAM# parse-edid-beta3 -d 3 256-byte EDID successfully retrieved from i2c bus 3 Decode EDID information: Manufacturer: SAM Model 70a Serial Number 0 Made week 11 of 2010 EDID version: 1.3 Digital display Maximum image size: 44 cm x 25 cm Gamma: 2.20 Supported color formats: RGB 4:4:4, YCrCb 4:2:2 First detailed timing is preferred timing Established timings supported: 720x400@70Hz 640x480@60Hz 640x480@67Hz 640x480@72Hz 640x480@75Hz 800x600@56Hz 800x600@60Hz 800x600@72Hz 800x600@75Hz 832x624@75Hz 1024x768@60Hz 1024x768@70Hz 1024x768@75Hz 1280x1024@75Hz 1152x870@75Hz Standard timings supported: 1152x864@75Hz 1280x800@60Hz 1280x800@75Hz 1280x1024@60Hz 1440x900@60Hz 1440x900@75Hz Detailed mode: Clock: 108.000 MHz, Screen: 443 mm x 249 mm, Active resolution: 1600x900, Blanking resolution: 1624x901, Sync offset resolution: 1704x904, Sync pulse width resolution: 1800x1000, Hborder: 0, Vborder: 0, +hsync +vsync Detailed mode: Clock: 74.250 MHz, Screen: 443 mm x 249 mm, Active resolution: 1280x720, Blanking resolution: 1720x725, Sync offset resolution: 1760x730, Sync pulse width resolution: 1980x750, Hborder: 0, Vborder: 0, +hsync +vsync Monitor ranges: 24-75HZ vertical, 26-81kHz horizontal, max dotclock 230MHz Monitor name: SMB2030HD