![]() ![]() ![]() | I2C2P Usage |
![]() |
| |||
Downloading kernel source treeDecide if you want to use your existing Linux kernel source tree on your disk or download brand new one. If you want to download a new one, download a linux kernel source tree from 2.4 or 2.6 series and unpack. You end up with a directory named for example linux-2.6.10. | |||
Downloading the patchDownload the i2c2p.patch and place it into the linux kernel directory (e. g. linux-2.6.10). | |||
PatchingEnter the linux kernel source tree directory (e.. g. linux-2.6.10) and issue the patch command: clock@beton:~/linux-2.6.10$ patch -Np1 -i i2c2p.patch patching file drivers/i2c/busses/i2c-parport.c patching file drivers/i2c/busses/i2c-parport.hFailure looks like this: clock@beton:~/linux-2.6.10$ patch -Np1 -i i2c2p.patch patching file Documentation/i2c/dev-interface Hunk #1 FAILED at 3. Hunk #2 FAILED at 19. 2 out of 2 hunks FAILED -- saving rejects to file Documentation/i2c/dev-interface.rej patching file drivers/i2c/busses/i2c-parport.c patching file drivers/i2c/busses/i2c-parport.hIf you encounter failure and your kernel is from 2.4 or 2.6 series, then it's a problem of I2C2P and please contact the user support. | |||
(Re)compiling and installing the kernel(Re)compile and install the kernel as usual. (It's the job of Linux kernel project to supply informations how this should be properly done.) | |||
| |||
DecisionChoose whether you would like to use module or hard-compiled driver according to your own personal taste. | |||
Example module configurationTo use the I2C bus meaningfully, you have to connect something to it. In this example we connected a PCF8591 chip which is supported by Linux kernel by module called pcf8591. The pcf8591 module also has its own module paramters, that are related to the PCF8591 chips' features and also to the I2C bus stuff like addresses etc.: clock@oberon:~$ modinfo pcf8591 parm: force:List of adapter,address pairs to boldly assume to be present parm: force_pcf8591:List of adapter,address pairs which are unquestionably assumed to contain a `pcf8591' chip parm: probe:List of adapter,address pairs to scan additionally parm: probe_range:List of adapter,start-addr,end-addr triples to scan additionally parm: ignore:List of adapter,address pairs not to scan parm: ignore_range:List of adapter,start-addr,end-addr triples not to scan parm: input_mode:Analog input mode: 0 = four single ended inputs 1 = three differential inputs 2 = single ended and differential mixed 3 = two differential inputs author: Aurelien JarnoThe PCF8591 was placed on this experimental board (not related to I2C2P project):
Therefore we put this into /etc/conf.d/local.start on our Gentoo distribution: ( modprobe i2c-parport type=6 \ && modprobe pcf8591 force=1,0x004f input_mode=0 ) & Put something like that into suitable file on your system that is being executed on startup. Note that the modprobe i2c-parport type=6 command is invariant for you, because we are having an "Twibright I2C2P adapter", as described by modinfo i2c-parport. The other details depend on how you want to particularly use your I2C2P adapter. | |||
Connecting I2C2P physicallyConnect the I2C2P adaptor into your parallel port directly or using an etender cable. It is necessary to remove hexagonal nuts from parport or replace nuts by screws on extender cable because the connector on I2C2P already contains nuts and they can't be taken away, because the connector would fall apart. Connect 5V I2C bus into the RJ12 connector including 5V feed. Here is the I2C RJ12 connector pinout. Turn the 5V power of I2C on.
| |||
User-land programsNow set up and run your possible additional userland programs that talk to the connected device(s). We user the sensors program. Its usage involved some further configuration of its system-wide configuration file. After that, the program displays temperature of the temperature sensors: clock@oberon:~$ sensors pcf8591-i2c-1-4f Adapter: Parallel port adapter Temp. 1: 22.07 V Temp. 2: 23.19 V Output: 0.00 V (enabled) [...]
|
| ||
| ||
Send feedback to ![]() | (c)1998-2004 Karel 'Clock' Kulhavý | |
| ||
|